Explore topic-wise MCQs in Technical Programming.

This section includes 411 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.

301.

What will be the output of the following PHP code ?

A. 024
B. 120
C. 010
D. 160
Answer» C. 010
302.

What will be the output of the following PHP code ?

A. Array ( [a] => red [b] => green [c] => blue )
B. Array ( [a] => red [b] => green [c] => blue [d] => yellow )
C. Array ( [e] => red [f] => green [g] => blue )
D. Array ( [a] => red [b] => green [c] => blue [d] => yellow [e] => red [f] => green [g] => blue )
Answer» B. Array ( [a] => red [b] => green [c] => blue [d] => yellow )
303.

What will be the output of the following PHP code ?

A. Array ( [red] => red [green] => green [blue] => blue [yellow] => yellow )
B. Array ( [a] => a [b] => b [c] => c [d] => d )
C. Array ( [red] => a [green] => b [blue] => c [yellow] => d )
D. Array ( [a] => red [b] => green [c] => blue [d] => yellow )
Answer» D. Array ( [a] => red [b] => green [c] => blue [d] => yellow )
304.

What will be the output of the following PHP code ?

A. Array ( [Harry] => 21 [Ron] => 23 [Malfoy] => 21 )
B. Array ( [HARRY] => 21 [RON] => 23 [MALFOY] => 21 )
C. Array ( [HARRY] => 21 [RON] => 23 )
D. Array ( [Harry] => 21 [Ron] => 23 )
Answer» D. Array ( [Harry] => 21 [Ron] => 23 )
305.

What will be the output of the following PHP code?

A. Array ( [0] => LA [1] => Paris [2] => Paris )
B. Array ( [0] => NYC [1] => LA [2] => Paris)
C. Array ( [0] => NYC [1] => LA [2] => Paris [3] => Paris )
D. None of the mentioned
Answer» B. Array ( [0] => NYC [1] => LA [2] => Paris)
306.

What will be the output of the following PHP code?

A. Sam is the brother of Bob and Bob) $brother
B. Sam is the brother of Bob and Bob)
C. $brother
D. Error
Answer» E.
307.

What will be the output of the following PHP code?

A. Sam is the brother of Bob and Jack
B. Sam is the brother of Bob and Bob)
C. Sam is the brother of Jack and Bob)
D. Error
Answer» C. Sam is the brother of Jack and Bob)
308.

What will be the output of the following PHP code?

A. Array ( [1] => hello [4] => hello [5] => php ) Array ( [5] => php )
B. Array ( [1] => hello [2] => hello [3] => hello [4] => hello ) Array ( [5] => php )
C. Array ( [1] => hello [2] => hello [3] => hello [4] => hello [5] => php ) Array ( [5] => php )
D. Array ( [1] => hello [2] => hello [3] => hello [4] => hello ) Array ( [1] => php )
Answer» D. Array ( [1] => hello [2] => hello [3] => hello [4] => hello ) Array ( [1] => php )
309.

What will be the output of the following PHP code?

A. india Array ( [a] => china )
B. india Array ( [a] => brazil )
C. china Array ( [a] => india )
D. china Array ( [a] => brazil )
Answer» C. china Array ( [a] => india )
310.

What will be the output of the following PHP code?

A. Array ( [a] => blue [b] => yellow [c] => red [d] => green )
B. Array ( [0] => blue [1] => yellow [2] => red [3] => green )
C. Array ( [0] => red [1] => green [2] => blue [3] => yellow )
D. Array ( [a] => red [b] => green [c] => blue [d] => yellow )
Answer» E.
311.

What will be the output of the following PHP code?

A. Array ( [d] => yellow )
B. Array ( [i] => orange )
C. Array ( [h] => orange )
D. Array ( [d] => yellow [h] => orange )
Answer» B. Array ( [i] => orange )
312.

What will be the output of the following PHP code?

A. Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )
B. Array ( [A] => 2 [Cat] => 2 [Dog] => 1 [Tiger] => 1 )
C. Array ( [A] => 6 [Cat] => 1 [Dog] => 2 [Tiger] => 1 )
D. Array ( [A] => 2 [Cat] => 1 [Dog] => 4 [Tiger] => 1 )
Answer» B. Array ( [A] => 2 [Cat] => 2 [Dog] => 1 [Tiger] => 1 )
313.

What will be the output of the following PHP code? 1.

A. Array ( Peter Ben Joe )
B. Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
C. Array ( 35 37 43 )
D. Array ( [35] => Peter [37] => Ben [43] => Joe )
Answer» E.
314.

What will be the output of the following PHP code? 1.

A. I like Volvo, Toyota and BMW
B. I like Volvo, BMW and Toyota
C. I like BMW, Volvo and Toyota
D. I like Toyota, BMW and Volvo
Answer» E.
315.

Which function returns an array consisting of associative key/value pairs?

A. count()
B. array_count()
C. array_count_values()
D. count_values()
Answer» D. count_values()
316.

What will be the output of the following PHP code?

A. 3
B. 4
C. 5
D. 6
Answer» E.
317.

What will be the output of the following PHP code?

A. orangebanana
B. appleorange
C. orangeorange
D. appleapple
Answer» B. appleorange
318.

What will be the output of the following PHP code?

A. True
B. 1
C. False
D. 2
Answer» E.
319.

Which in-built function will add a value to the end of an array?

A. array_unshift()
B. into_array()
C. inend_array()
D. array_push()
Answer» E.
320.

What will be the output of the following php code?

A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Answer» C. population 11,35,000
321.

Which of the following are correct ways of creating an array? i) state[0] = “karnataka”; ii) $state[] = array(“karnataka”); iii) $state[0] = “karnataka”; iv) $state = array(“karnataka”);

A. iii) and iv)
B. ii) and iii)
C. Only i)
D. ii), iii) and iv)
Answer» B. ii) and iii)
322.

PHP’s numerically indexed array begin with position ___________

A. 1
B. 2
C. 0
D. -1
Answer» D. -1
323.

What will be the output of the following PHP code?

A. welcome to India
B. welcome to india
C. Welcome to India
D. Welcome to india
Answer» B. welcome to india
324.

What will be the output of the following PHP code?

A. I love my country
B. i love my Country
C. I love my Country
D. I Love My Country
Answer» E.
325.

What will be the output of the following PHP code?

A. Hello World
B. Hello World
C. Hell o wo rld
D. World
Answer» C. Hell o wo rld
326.

What will be the output of the following PHP code?

A. 106
B. 103
C. 104
D. 209
Answer» D. 209
327.

What will be the output of the following PHP code?

A. 1
B. 2
C. 3
D. 4
Answer» E.
328.

Which one of the following functions can be used to compress a string?

A. zip_compress()
B. zip()
C. compress()
D. gzcompress()
Answer» E.
329.

Which of the following PHP functions can be used for generating unique ids?

A. uniqueid()
B. id()
C. md5()
D. mdid()
Answer» B. id()
330.

Which of the following PHP functions can be used to get the current memory usage?

A. get_usage()
B. get_peak_usage()
C. get_memory_usage()
D. get_memory_peak_usage()
Answer» D. get_memory_peak_usage()
331.

Which one of the following PHP functions can be used to find files?

A. glob()
B. file()
C. fold()
D. get_file()
Answer» B. file()
332.

Which one of the following PHP functions can be used to build a function that accepts any number of arguments?

A. func_get_argv()
B. func_get_argc()
C. get_argv()
D. get_argc()
Answer» C. get_argv()
333.

What will be the output of the following PHP code?

A. Error
B. $msg
C. 0
D. Will this work
Answer» E.
334.

A function in PHP which starts with __ (double underscore) is know as..

A. Magic Function
B. Inbuilt Function
C. Default Function
D. User Defined Function
Answer» B. Inbuilt Function
335.

What will be the output of the following PHP code?

A. helloblabla
B. Error
C. hello
D. helloblablablabla
Answer» D. helloblablablabla
336.

What will be the output of the following PHP code?

A. I am b
B. I am bI am a
C. Error
D. I am a Error
Answer» D. I am a Error
337.

What will be the output of the following PHP code?

A. I am b
B. I am bI am a
C. Error
D. I am a Error
Answer» E.
338.

Which of the following are valid function names? i) function() ii) €() iii) .function() iv) $function()

A. Only ii)
B. None of the mentioned.
C. All of the mentioned.
D. iii) and iv)
Answer» B. None of the mentioned.
339.

What will be the output of the following PHP code?

A. Error
B. 0
C. 42
D. 84
Answer» D. 84
340.

What will happen in this function call?

A. Call By Value
B. Call By Reference
C. Default Argument Value
D. Type Hinting
Answer» B. Call By Reference
341.

Type Hinting was introduced in which version of PHP?

A. PHP 4
B. PHP 5
C. PHP 5.3
D. PHP 6
Answer» C. PHP 5.3
342.

Which one of the following is the right way of defining a function in PHP?

A. function { function body }
B. data type functionName(parameters) { function body }
C. functionName(parameters) { function body }
D. function fumctionName(parameters) { function body }
Answer» E.
343.

Who is the father of PHP?

A. Rasmus Lerdorf
B. Willam Makepiece
C. Drek Kolkevi
D. List Barely
Answer» B. Willam Makepiece
344.

What is the value of $a and $b after the function call?

A. a is 3 and b is 4
B. a is 4 and b is 3
C. Both are 3
D. Both are 4
Answer» C. Both are 3
345.

If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?

A. 12
B. 1
C. Error
D. 5
Answer» E.
346.

What will be the output of the following PHP code?

A. AshleyBale
B. AshleyBaleBlank
C. ShrekBlank
D. Shrek
Answer» C. ShrekBlank
347.

Which of the looping statements is/are supported by PHP? i) for loop ii) while loop iii) do-while loop iv) foreach loop

A. i) and ii)
B. i), ii) and iii)
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
348.

What will be the output of the following PHP code?

A. I love arsenal
B. Error
C. I love arsenalI love manc
D. I love arsenalI love mancI love manu
Answer» D. I love arsenalI love mancI love manu
349.

Which of the conditional statements is/are supported by PHP? i) if statements ii) if-else statements iii) if-elseif statements iv) switch statements

A. Only i)
B. i), ii) and iv)
C. ii), iii) and iv)
D. All of the mentioned.
Answer» E.
350.

What will be the output of the following PHP code?

A. What is her age? She is $num years old
B. What is her age? She is $num years old
C. What is her age? She is 10 years old
D. What is her age? She is 10 years old
Answer» B. What is her age? She is $num years old