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.

801.

Which option is false for the following code? class A { private : int sum(int x, int y) { return x+y; } public: A() { } A(int x, int y) { cout<<sum(x,y); } };

A. Constructor can be created with zero argument
B. Constructor prints sum, if two parameters are passed with object creation
C. Constructor will give error if float values are passed
D. Constructor will take 0 as default value of parameters if not passed
Answer» E.
802.

Which member will never be used from the following class? class A() { int marks; char name[20]; public : A() { marks=100; } void disp() { cout<< Marks= &lt'<marks; cout<< Student ; } };

A. Name variable will never be used
B. Marks variable will never be used
C. Constructor will never be used
D. Disp() function will never be used
Answer» B. Marks variable will never be used
803.

Which data member in following code will be used whenever an object is created? Class A { int x; int y; int z; public : A() { y=100; x=100*y; } };

A. X will be used
B. Y will be used
C. Z will be used
D. All will be used
Answer» D. All will be used
804.

Which member can be considered most secure in the code below? class A() { int a; private : int b; protected : int c; public : int d; };

A. A
B. B
C. C
D. D
Answer» C. C
805.

Which among the following is correct for the code given below? class A { private : A() { } public : A(int x) { } }; A a; A b(100);

A. Program will give compile time error
B. Program will run fine
C. Program will give runtime error
D. Program will give logical error
Answer» B. Program will run fine
806.

For the following code, choose the correct option: class A { int marks; protected : A() { marks=100; } public : A( int x) { marks=x; } };

A. The instances can be created only in subclasses
B. The instances can be created only in main() function
C. The instances can be created only in parent class
D. The instances can be created anywhere in the program
Answer» E.
807.

Predict the output of the program. class A { public int i; }; void main() { A x; A y=x; x.i=10; y.i=20; y.i++; y.i=20; cout&l;<tx.i; }

A. 10
B. 20
C. 21
D. 0
Answer» C. 21
808.

What will be the output if all necessary code is included (Header files and main function)? void test (Object &y) { y = "It is a string"; } void main() { Object x = null; test (x); System.out.println (x); }

A. Run time error
B. Compile time error
C. Null
D. It is a string
Answer» E.
809.

All these characters in a string , ?, *, , &Hat, $, ] are escaped by

A. Remove ( ) function
B. Removechar ( )
C. Addslashes ( )
D. Quotemeta ( )
Answer» E.
810.

In Perl-compatible patterns any pattern that is followed by ? this means that

A. Match this pattern 1 or more times
B. Match this pattern exactly 1 time
C. Match this pattern 0 times
D. None of them
Answer» C. Match this pattern 0 times
811.

What is meaning of . in POSIX style regex?

A. Matches any character of a string
B. Matches the beginning of a string
C. Matches the end of a string
D. None of them
Answer» B. Matches the beginning of a string
812.

Which of the following PHP function is commonly used when handling authentication via PHP? i) $_SERVER[ PHP_AUTH_USER ]. ii) $_SERVER[ PHP_AUTH_USERS ]. iii) $_SERVER[ PHP_AUTH_PU ]. iv) $_SERVER[ PHP_AUTH_PW ].

A. I) and iv)
B. Ii) and iv)
C. Ii) and iii)
D. I) and iii)
Answer» B. Ii) and iv)
813.

In which of the following situations does file-based authentication become inconvenient. i) small list ii) large number of user iii) users are being regularly added iv) static authentication

A. I) and iv)
B. I) and iii)
C. Ii) and iii)
D. Ii) and iv)
Answer» D. Ii) and iv)
814.

HTTP fopen tries to open an HTTP 1.0 connection to a file of a type

A. 0
B. 1
C. 1.2
D. 1.3
Answer» B. 1
815.

Syslog function allows you to

A. Open a system for a program
B. Generate a message
C. Delete a File
D. Both a and b
Answer» E.
816.

Which function is identical to fsockopen ( )

A. Open ( )
B. Fopen ( )
C. Pfsockopen ( )
D. None of them
Answer» D. None of them
817.

Rmdir (directory) function is used for

A. Removing files directory
B. Removing empty directory
C. Removing all old directories
D. All of them
Answer» C. Removing all old directories
818.

A socket is a kind of dedicated program that allows different programs to

A. Communicate
B. Send messages between them
C. Create connection with web server
D. All of them
Answer» E.
819.

Web and database servers communicate via

A. Fsockopen ( )
B. Open ( )
C. Fopen ( )
D. Copen ( )
Answer» B. Open ( )
820.

Fpassthru ( ) function reads all data from current position in an open file until

A. Middle of the file
B. End of the file
C. First line of the file
D. None of them
Answer» C. First line of the file
821.

What will be the output of the following PHP code? <?php echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid'); ?>

A. TRUE
B. FALSE
C. Valid
D. Invalid
Answer» E.
822.

What will be the output of the following code? If say date is 22/06/2013. <?php echo "Today is ".date("F d, Y") ?>

A. Today is 22 June, 2013
B. Today is 22-06-2013
C. Today is 06-22-2013
D. Today is June 22, 2013
Answer» E.
823.

What will be the output of the following PHP code? If say date is 22/06/2013. <?php printf( date("t") ) ?>

A. 30
B. 22
C. JUNE
D. 2013
Answer» B. 22
824.

Which one from following is a DNS function?

A. Stat ( )
B. Symlink ( )
C. Gethostbyaddr ( )
D. All of them
Answer» D. All of them
825.

A filesystem function clearstatcache ( ) id used for

A. Deleting files
B. Changing the state of cache
C. Clears cache of file status info
D. None of them
Answer» D. None of them
826.

Fread ( ) function will stop at end of file or when it reaches to

A. The specified location
B. The specified width
C. The specified length
D. All of them
Answer» D. All of them
827.

Mktime ( ) function allows you to convert any date into a

A. String
B. Characters
C. Timestamp
D. None of them
Answer» D. None of them
828.

File_get_contents function is included in

A. PHP1
B. PHP2.1
C. PHP3.4.0
D. PHP4.3.0
Answer» E.
829.

Fread ( ) function has parameter, file and

A. Width
B. Length
C. File name
D. None of them
Answer» C. File name
830.

If a file already exists symbol r+ is used for

A. Read only
B. Read and write
C. Write only
D. All of them
Answer» C. Write only
831.

Syslog function is an example of

A. Network function
B. HTML function
C. Server function
D. None of them
Answer» B. HTML function
832.

Fpassthru ( ) function writes result into a

A. Output buffer
B. String
C. Register
D. None of them
Answer» B. String
833.

Sockets are not destroyed when script exits, is property of

A. Fsockopen ( )
B. Fopen ( )
C. Get_open( )
D. Pfsockopen
Answer» E.
834.

Feof ( ) function is used in

A. For loop
B. While loop
C. Switch statement
D. All of them
Answer» C. Switch statement
835.

Fclose ($fd) is an example of

A. File write function
B. File close function
C. File read function
D. None of them
Answer» C. File read function
836.

$hostname, $port, [error number, error string, timeout in seconds] all are parameters of

A. Fsockopen ( )
B. Pfsockopen ( )
C. Fopen ( )
D. Both a and b
Answer» E.
837.

Fileperms ( ) function returns what?

A. Returns file permission level
B. Returns file parameters
C. Returns file modification time
D. None of them
Answer» B. Returns file parameters
838.

How many types of calendars are offered by PHP?

A. 2
B. 3
C. 4
D. 5
Answer» E.
839.

Which from following calendar is offered by PHP?

A. Julian
B. Unixian
C. Jewish
D. All of them
Answer» E.
840.

Which function is used to return date information?

A. Date ( )
B. Time_date ( )
C. Getdate ( )
D. All of them
Answer» D. All of them
841.

For checking existence of DNS records, which function is used?

A. Get_dns ( )
B. Checkdnsrr ( )
C. Get_hostdns ( )
D. None of them
Answer» C. Get_hostdns ( )
842.

A large number of PHP functions are duplicated from

A. Windows
B. Macintosh
C. Unix
D. All of them
Answer» D. All of them
843.

Global $count; this statement indicates what?

A. A variable is declared with that name of global
B. A constant is defined
C. Count variable declaration
D. Count variable declaration with global scope
Answer» E.
844.

Two broad types of control structures is branching and

A. Looping
B. Coding
C. Structuring
D. None of them
Answer» B. Coding
845.

Two main structures of branching are

A. If and switch
B. If and Do while
C. If and for
D. None of them
Answer» B. If and Do while
846.

Which of following operations are supported by PHP?

A. AND
B. OR, Exclusive OR
C. Not
D. All of them
Answer» E.
847.

Loops that iterate for fixed number of times is called

A. Unbounded loops
B. Bounded loops
C. While loops
D. For loops
Answer» C. While loops
848.

Which loop evaluates condition expression as Boolean, if it is true, it executes statements and when it is false it will terminate?

A. For loop
B. For each loop
C. While loop
D. All of them
Answer» D. All of them
849.

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

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

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

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