76
77.7k

90+ Linux and PHP Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Bachelor of Science in Computer Science (BSc CS) .

51.

PHP is an open source software

A. True
B. False
Answer» A. True
52.

Which of the following is not valid PHP code?

A. $_10
B. ${“MyVar”}
C. &$something
D. $10_somethings
Answer» D. $10_somethings
53.

What is the difference between print() and echo()?

A. print() can be used as part of an expression, while echo() can’t
B. echo() can be used in the CLI version of PHP, while print() can’t
C. print() can be used in the CLI version of PHP, while echo() can’t
D. There’s no difference: both functions print out some text!
Answer» A. print() can be used as part of an expression, while echo() can’t
54.

PHP runs on different platforms (Windows, Linux, Unix, etc.)

A. True
B. False
Answer» A. True
55.

Use the ___________ to delete the data inside the table, and not the table itself?

A. DEOP TABLE
B. DELETE TABLE
C. TRUNCATE TABLE
D. REMOVE TABLE
Answer» C. TRUNCATE TABLE
56.

In mail($param1, $param2, $param3, $param4), the $param2 contains:

A. The message
B. The recipient
C. The header
D. The subject
Answer» D. The subject
57.

Which of the following delimiter is ASP style?

A. <% %>
B. <? ?>
C. <script language=”php”></script>
D. All of the above
Answer» A. <% %>
58.

What is the purpose of basename() function in PHP?

A. Returns the last accessed time of the file
B. Returns the first accessed time of the file
C. Strips of the path and returns the file name.
D. Strips of the path the returns of the folder name.
Answer» C. Strips of the path and returns the file name.
59.

In PHP, fgets() is used to read a file one line at a time.

A. TRUE
B. FALSE
Answer» A. TRUE
60.

Which of the following statement produce different output

A. <? echo “this is php example”; ?>
B. <P=”This is php example”;?>
C. <?php echo “This is php example”; php?>
D. <script language=”php”>print “This is php example”;</script>
Answer» C. <?php echo “This is php example”; php?>
61.

Which of the following data type is compound datatype supported by PHP.

A. Array
B. String
C. Float
D. Boolean
Answer» A. Array
62.

Which of the following functions in PHP do not return a timestamp?

A. time()
B. date()
C. strtotime()
D. gmmktime()
Answer» B. date()
63.

Which of the following are valid float values?

A. 4.5678
B. 4
C. 7.00E+04
D. All of the above
Answer» D. All of the above
64.

Which of the following type specifier is invalid in printf() functions.

A. % a
B. % b
C. % c
D. % d
Answer» A. % a
65.

Transactions are used to treat sets of SQL statements atomically.

A. TRUE
B. FALSE
Answer» A. TRUE
66.

How does the identity operator ===compare two values in PHP?

A. It converts them to common compatible data type and then compares the resulting values.
B. It returns True only if they are both of the same type and value
C. If the two values are strings, it performs a lexical comparison
D. It based its comparison on the C strcmp function exclusively
Answer» B. It returns True only if they are both of the same type and value
67.

Which of the following is not an SQL aggregate function?

A. AVG
B. SUM
C. MIN
D. CURRENT_DATE()
Answer» D. CURRENT_DATE()
68.

The _____________ statement is used to delete a table in MySQL.

A. DROP TABLE
B. DELETE TABLE
C. DEL TABLE
D. REMOVE TABLE
Answer» A. DROP TABLE
69.

The ____________function parses an English textual date or time into Unix timestamp in PHP.

A. strtodate()
B. stroftime()
C. strtotime()
D. str_to_time()
Answer» C. strtotime()
70.

Which function(s) in PHP computes the difference of arrays?

A. array_diff
B. diff_array
C. arrays_diff
D. diff_arrays
Answer» A. array_diff
71.

______________ Returns the time of sunrise for a given day / location in PHP.

A. datesunrise()
B. date_sunrise()
C. date-sunrise()
D. date.sunrise()
Answer» B. date_sunrise()
72.

What is the difference between print() and echo() in PHP?

A. print has a return value of 1 so it can be used in expressions where as echo has a void return type
B. echo() can be used in the CLI version of PHP, while print() can’t
C. print() can be used in the CLI version of PHP, while echo() can’t
D. There’s no difference: both functions print out some text!
Answer» B. echo() can be used in the CLI version of PHP, while print() can’t
73.

The ___________ function is used to read a single character from a file in PHP.

A. fgetc()
B. fgets()
C. fget()
D. fgetf()
Answer» A. fgetc()
74.

In PHP, which of the following(s) count elements in an array?

A. count
B. Sizeof
C. Array_Count
D. Count_array
Answer» A. count
75.

Which syntax is default syntax in PHP?

A. < ?php ?>
B. <% %>
C. < ? ?>
D. < script language="php">
Answer» A. < ?php ?>
76.

Which of the following delimiter syntax is PHP's default delimiter syntax

A. <? php ?>
B. <% %>
C. <? ?>
D. <script language="php"> </script>
Answer» A. <? php ?>
77.

Which of the following delimiter is default in PHP?

A. <?php ?>
B. <% %>
C. <? ?>
D. <script language="php"> </script>
Answer» A. <?php ?>
78.

What is the expansion of LAMP?

A. Linux And MySQL PHP
B. Linux Apache MySQL PHP
Answer» B. Linux Apache MySQL PHP
79.

Which operator is used to concatenate two strings in PHP?

A. dot operator (.)
B. plus operator (+)
Answer» A. dot operator (.)
80.

Whether One-line comment begin with pound sing(#) in PHP?

A. True
B. False
Answer» A. True
81.

Which of following comments is supported by PHP.

A. Single line c++ syntax - //
B. Shell syntax - #
C. Both of above
D. None of above
Answer» C. Both of above
82.

What PHP stands for?

A. Hypertext Preprocessor
B. Pre Hypertext Processor
C. Pre Hyper Processor
D. PHP: Hypertext Preprocessor
Answer» D. PHP: Hypertext Preprocessor
83.

There are three different kind of arrays:

A. Numeric array, String array, Multidimensional array
B. Numeric array, Associative array, Dimensional array
C. Numeric array, Associative array, Multidimensional array
D. Const array, Associative array, Multidimensional array
Answer» C. Numeric array, Associative array, Multidimensional array
84.

PHP is __________________.

A. Partially cross-platform
B. Truly cross-platform
Answer» B. Truly cross-platform
85.

Can we embedded directly PHP code into XHTML document?

A. FALSE
B. TRUE
Answer» B. TRUE
86.

Variables always start with a ________ in PHP.

A. Pond-sign
B. Yen-sign
C. Dollar-sign
D. Euro-sign
Answer» C. Dollar-sign
87.

Which of the following function is used to change the root directory in PHP?

A. choot()
B. change_root()
C. cd_root()
D. cd_r()
Answer» A. choot()
88.

Which of the following tags in PHP is not a valid way to begin and end a PHP code block?

A. <?php ?>
B. <! -->
C. <? ?>
D. <script language="php"></script>
Answer» B. <! -->
89.

What will the ?getdate() function returns in PHP?

A. An integer
B. A floating-point number
C. An array
D. A string
Answer» C. An array
90.

What is full form of PHP?

A. PreHypertextProcessor
B. HypertextPreprocessor
C. Hypertext Postprocessor
D. PostHypertextProcessor
Answer» B. HypertextPreprocessor
91.

The left association operator % is used in PHP for __________.

A. percentage
B. bitwise or
C. division
D. modulus
Answer» D. modulus
92.

Which one is right in PHP?

A. <?php var_name = $value;?>
B. <?php $var_name = $value; ?>
C. <?php $var_name = value;?>
D. <?php var_name = value;?>
Answer» B. <?php $var_name = $value; ?>
93.

SQL is not case sensitive. DELETE is the same as delete.

A. TRUE
B. FALSE
Answer» A. TRUE
94.

Which of the following is not true regarding XForms?

A. PHP provides support for XForm
B. It can be used on PDF documents
C. The data is sent in XML format
D. The action and method parameters are defined in the body
Answer» D. The action and method parameters are defined in the body
95.

You have defined three variables $to, $subject and $body to send an email. Which of the following methods would you use for sending an email?

A. mail($to,$subject,$body)
B. sendmail($to,$subject,$body)
C. mail(to,subject,body)
D. sendmail(to,subject,body)
Answer» A. mail($to,$subject,$body)
96.

Which of the following are useful for method overloading?

A. __call, __get, __set
B. _get,_set,_load
C. __get,__set,__load
D. __overload
Answer» A. __call, __get, __set
97.

Which of the following is a PHP resource?

A. Domxml document
B. Odbc link
C. File
D. All of the above
Answer» D. All of the above
98.

Does PHP 5 support exceptions?

A. Yes
B. No
Answer» A. Yes

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.