Explore topic-wise MCQs in General Awareness.

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

851.

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
852.

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
853.

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
854.

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
855.

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
856.

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
857.

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
858.

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
859.

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.
860.

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
861.

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
862.

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
863.

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)
864.

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
865.

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.
866.

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
867.

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.
868.

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
869.

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
870.

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
871.

After unserialize ( ) function which function is called

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

Functionality of Destructors are offered in

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

For changing string again into original value which function is used

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

__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
875.

An individual instance in OOP is called as

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

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
877.

Functionality of Constructors are offered in

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

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.
879.

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)
880.

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.
881.

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
882.

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()
883.

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)
884.

Constructor function must have a same name as name of a

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

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

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

PHP supports

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

Namespaces defines a area in which an identifier is

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

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
889.

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
890.

Parent class is a

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

Destruct ( ) function is used to call a

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

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
893.

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
894.

PHP offers no support for

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

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
896.

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
897.

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
898.

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
899.

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
900.

=== 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.