You are on page 1of 8

Internet Programming I

MKSSS's Shri Siddhivinayak Mahila Mahavidyalaya , Karve Nagar, Pune-52


Department of Computer Science TYBSc(CS) SEM I CS-334 Internet Programming I Question Bank
Sr. Question Option 1 Option 2 Option 3 Option 4
No.
1 What does PHP stand for? Both i) and iii) Only ii) Both i) and ii)
i) Personal Home Page ii) Hypertext Preprocessor Both ii) and iv)
iii) Pretext Hypertext Processor iv) Preprocessor Home Page
2) PHP files have a default file extension of_______ .html .xml .php .ph
3) Which of the following must be installed on your computer so as to run PHP i), ii), iii) and iv) Only ii) ii) and iii) ii), iii) and iv)
script?".
i) Adobe Dreamweaver. i) XAMPP iii) Apache and PHP iv) IIS
4) Which version of PHP introduced Try/catch Exception? PHP 4 PHP 5 PHP 6 PHP 5 and later
5) How should we add a single line comment in our PHP code? Only ii) i), iii) and iv) ii), iii) and iv) Both ii) and iv)
i) /? ii) // iii) # iv) /* */
6) Which of the following PHP statement/statements will store 111 in variable Both i) and ii) i), ii), iii) and iv) Only iii) Only i)
num?
i) int $num = 111; ii) int mum = 111; iii) $num = 111; iv) 111 = $num;
7) What will be the output of the following PHP code? 3 1+2 Error 12
<?php
$num = "1";
$num1 = "2";
print $num+$num1;
?>
8) What will be the output of the following PHP code? Error My name is BobBob My name is BobMy My name is Bob Bob
<?php name is Bob
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>
9) Which of the following PHP statements will output Hello World on the screen? i) and ii) i) ,ii) and iii) i), ii),iii) and iv) i) , ii) and iv)
i) echo ("Hello World"); ii) print ("Hello World");
iii) printf ("Hello World"); iv) sprintf ("Hello World");

1
Internet Programming I

10) What will be the output of the following PHP code? 1 Error 1234 2
<?php
$score = 1234;
$scoreboard = (array) $score;
echo $scoreboard[0];
?>
11) What will be the output of the following PHP code? 123 111 0 1
<?php
function track() {
static $count = 0;
$count++;
echo $count;
}
track();
track();
track();
?>
12) Which of the below symbols is a newline character? \r \n /n /r
13) Which of the conditional statements is/are supported by PHP? Only i) i),ii) and iv) ii),iii) and iv) i),ii),iii) and iv)
i) if statements ii) if-else statements
iii) if-elseif statements iv) switch statements
14) Which of the looping statements is/are supported by PHP? i) and ii) i), ii) and iii) i), ii), iii) and iv) Only iv)
i) for loop ii) while loop iii) do-while loop iv) foreach loop
15) Who is the father of PHP? Rasmus Lerdorf Willam Makepiece Drek Kolkevi List Barely
16) Function is defined in PHP by_______________. Function Data type FunctionName Function {function body}
functionName functionName (parameters) {function
(parameters) {function (parameters) {function body}
body} body}
17) __________ PHP functions that accepts any number of parameters . func_get_argv() get_argv() func_get_args() get_argc()
18) _______ is the PHP functions which is used to find files. A. file() glob() fold() get_file()
19) PHP’s numerically indexed array can be started with which of the following 0 2 1 -1
position?
20) PHP function which will return true if a variable is an array or false if it is not an is_array() this_array() do_array() in_array()
array.
21) Which of the following in-built function will add a value to the end of an array? array_push() into_array() inend_array() array_unshift()
22) _________ Function is used to get the value of the previous element in an array. prev() before() last() previous()
23) Which of the following function will returns an array consisting of associative count() array_count() array_count_values() count_values()
key/value pairs?

2
Internet Programming I

24) _______ property scopes is not supported by PHP? static final public friendly
25) Which of the following is used to instantiate an object in PHP assuming the class $obj = new foo (); $obj = new foo; $obj = new $foo; obj = new foo ();
name to be Foo?
26) The right way to define a constant? constant PI = “3.1415”; const $PI = “3.1415”; const PI = ‘3.1415’; constant PI = ‘3.1415’;
27) In PHP how to invoke a method? $object- object- object::methodName(); $object::methodName();
>methodName(); >methodName();
28) .In PHP which of the following advanced OOP features is NOT supported? i) ii) iii) and iv) i) and ii)
i) Method overloading ii) Multiple Inheritance iii) Namespaces
iv) Object Cloning
29) If your object must inherit behavior from a number of sources you must use a/an Abstract class Object Interface Static class
30) .To tweak an object’s cloning behavior what method is used? clone() object_clone() _clone __clone()
31) To call more than one function of the class in single instruction_______ is Method chaining Method Including Method adding Typecasting
uesd?
31) _______ is the description of Error level E_ERROR in PHP. Fatal Compile-time Near-fatal error Compile-time error Fatal run-time error
error
31) _______ character do the error _reporting directive use to represent the logical ~ ! / ^
operator NOT.
32) Function which is responsible for sending a custom message to the system log? systemlog() syslog() log_system() sys_log()
33) What does explode ( ) function do? Converts a string into Converts a string into Finds the length of array Finds the length of string
integers arrays
34) For changing arrays into strings, which function is used? exp ( ) explode ( ) implode ( ) imp ( )
35) Array_flip ( ) function changes keys of an array into Integers Characters Boolean Values
36) Shuffle ( ) function operates directly on its array arguments and changes it, that's Constructive Function Destructive function Array changing function None of them
why it is called
37) FIFO stands for List of Outputs Last in First Out First in Last Out None of them
38) Array_splice function is same as array_slice but it starts taking arguments from First argument Second argument Third argument Fourth argument
39) Act of adding values into a stack is called Popping Polling Pushing None
For changing array with random numbers which function we can use? reverse ( ) function random ( ) array_random_number ( shuffle ( )
)
41) Arsort ( ) function same as asort ( ) but It sorts values in It sorts values in It start sorting values None of them
descending order ascending order from middle
42) Popping is an act of Adding values Taking off values Transferring values from None of them
from stack stack
43) Array_merge ( ) function merges Two arrays Three arrays More than three Merges array with a string
42) For reversing an array which function is used? reverse ( ) function array_rev ( ) function array_reverse ( ) change_array_order ( )

3
Internet Programming I

43) Side effect of array_pop ( ) function is It removes the first It removes last It modifies an array from All of them
element of an array element of an array middle
44) What will happen in this function call?
<?php Call By Value Call By Reference Default Argument Value Type Hinting
function calc($price, $tax)
{
$total = $price + $tax;
}
$pricetag = 15;
$taxtag = 3;
calc($pricetag, $taxtag);
?>
45) Which of the following are correct ways of creating an array? iii) and iv)
i) state[0] = “karnataka”; ii) $state[] = array(“karnataka”); ii) and iii) Only i) ii), iii) and iv)
iii) $state[0] = “karnataka”; iv) $state = array(“karnataka”);
46) What will be the output of the following PHP code? orangebanana
<?php appleorange orangeorange appleapple
$fruits = array ("apple", "orange", "banana");
echo (next($fruits));
echo (next($fruits));
?>
47) What will be the output of the following PHP code? 3 4 5 6
<?php
$fruits = array ("apple", "orange", array ("pear", "mango"),
"banana");
echo (count($fruits, 1));
?>
48) What will be the output of the following PHP code?
<?php like Volvo, Toyota I like Volvo, BMW I like BMW, Volvo and I like Toyota, BMW and
$cars = array("Volvo", "BMW", "Toyota"); and BMW and Toyota Toyota Volvo
echo "I like " . $cars[2] . ", " . $cars[1] . " and " . $cars[0] . ".";
?>
49) What will be the output of the following PHP code? Array ( Peter Ben Joe )
<?php Array ( [Peter] => 35 Array ( 35 37 43 ) Array ( [35] => Peter [37]
$fname = array("Peter", "Ben", "Joe"); [Ben] => 37 [Joe] => => Ben [43] => Joe )
$age = array("35", "37", "43"); 43 )
$c = array_combine($age, $fname);
print_r($c);
?>

4
Internet Programming I

50) What will be the output of the following PHP code ? 24 120 10 60
<?php
$a = array(12, 5, 2);
echo(array_product($a));
?>
51) Which one of the following statements is used to create a table? CREATE TABLE CREATE table_name CREATE table_name CREATE TABLE
table_name (column_type (column_name table_name (column_type
(column_name column_name); column_type); column_name);
column_type);
52) If there is no error, then what will the error() method return? TRUE FALSE Empty String 0
53) Which one of the following statements should be used to include a file? #include ‘filename’; include ‘filename’; @include ‘filename’; #include <filename>;
54) PHP is an example of ___________ scripting language. Server-side Client-side Browser-side In-side
55) In how many ways we can create strings in PHP? 1 2 3 4
56) Which type of string can processes special characters inside quotes? single quote string double quote string Both A and B None of the above
57) Which of the following is not a Built-in String functions in php? strlen() str_replace() strpos() strreverse()
58) Why trim() function is used in php? to remove whitespaces to remove lowercase to remove uppercase to remove underscore
alphabet alphabet
59) Which of the following is the output of the below code? 4 5 6 7
<?php
echo strpos("Hello letsfindcourse!", "lets"), " \n";
?>
60) Which of the following is the output of the below code? int(13) char(14) int(14) int(15)
<?php
var_dump(strpos("Hello letsfindcourse!", "course"));
?>
61) Which is true about var_dump() function? var_dump() loops var_dump() cuts off var_dump() cuts off loop var_dump() cuts off loop
infinitely loop afetr getting after getting the same after getting the same
same element two element three times element five times
times
62) The ________ function compares the two strings s1 and s2, ignoring the case of strtolower() toLowerCase() strcasecmp() lc()
the characters.
63) Returns a string arguments with trilling blank space removed, is a behavior of starts( ) function chop( ) function rtrim( ) function lc()

5
Internet Programming I

64) What is the output of the following php code? Error No Output Name must be all Name is all lowercase!
<?php lowercase!
$username = "letsfindcourse";
if (preg_match("([^a-z])",$username))
echo "Name must be all lowercase!";
else
echo "Name is all lowercase!";
?>
65) Any variables declared in PHP must begin with a _____? . # & $
66) A variable can have ________? long descriptive names short names Both A and B None of the above
67) A variable name can only contain ____________? alphanumeric underscores Both A and B None of the above
characters
68) PHP variables are case-sensitive? True FALSE For "sum" variable it is None of the above
case-sensitive
69) How many variable scope are there in php? 2 3 1 4
70) What will be the output of the following PHP code? $x + $y 3 1+2 12
<?php
$x = 1;
$y = 2;
$z = "$x + $y";
echo "$z";
?>
71) What will be the output of the following PHP code? 1.3 1 0 Error
<?php
$x = 3.3;
$y = 2;
echo $x % $y;
?>
72) What will be the output of the following PHP code? 2 3 4 5
<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a % ($b) + $c);
?>

6
Internet Programming I

73) What will be the output of the following PHP code? 1 -1 2 -2

<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a * (($b) - $c));
?>
74) Objects are also known as ______. reference template class instances
75) A member function typically accesses members of _____ object only current previous next All of the above
76) Constructor is also called ____ function find key automatic magic
77) PHP recognizes constructors by the name. classname() _construct() function _construct() function __construct()
78) Which one of the following functions is used to determine object type? obj_type () type() is_a() is_obj()
79) Classes are the _______ of objects. type blueprints reference instances
80) . Class is a programmer-defined data type, which includes _____ methods and local, global global, global local,global local, local
______ variable?
81) What will be the syntax of defining the class? class lfc () class lfc [] class lfc {} lfc class{}
82) We define our own class by starting with the keyword ______ ? class function auto var
83) Which of the following is the output of the below code? The class The class lfc was Error No Output
<?php letsfindcourse was initiated!<br>
class letsfindcourse initiated!<br>
{
public function __construct(){
echo 'The class "' . __CLASS__ . '" was initiated!<br>';
}
}

$lfc = new letsfindcourse;


?>
84) Which one of the following functions is used to determine whether a class exist() exist_class() class_exist() __exist()
exists?
85) Which keyword is used to refer to properties or methods within the class itself? private public protected this
86) The class from which the child class inherits is called Only (i) (ii), (iii) and (iv) Only (iii) (ii) and (iv)
(i) Child class (ii) Parent class (iii) Super class (iv) Base class
87) Why should we use functions? Reusability Easier error detection Easily maintained All of the above
88) A function name is not case-sensitive? TRUE FALSE Only user-defined None of the above
function is case-sensitive

7
Internet Programming I

89) Which of the following is not a built-in function in php ? print_r() fopen() fclosed() gettype()
90) A function name always begins with the keyword _________. fun def function None of the above
91) Which of the following DBMSs do not have a native PHP extension? MySQL PostgreSQL Microsoft SQL Server None of the above
92) Transactions are used to treat sets of SQL statements atomically. TRUE FALSE
93) SQL is not case sensitive. SELECT is the same as select. TRUE FALSE
94) Which of the following is not an SQL aggregate function? AVG SUM MIN CURRENT_DATE()
95) The ............. statement is used to delete a table. DROP TABLE DELETE TABLE DEL TABLE REMOVE TABLE
96) Use the .............. to delete the data inside the table, and not the table itself? DROP TABLE DELETE TABLE TRUNCATE TABLE REMOVE TABLE
97) Can joins be nested? TRUE FALSE
98) Which function is offered by PHP for connecting to a postgreSQL? con ( ) con_psql ( ) pg_connect ( ) pg_con ( )
99) .When you want to use a join between columns that are in the same table, you union right outer left outer self
use what type of join?
100) True or False? When using a SELECT statement on a table, or group of tables, TRUE FALSE
those resources are locked exclusively.

You might also like