Explore topic-wise MCQs in Testing Subject.

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

1.

What will be the output of the following PHP code ? <?php $a = "a"; if ($a) print "all"; else print "some"; ?>

A. All
B. Some
C. Error
D. No output
Answer» B. Some
2.

What will be the output of the following PHP code ? <?php $x = 10; $y = 20; if ($x > $y + $y != 3) print "hi" ; else print "how are u"; ?>

A. How are u
B. Hi
C. Error
D. No output
Answer» C. Error
3.

What will be the output of the following PHP code ? <?php $x = 10; $y = 20; if ($x > $y && 1||1) print "hi" ; else print "how are u"; ?>

A. How are u
B. Hi
C. Error
D. No output
Answer» C. Error
4.

What will be the output of the following PHP code ? <?php $x = 10; $y = 20; if ($x > $y && 1||1) print "hi" ; else print "how are u"; ?>

A. How are u
B. Hi
C. Error
D. No output
Answer» C. Error
5.

What will be the output of the following PHP code ? <?php if (0.1) print "hi" ; else print "how are u"; ?>

A. How are u
B. Hi
C. Error
D. No output
Answer» C. Error
6.

What will be the output of the following PHP code ? <?php if (0.0) print "hi" ; else print "how are u"; ?> a) how are u

A. How are u
B. Hi
C. Error
D. No output
Answer» B. Hi
7.

What will be the output of the following PHP code ? <?php if (print "0") print "hi" ; else print "how are u"; ?>

A. 0how are u
B. 0hi
C. Hi
D. How are u
Answer» C. Hi
8.

What will be the output of the following PHP code ? <?php $x = 1; if ($x == 2) print "hi" ; else if($x = 2) print $x; else print "how are u"; ?>

A. Error
B. 2
C. Hi
D. How are u
Answer» C. Hi
9.

What will be the output of the following PHP code ? <?php $x = 1; if ($x = $x&0) print $x ; else print "how are u"; ?>

A. 0
B. 1
C. Error
D. How are u
Answer» E.
10.

What will be the output of the following PHP code ? <?php $x = 1; if ($x = $x&0) print $x ; else print "how are u"; ?>

A. 0
B. 1
C. Error
D. No output
Answer» D. No output
11.

What will be the output of the following PHP code ? <?php $x = 10; $y = 5; $z = 3; if ($x / $y / $z) print "hi"; else print "hello"; ?>

A. Hi
B. Hello
C. Error
D. No output
Answer» B. Hello
12.

What will be the output of the following PHP code ? <?php if (!print "hi") if (print "hello") print "hi"; ?>

A. Hi
B. Hihellohi
C. Hihi
D. No output
Answer» B. Hihellohi
13.

Basic syntax for calling a function is

A. Function_name (experssion1, expersion2)
B. (experssion1 : Function_name, expersion2 : Function_name)
C. (experssion1, expersion2)
D. None of them
Answer» B. (experssion1 : Function_name, expersion2 : Function_name)
14.

What will be the output of the following PHP code? <?php $x; if ($x) print "hi" ; else print "how are u"; ?>

A. How are u
B. Hi
C. Error
D. No output
Answer» B. Hi
15.

What will be the output of the following PHP code ? <?php $x = 0; if ($x++) print "hi"; else print "how are u"; ?>

A. Hi
B. No output
C. Error
D. How are u
Answer» E.
16.

What will be the output of the following PHP code ? <?php $x; if ($x == 0) print "hi" ; else print "how are u"; print "hello" ?>

A. How are uhello
B. Hihello
C. Hi
D. No output
Answer» C. Hi
17.

What will be the output of the following PHP code ? <?php $x = 0; if ($x == 1) if ($x >= 0) print "true"; else print "false"; ?>

A. True
B. False
C. Error
D. No output
Answer» E.
18.

What will be the output of the following PHP code ? <?php $a = 1; if ($a--) print "True"; if ($a++) print "False"; ?>

A. True
B. False
C. Error
D. No output
Answer» B. False
19.

What will be the output of the following PHP code ? <?php $a = 1; if (print $a) print "True"; else print "False"; ?>

A. True
B. False
C. Error
D. No output
Answer» B. False
20.

What will be the output of the following PHP code ? <?php $a = 10; if (1) print "all"; else print "some" else print "none"; ?>

A. All
B. Some
C. Error
D. None
Answer» D. None
21.

After unserialize ( ) function which function is called

A. __sleep ( )
B. __alive ( )
C. __wakeup ( )
D. None of them
Answer» D. None of them
22.

Functionality of Destructors are offered in

A. PHP4
B. PHP4.2
C. PHP5
D. PHP6
Answer» D. PHP6
23.

For changing string again into original value which function is used

A. Overloading ( )
B. Overriding ( )
C. Serialize ( )
D. Unserialize ( )
Answer» E.
24.

__sleep ( ) function is called when you

A. Serialize an object
B. Unserialize an object
C. Share an object
D. Choose an object
Answer» B. Unserialize an object
25.

An individual instance in OOP is called as

A. Class
B. Function
C. Object
D. Constructor
Answer» D. Constructor
26.

Extends clause is used for

A. Inheriting a class from another class
B. Function extension
C. Creating constructors
D. None of them
Answer» B. Function extension
27.

Functionality of Constructors are offered in

A. PHP1
B. PHP 3
C. PHP4
D. PHP4.2
Answer» E.
28.

The class from which the child class inherits is called.. i) Child class ii) Parent class iii) Super class iv) Base class

A. Only i)
B. Ii), iii) and iv)
C. Only iii)
D. Ii) and iv)
Answer» E.
29.

Which of the following is/are the right way to declare a method? i) function functionName() { function body } ii) scope function functionName() { function body } iii) method methodName() { method body } iv) scope method methodName() { method body }

A. Only ii)
B. Only iv)
C. I) and ii)
D. Iii) and iv)
Answer» D. Iii) and iv)
30.

Which of the following method scopes is/are not supported by PHP? i) private ii) final iii) static iv) abstract

A. Only ii)
B. Only iv)
C. Ii) and iv)
D. None of the mentioned
Answer» E.
31.

Which of the following statements is/are true about Constructors in PHP? i) PHP 4 introduced class constructors. ii) Constructors can accept parameters. iii) Constructors can call class methods or other functions. iv) Class constructors can call on other constructors.

A. Ii) and iii)
B. All of the mentioned
C. None of the mentioned
D. Ii), iii) and iv)
Answer» C. None of the mentioned
32.

In the PHP code given below, what is/are the properties? <?php class Example { public $name; function Sample() { echo "This is an example"; } } ?>

A. Public $name;
B. Class Example
C. Function sample()
Answer» C. Function sample()
33.

Which of the following advanced OOP features is/are not supported by PHP? i) Method overloading ii) Multiple Inheritance iii) Namespaces iv) Object Cloning

A. All of the mentioned
B. None of the mentioned
C. I) and ii)
D. Iii) and iv)
Answer» D. Iii) and iv)
34.

Constructor function must have a same name as name of a

A. Class
B. Object
C. Method
D. Instance
Answer» B. Object
35.

If everything is fine in object selftest ( ) function returns what?

A. TRUE
B. FALSE
C. Diagnostic string
D. Noting
Answer» C. Diagnostic string
36.

PHP supports

A. Public variables
B. Private variables
C. Protected variables
D. All of them
Answer» E.
37.

Namespaces defines a area in which an identifier is

A. Unique
B. Same type
C. Static
D. None of them
Answer» B. Same type
38.

To ask objects about their classes, and ask classes about their parents without searching in code, is example of

A. Serialization
B. Inspection
C. Introspection
D. Equalization
Answer» D. Equalization
39.

Pear coding style recommends that class name begins with

A. Lowercase letter
B. Uppercase letter
C. Letter A
D. Both a and b
Answer» C. Letter A
40.

Parent class is a

A. Super class
B. Base class
C. Derived class
D. Both a and b
Answer» E.
41.

Destruct ( ) function is used to call a

A. Constructor
B. Destructor
C. Object
D. Method
Answer» C. Object
42.

PHP does not support multiple inheritance but it supports

A. Chained subclassing
B. Classified subclassing
C. Unique subclassing
D. None of them
Answer» B. Classified subclassing
43.

How many functions are used by PHP that can encode and decode values into string?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
44.

PHP offers no support for

A. HTML
B. JavaScript
C. Multiple inheritance
D. All of them
Answer» D. All of them
45.

An abstract class is one that cannot be instantiated but

A. Only inherited
B. Only declared
C. Only copied
D. All of them
Answer» B. Only declared
46.

A process that converts a string of bytes in such a way that you can produce original data again, is known as

A. Synchronization
B. Specialization
C. Serialization
D. Parallelization
Answer» D. Parallelization
47.

Get_class ( ) function returns name of class from where

A. A function belongs to
B. An object belongs to
C. A constructor belongs to
D. All of them
Answer» C. A constructor belongs to
48.

Which function returns TRUE if string argument is name of a class?

A. Get_class ( )
B. Exist_class ( )
C. Class_exists
D. None of them
Answer» D. None of them
49.

Protected members of a class is accessible to class in which

A. It is not declared
B. It is declared
C. It is moved
D. None of them
Answer» C. It is moved
50.

=== operator is true if its two arguments are exactly

A. Equal
B. Opposite
C. Has the same type
D. Both a and c
Answer» E.