latest Post

Upwork/oDesk LAMP Test Answers



1. Which of the following are correct regarding Linux devices?

 Answers: • The character devices work with data streams or • The sockets are special-purpose I/O files offering a type of network interface or • A named pipe is like a character device, but there is another process at the other end of the I/O stream instead of a kernel driver

 2. Which of the following are correct regarding the .htaccess file in an Apache server?
 Answers: • Any text editor can be used to create or make the changes to the .htaccess files or • An .htaccess file is simply a text file containing Apache directives or • Directives residing in the .htaccess file apply to the documents in the directory where the .htaccess file is located

 3. Which of the following are correct with regard to indexes in MySql?
 Answers: • With clustered indexes, the primary key and the record itself are "clustered" together or • With separate indexes on first_name and last_name, MySQL can eliminate rows based on both fields or • Indexes are not always used to locate matching rows for a query

 4. Which of the following statements are incorrect regarding referential integrity?
 Answers: • A foreign key can refer to a primary key or • The on delete cascade clause will work only if there is a reference to a primary key or • The referred key can either be in the same table or in some other table

 5. Mike Johnson is running Apache on an extremely busy server where hundreds of requests per second is a requirement. He might have to change the default hard limits set in the MPM module. Which of the following hard limits should he change?
 Answers: • HARD_SERVER_LIMIT or • HARD_THREAD_LIMIT

 6. Which of the following MySQL field names are correct?
 Answers: • EmpNo or • _CustomerName

 7. The include directive inserts the text of a document into the SSI document being processed. Which of the following statements has the correct syntax for the include directive?
 Answers: • include file="path" or • include virtual="URL"

 8. Refer to the small php script given below:

 <?php
 class person{
 function getSal()
 {
 . . .
 . . .
 }
 }
 class emp extends person{
 function getSal()
 {
 ???
 }
 }
 ?>
 The getSal() of emp has to behave exactly as getSal() of person. Which of the following lines of code would you use to replace the '???'
 Answers: • parent::getSal(); or • person::getSal();

 9. Which of the following statements are correct with respect to the get_browser function of PHP?
 Answers: • It is used to extract the client's browser information or • It requires the browscap.ini to be placed on the server

 10. Which of the following are the valid operations that MySQL performs simultaneously when a table is dropped?
 Answers: • It removes all the rows from the table or • It drops all the table's indexes

 11. Sometimes it is necessary to create a temporary file to collect output for use by a later command. While creating such a file, you must make sure that the filename is unique enough so that no other programs accidentally write on the temporary file. Which of the following are correct with regard to creation of temporary files?
 Answers: • mktemp command can be used to create temporary filenames or • The $$ special variable can be used to construct a temporary filename based on the process ID

 12. The architecture of MySql sets it apart from nearly every other database server. Which of the following are correct about different layers of MySql?
 Answers: • The topmost layer is composed of the services that are not unique to MySQL or • The third layer is made up of storage engines

 13. Which of the following statements are correct with respect to PHP connections?
 Answers: • mysql_pconnect keeps the connection open across multiple requests or • mysql_connect opens up a database connection for each page load

 14. Which of the following can be used to implement data validation while creating a table in MySql?
 Answers: • Checking constraint with specified values or • Null constraint

 15. You have just installed a Linux system. You have upgraded the kernel and packages to the latest versions and you have turned off all unnecessary services and daemons. What else should you do to enhance security on the system?
 Answers: • Change the root password

 16. During heavy INSERT, UPDATE, and DELETE activity, indexes slow down the performance. Which of the following setting controls this behavior?
 Answers: • None of the above

 17. Which of the following ways of creation of a virtual web site is not supported by Apache?
 Answers: • Multiple main servers

 18. Which of the following is correct with regard to the statements given below?

 Statement 1: If the internal network uses nonroutable IP addresses for either security or cost reasons, you can use a proxy server to provide Internet resources to hosts that normally cannot access the Internet.
 Statement 2: Using a caching proxy such as Apache (with mod_perl), you can provide seemingly faster access to Internet resources to the local users.
 Answers: • Statement 1 is true but statement 2 is false

 19. Which of the following is the standard authentication module, which implements Basic HTTP authentication?
 Answers: • mod_auth_digest

 20. What do you infer from the following code?

 <?php
 $str = 'Dear Customer,\nThanks for your query. We will reply very soon.?\n Regards.\n Customer Service Agent';
 print $str;
 ?>
 Answers: • All will be printed on one line irrespective of the "\n" characters

 21. You have a table phone_book with 2 billion rows in it. Adding an index on last_name will require a lot of space. If the average last_name is 8 bytes long, you are looking at roughly 16 GB of space for the data portion of the index. Which of the following will help in reducing the size of index space?
 Answers: • Indexing only the first 4 bytes

 22. Which of the following helps to keep an eye on the existing number of objects of a given class without introducing a non-class member variable?
 Answers: • Addition of a static member variable that gets incremented in each constructor and decremented in the destructor

 23. Which of the following is the correct way to check whether the cookie is set or not before retrieving the value from "LoginCookie"?
 Answers: • isset($_COOKIE['LoginCookie'])

 24. How would you convert the date set in the following format into a PHP timestamp?

 $date = "Monday, July 28, 2008 @ 12:15 am";
 Answers: • $date = str_replace("@ ","",$date); $date = strtotime($date);

 25. Refer to the code given below and select the while condition from the following options:

 $db = mysql_connect("localhost","root");
 mysql_select_db("mydb",$db);
 $result = mysql_query("select state_id, state_text from states");

 if ($result)
 {
 echo "<SELECT NAME='state_id'>";
 while (...condition...)
 {
 echo "<OPTION VALUE=\"".$myrow["state_id"]."\">".
 $myrow["state_text"]." </OPTION> ";
 }
 echo "</SELECT>";
 }
 Answers: • $myrow = mysql_fetch_array($result)

 26. The Manager and Office classes are as follows:

 <?php
 class Manager{
 function printName() {
 echo "Manager";
 }
 }
 class Office{
 function getManager() {
 return new Manager();
 }
 }

 $ofc = new Office();
 ???

 ?>
 Which of the following should replace '???' to obtain the value of printName() function?
 Answers: • $ofc->getManager()->printName();

 27. Which of the following is correct with regard to the statements given below?

 Statement 1: When you set up Apache on an Internet host it can respond to an HTTP request for that host.
 Statement 2: Apache does not allow virtual hosts to inherit configuration from the main server, which makes the virtual host configuration quite manageable in large installations.
 Answers: • Both the statements are false

 28. rpm -Uvh filename- 1.2-2.i386.rpm can be used to install an RPM package. What functions does it perform?
 Answers: • It upgrades with additional information and hash marks

 29. You want to see the block and character devices for which your system currently has drivers. Which of the following commands should you use in this scenario?
 Answers: • cat /proc/devices

 30. 'Perfect Services' provides financial services worldwide. You want to display data from the table pers for joining_date from #1/1/2005# to #31/12/2005# and the job should either be of an analyst, a clerk or a salesman. Which of the following is correct?
 Answers: • None of the above

 31. Based on the code given below, what will be the value of $num if mytable contains 12 records?

 $result=mysql_query("DELETE from mytable");
 $num=mysql_affected_rows();
 Answers: • 12

 32. Refer to the following declarations of the php variables:

 $company = 'ABS Ltd';
 $$company = ', Sydney';
 ?>
 Which of the following is not a correct way of printing 'ABS Ltd , Sydney'?
 Answers: • echo "$company ${$company}";

 33. When Apache receives a URL request, it processes the request by serving the file to the client (the Web browser). It provides you with a flexible mechanism for rewriting the requested URL to a new one using custom URL rewrite rules. Which of the following is an incorrect server variable for URL Rewrite rules?
 Answers: • REMOTE_FORWARD

 34. What will be the output of the following code?

 $Rent = 250;
 function Expenses($Other)
 {
 $Rent = 250 + $Other;
 return $Rent;
 }
 Expenses(50);
 echo $Rent;
 Answers: • 250

 35. Whenever you create a table, MySQL stores the table definition in a file with the same name as the table. Which of the following is the extension of the table definition file?
 Answers: • .frm

 36. To start the MySql server in Linux, you type the following from the command line:

 bin/safe_mysqld &

 What does the '&' mean in the command mentioned above?
 Answers: • It forces Mysql to run in the background

 37. Which of the following statements are true with regard to comparisons in PHP5?
 Answers: • With the (===) operator, object variables are identical if and only if they refer to the same instance of the same class

 38. Which of the following queries will correctly retrieve the ages and addresses of those students who have been studying in the school for the last 2 years?
 Answers: • $SQL_QUERY="select age,address from student where regdate ="; $SQL_QUERY .= "DATE_SUB(CURRENT_DATE,Interval 2 YEAR)";

 39. Check the structure of the following tables:

 Employee
 ---------
 Empno
 Employeename
 Salary
 Deptno

 Department
 ---------
 Deptno
 Departname

 Mike wants to see the departments that have more than 100 employees. Which of the following queries returns the required result?
 Answers: • Select departname from department where deptno in (select deptno from employee group by deptno having count(*) > 100);

 40. Refer to the statements given below and identify which of the following is correct.

 Statement 1: Without any indexes, the database uses a lot of disk I/O and can effectively pollute the disk cache.
 Statement 2: Some extra disk space and a bit of CPU overhead is sacrificed on each INSERT, UPDATE, and DELETE query while using indexes.
 Answers: • Both the statements are true

 41. Which of the following subdirectory of the root directory provides system statistics through a directory-and-file interface which you can browse with standard Unix tools?
 Answers: • None of the above

 42. State whether true or false:

 By allowing the use of .htaccess files in user (or customer or client) directories, you are essentially extending a bit of your Webmaster privileges to anyone who can edit those files.
 Answers: • True

 43. Which of the following statements are true?

 Statement 1: mysql_fetch_object - Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows
 Statement 2: mysql_fetch_row- Returns a positive MySQL result resource to the query result, or FALSE on error.
 Answers: • Only Statement 1 is true

 44. Based on the code given below, what will be the value of, $num, if mytable contains 20 records out of which 10 have myprice=19, 5 have myprice=20 and 5 have myprice=2, before running the mysql_query?

 $resultSet=mysql_query("UPDATE mytable set myprice = 20 where myprice < 20");
 $num=mysql_affected_rows();
 Answers: • 15

 45. You want to enable SSI for a directory called '/www/mysite/htdocs/parsed'. Which of the following is the correct configuration to be added in httpd.conf?
 Answers: • <Directory "/www/mysite/htdocs/parsed"> Options +Includes SetOutputFilter INCLUDES </Directory>

 46. Which of the following is introduced in PHP5?
 Answers: • __construct and __destruct

 47. 'Web Logic', a web hosting company, has two system administrators, and one of them has just been terminated from his position. What is the first thing that the current administrator should do to enhance security?
 Answers: • Change the root password

 48. A user is trying to set a new password for his account. He wants to use the name of the company "MNC" as his password. Why would the system not allow this password?
 Answers: • The minimum length of a password should be at least six characters

 49. The Apache source distribution comes with a script called configure that allows you to configure the source tree before you compile and install the binaries. Which of the following is an incorrect option for the configure script?
 Answers: • --help-file

 50. Which sequence will run successfully for the code given below?

 <?php
 function Expenses()
 {
 function Salary()
 {

 }
 function Loan()
 {
 function Balance()
 { }
 }

 }
 ?>
 Answers: • Expenses();Salary();Loan();Balance();

 51. Which of the following is correct for specifying the default value?
 Answers: • function GetDiscount($Type = "Special") { . . . }

 52. What will be the output of the following code?

 $var1="a";
 $$var1="b";
 echo "$var1 $a";
 Answers: • a b

 53. Which of the following commands will you use if you need to strip the extension off of a filename or get rid of the directories in a full pathname?
 Answers: • basename

 54. One of your PHP pages is very heavy and loading it takes about two minutes. But before it loads, a browser timeout occurs. Which of the following will help solve this problem?
 Answers: • set_time_limit(150);

 55. Food Cart Accounting System (FOCAS) is maintaining products in the products table, and wants to see the products which are 50 or more than 50 short of the minimum stock limit. The structure of the Products table is:
 ProductID
 ProductName
 CurrentStock
 MinimumStock

 Two possible queries are:

 Query 1:select * from products where currentStock>MinimumStock+50
 Query 2:select * from products where currentStock-50>MinimumStock

 Which of the following is correct?
 Answers: • Both the queries are false

 56. Indexes are known to speed up the search but they have some limitations also. Which of the following queries take much time despite having indexes on table?
 Answers: • select * from pages where page_text like "%buffy%"

 57. Read the following code snippet:

 1. for filename in *; do
 2. if [ -f $filename ]; then
 3. ls -l $filename
 4. file $filename
 5. else
 6. echo $filename is not a regular file.
 7. fi
 8. done

 What does '-f' in line 2 mean?
 Answers: • None of the above

 58. What is the function of the 'swapon' command while installing Linux in the command line interface mode?
 Answers: • It activates a created swap partition

 59. What is the condition indicated if only the LI appears while attempting to boot a Linux system with LILO?
 Answers: • Secondary boot loader has been loaded

 60. What will happen if the following code is executed?

 $resultSet = mysql_query("SELECT fname, lname FROM customers")
 for ($nIndex = 0; $nIndex < mysql_num_rows($resultSet) ; $nIndex++)
 {
 if (!mysql_data_seek($resultSet, $nIndex))
 {
 echo "Cannot seek to row $nIndex\n";
 continue;
 }

 if(!($row = mysql_fetch_object($resultSet)))
 continue;

 echo "$row->fname $row->lname<br />\n";
 }
 Answers: • The fnames and lnames of all the customers will be printed

 61. Which of the following are correct with regard to the sbin subdirectory of the root directory in Linux?
 Answers: • All of the above

 62. You are facing a low key buffer problem. You want to increase the size of the key buffer from what it was set to at the startup. Which of the following is the correct syntax to perform this?
 Answers: • mysql> SET key_buffer=50M;

 63. Which of the following is correct with regard to the statements given below?

 Statement 1: The current implementation of the optional proxy module does not support reverse proxy or the latest HTTP 1.1 protocol.
 Statement 2: Apache can be turned into a caching (forward) proxy server.
 Answers: • Both the statements are true

 64. You have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use to send an email?
 Answers: • mail($to,$subject,$body)

 65. You have to upload a file named "SalesFile" using the form post method mentioned below. What should be the code in line 3 to accomplish the same?

 1 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
 2 Send this file:
 3
 4 <input type="submit" value="Send File" />
 Answers: • <input name="SalesFile" type="file" />

 66. Where would you install LILO to allow a dual bootable system on a 'system' which already has Microsoft Windows NT 4.0 with an installed NTFS partition?
 Answers: • Master Boot Region

 67. Which permission setting allows a user to run an executable with the permission of the owner of that file?
 Answers: • SUID

 68. Which of the following lines of the class mentioned below should be commented to execute the code without errors?

 1 class Insurance
 2 {
 3 function clsName()
 4 {
 5 echo get_class($this);
 6 }
 7 }

 8 $cl = new Insurance();
 9 $cl->clsName();
 10 Insurance::clsName();
 Answers: • All the three lines 8,9, and 10 should be left as it is

 69. Consider the following sample code:

 $x = 0xFFFE;
 $y = 2;
 $z = $x && $y;
 What will be the value of $z?
 Answers: • 1

 70. You are building Apache from the source distribution. Which of the following is a mandatory requirement for Apache installation?
 Answers: • ANSI C Compiler

 71. Refer to the classes that are defined as follows:

 abstract class BaseCls{
 protected abstract function getName();
 }

 class ChildCls extends BaseCls{

 }
 Which of the following implementations of getName() is invalid in ChildCls?
 Answers: • private function getName(){}

 72. You want to open a file in the PHP application and you also want this application to issue a warning and continue execution, in case the file is not found. Which of the following idea functions would you use in this scenario?
 Answers: • include()

 73. You need to allow only selected users from the users file into a particular area and you do not want to keep the username information in your .htaccess files. Which of the following is a correct statement to allow a group of users?
 Answers: • require group <group name>

 74. You have an HTML file called mypage.html and you want to store meta headers of this html page. Which of the following directives specifies the filename extension for metainformation files?
 Answers: • MetaFileType

 75. John Mark, an administrator, wants to set the Web server so that it will not show a directory listing if a user requests a page which is a directory. Which modification should he set up in the httpd.conf?
 Answers: • Remove indexes from configuration file

 76. Which of the following special variables of a shell script holds the number of arguments passed onto the script?
 Answers: • $#

 77. When a Unix program finishes, it leaves an exit code for the parent process that started the program. The exit code is a number. Which of the following numbers is returned if the program ran without problems?
 Answers: • 0

 78. Which of the following is correct regarding the statements given below?

 Statement 1: Before the server can send the page to the browser it must send the http headers.
 Statement 2: session_start() is used to send some headers.
 Answers: • Statement 1 is true but statement 2 is false

 79. Which program automatically determines the number of blocks in a device and sets some reasonable defaults?
 Answers: • None of the above

 80. Which of the following statements is incorrect with regard to PHP interfaces?
 Answers: • Methods with the same name, arguments and sequence can exist in the different interfaces implemented by a class

 81. A construction company is working on three projects: mall construction, residential construction and building business towers. A civil engineer can work only on one type of construction project but more than one civil engineer can work on one project whereas a sales person can handle any type of projects and any number of sales people can work on one project. Define the nature of the relationship between (civil engineer and projects) and (sales person and projects)?
 Answers: • one to one, one to many

 82. A production house has two sale outlets. Both the outlets are maintaining their data separately in servers A and B. The MD wants to see the sale of both the outlets in one report. Both the outlets use the same structure of the Sales table. Which of the following methods will you adopt to create this report?
 Answers: • None of the above

 83. Refer to the following statement:

 Select CustomerName, AccountNumber from Customers where AccountNumber in(select AccountNumber from Transactions where TransactionDate=#12/12/2005#)

 Which of the following is correct?
 Answers: • None of the above

About sandesh saini

sandesh saini
Recommended Posts × +

0 comments:

Post a Comment