90+ Linux and PHP Solved MCQs

1.

/temp is a type of filesystem directory

A. True
B. False
Answer» B. False
2.

Which of the following commands delete the files from the /tmp directory, issued by non-root user?

A. rmdir -rf /tmp/*
B. rm -rf /tmp/* -su
C. su -c “rm -rf /tmp/*”
D. su “rm -rf /tmp/*”
Answer» C. su -c “rm -rf /tmp/*”
3.

Echo is used to Display message on screen. Which of the following options below should be used with echo to not output the trailing newline?

A. /e
B. /n
C. -n
D. both b and c
Answer» C. -n
4.

The basic function of ______________ is to search files for lines (or other units of text) that contain a pattern.

A. awk
B. search
C. %awk
D. cat
Answer» A. awk
5.

What is the content of /etc directory?

A. Configuration files for your system.
B. Contains the system startup scripts
C. Both a and b
D. User specific settings for programs like IRC, X etc.
Answer» C. Both a and b
6.

What is the difference between linux file system and windows file system?

A. Under Linux, the various partitions are detected at boot and assigned a drive letter whereas Under windows, unless you mount a partition or a device, the system does not know of the existence of that partition or device.
B. Under Windows, the various partitions are detected at boot and assigned a drive letter whereas Under Linux, unless you mount a partition or a device, the system does not know of the existence of that partition or device.
C. Under Windows, the various partitions are detected at reboot and assigned a drive letter whereas Under Linux, unless you mount a partition or a device, the system does not know of the existence of that partition or device.
D. Under Windows, the various partitions are detected at reboot and assigned a drive letter whereas Under Linux, you mount a partition or a device.
Answer» B. Under Windows, the various partitions are detected at boot and assigned a drive letter whereas Under Linux, unless you mount a partition or a device, the system does not know of the existence of that partition or device.
7.

Which of the following below is/are true for Date command?

A. It can work w/o arguments
B. It always needs an argument
C. It always need to have a+ as an argument
D. None of the above
Answer» A. It can work w/o arguments
8.

What is the default number of shell commands saved in the history list of .cshrc file?

A. 200
B. 100
C. 150
D. 175
Answer» A. 200
9.

mount -r is used to mount a file in read only mode

A. True
B. False
Answer» A. True
10.

The advantage of using NFS rather than Samba for file sharing in Linux is

A. files saved as .tar extension
B. compressed files
C. compatibility with Windows file sharing
D. None of the above
Answer» C. compatibility with Windows file sharing
11.

Which of the following supports for creating a Linux VPN (Virtual Private Network)?

A. RC2
B. 3DES
C. chap
D. NTLMv2
Answer» B. 3DES
12.

Find command can search for files by

A. date
B. size
C. name
D. all of above
Answer» D. all of above
13.

How can we find the current value for shell variables?

A. Set command
B. Display command
C. val command
D. Currval command
Answer» A. Set command
14.

CWD is a type of shell variable

A. True
B. False
Answer» A. True
15.

Which framework is provided for the programs to interchange information about Linux OS?

A. Resource Sharing Framework
B. Resource Security Framework
C. Information Sharing Framework
D. Resource Definition Framework
Answer» D. Resource Definition Framework
16.

What is the difference between PATH and path?

A. PATH and path specify directories to search for commands and programs
B. Both variables always represent the same directory list
C. altering either automatically causes the other to be changed
D. All choices are correct.
Answer» D. All choices are correct.
17.

How much usable space is available, when a Linux system is configured with a RAID 5 array that consists of six 20 GB hard disk drives?

A. 80
B. 100
C. 120
D. 60
Answer» C. 120
18.

Which of the following below are environmental variables?

A. USER
B. HOME
C. both a and b
D. VARHOST
Answer» C. both a and b
19.

Applications written to provide a GUI shell for Unix and Linux are called

A. DOS
B. x windows
C. OS/2
D. Vista
Answer» B. x windows
20.

Which of the following commands can be used to check for file corruption?

A. md5sum
B. checkfile
C. cat -vet
D. tar –checksum
Answer» A. md5sum
21.

Starting or restarting a computer is called

A. booting the system
B. firing the system
C. tasking the system
D. restoring the system
Answer» A. booting the system
22.

This type of boot occurs when the computer is already on, and you restart it without turning off the power.

A. generic boot
B. live boot
C. warm boot
D. cold boot
Answer» C. warm boot
23.

The ‘logout’ built in command is used to

A. shutdown the computer
B. logoff of the computer
C. logout the current user
D. to exit the current shell
Answer» D. to exit the current shell
24.

The command ‘umask -S’

A. prints the current mask using symbolic notation
B. prints the current mask using octal numbers
C. sets the mask to 000
D. sets the mask to 777
Answer» A. prints the current mask using symbolic notation
25.

Which command puts a script to sleep untill a signal is recieved?

A. sleep
B. suspend
C. disown
D. break
Answer» B. suspend
26.

Which of the following below are true functionalities of shell?

A. Authenticates user
B. Interprets commands
C. Allocates time and memory to programs
D. Only a and b
Answer» B. Interprets commands
27.

A process can run only in the background

A. True
B. False
Answer» B. False
28.

Which of the following below are true functionalities of Kernel?

A. Allocates time and memory to programs
B. Authenticates user
C. Interprets commands
D. All choices are correct
Answer» A. Allocates time and memory to programs
29.

To implement new application on IBM z/10. Which of the following options need to be considered if it to be implemented in Linux?

A. IBMz/OS outperforms Red Hat Linux in commercial workloads
B. IBMz/OS is more expensive, Linux is shareware
C. Red Hat Linux does not support all devices supported by IBMz/OS
D. z/OS is supported by IBM SupportLine, whereas Red Hat Linux can only be supported by Red Hat
Answer» C. Red Hat Linux does not support all devices supported by IBMz/OS
30.

A process is identified by a unique

A. Pid
B. Id
C. processed
D. proid
Answer» A. Pid
31.

Which command reduces the size of a file?

A. pzip
B. gcat
C. pgcat
D. gzip
Answer» D. gzip
32.

Which of the following has greater market share of Linux SW/HW

A. Linux on z10
B. Linux HP integrity server
C. Linux on AS/400 servers locate
D. Linux on DELL Xeon
Answer» A. Linux on z10
33.

Which of the following is the BEST way to set up SSH(Secure Shell) for communicating between System without needing passwords?

A. Use ssh-keygen for generating public-private keys.
B. Disable passwords on specific accounts that will use SSH.
C. Both A and B
D. None of the above
Answer» A. Use ssh-keygen for generating public-private keys.
34.

Which of the following commands can be run to remove all the rules in an iptable table?

A. iptable-L
B. iptable-A
C. iptable-F
D. iptable-delete
Answer» C. iptable-F
35.

Which command is used to see the online manual?

A. Man
B. manual
C. *man
D. %man
Answer» A. Man
36.

The head command writes the first ____________ lines of a file to screen.

A. Five
B. Twenty
C. Ten
D. Fifteen
Answer» C. Ten
37.

Which command is used to clear the screen?

A. % clear
B. clear
C. clrscr
D. either a or c
Answer» B. clear
38.

Which command is used to find what is in your home directory?

A. % List
B. % Is
C. % home
D. Either a or c
Answer» B. % Is
39.

Pipe symbol is represented by

A. ||
B. |
C. ^
D. $
Answer» B. |
40.

What is the shortcut to the login directory?

A. shift+cd
B. cd+enter key
C. alt+ctrl+cd
D. ctrl+cd
Answer» B. cd+enter key
41.

What is used to search files for specified words or patterns?

A. Less
B. Srch
C. %src
D. Grep
Answer» D. Grep
42.

cd home to get back to your home-directory?

A. True
B. False
Answer» B. False
43.

> symbol is used to redirect the output of a command

A. True
B. False
Answer» A. True
44.

Which character is used to match exactly one character?

A. |
B. *
C. ^
D. ?
Answer» D. ?
45.

The hierarchy of a series of directories branching in a user system starts from

A. home
B. root
C. /home
D. /root
Answer» C. /home
46.

What PHP stands for?

A. Hypertext Preprocessor
B. Pre Hypertext Processor
C. Pre Hyper Processor
D. Pre Hypertext Process
Answer» D. Pre Hypertext Process
47.

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

A. It converts them to a 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 bases its comparison on the C strcmp function exclusively
Answer» A. It converts them to a common compatible data type and then compares the resulting values
48.

Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?

A. When the parameter is Boolean
B. When the function is being declared as a member of a class
C. When the parameter is being declared as passed by reference
D. When the function contains only one parameter
Answer» C. When the parameter is being declared as passed by reference
49.

Variables always start with a ........ in PHP

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

What is the value displayed when the following is executed? Assume that the code was executed using the following URL:
testscript.php?c=25
<?php
function process($c, $d = 25)
{
global $e;
$retval = $c + $d - $_GET['c'] - $e;
return $retval;
}
$e = 10;
echo process(5);
?>

A. 25
B. -5
C. 10
D. 5
Answer» B. -5
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
Tags
Question and answers in Linux and PHP, Linux and PHP multiple choice questions and answers, Linux and PHP Important MCQs, Solved MCQs for Linux and PHP, Linux and PHP MCQs with answers PDF download