0% found this document useful (0 votes)
274 views9 pages

PHP Mysql

This document contains a 50 question multiple choice test on PHP and MySQL. It covers topics like PHP functions, syntax, includes, file handling, MySQL commands, joins, and more. It also lists 5 programming tasks involving multi-dimensional arrays, login with sessions, CRUD in a form, displaying database data in a table, and file handling with an example. The test is worth 100 total marks and is divided into 2 parts - multiple choice worth 50 marks and programming tasks worth 50 marks.

Uploaded by

albashayr
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
0% found this document useful (0 votes)
274 views9 pages

PHP Mysql

This document contains a 50 question multiple choice test on PHP and MySQL. It covers topics like PHP functions, syntax, includes, file handling, MySQL commands, joins, and more. It also lists 5 programming tasks involving multi-dimensional arrays, login with sessions, CRUD in a form, displaying database data in a table, and file handling with an example. The test is worth 100 total marks and is divided into 2 parts - multiple choice worth 50 marks and programming tasks worth 50 marks.

Uploaded by

albashayr
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 9

Interview Orientation Process PHP/MYSQL Total Marks : 100 Part-A Total Time :3 hrs 50*1=50

1) In PHP, arrays may be sorted with which of the following functions? a. uksort() b. arsort() c. ksort() d. All of the above 2) PHP comments for a single line have the following syntax: a. /* comments /* b. # c. // d. :: e. A&B 3) Which of the following functions are used by PHP to find out what type a variable is? a. gettype() b. is_double() c. get_type() d. is_date() e. A&B 4) The three possible connection states in PHP are ________. a. normal b. aborted c. timeout d. All of the above 5) In PHP, the error control operator is ________. a. * b. % c. @ d. & 6) MySQL runs on which operating systems? a. Linux and Mac OS-X only b. Any operating system at all c. Unix, Linux, Windows and others d. Unix and Linux only

7) To remove duplicate rows from the result set of a SELECT use the following keyword: a. NO DUPLICATE b. UNIQUE c. DISTINCT d. None of the above

8) Which of the following can add a row to a table? a. Add b. Insert c. Update d. Alter 9) To use MySQL on your computer, you'll need? a. FTP and Telnet b. Some sort of client program to access the databases c. A Browser d. Perl, PHP or Java 10) a. b. c. d. Which SQL statement is used to insert a new data in a database? INSERT INTO UPDATE ADD INSERT NEW

11) How do you write "Hello World" in PHP

a. echo "Hello World"; b. Document.Write("Hello World"); c. "Hello World"; 12) All variables in PHP start with which symbol? a. & b $ c. !

13) What is the correct way to end a PHP statement? a. New line b. </php> c. ;

14) The PHP syntax is most similar to: a. Perl and C b. JavaScript c. VBScript 15) How do you get information from a form that is submitted using the "get" method? a. Request.Form; b. $_GET[]; c. Request.QueryString; 16) When using the POST method, variables are displayed in the URL: a. False b. True 17) In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings: a. False b. True 18) Include files must have the file extension ".inc" a. False b. True 19) What is the correct way to include the file "time.inc" ? a. <?php require("time.inc"); ?> b. <% include file="time.inc" %> c. <?php include_file("time.inc"); ?> d. <!--include file="time.inc"--> 20) What is the correct way to create a function in PHP? a. function myFunction() b. new_function myFunction()

c. create myFunction()

21) What is the correct way to open the file "time.txt" as readable? a. fopen("time.txt","r"); b. open("time.txt"); c. open("time.txt","read"); d. fopen("time.txt","r+");

22) PHP allows you to send emails directly from a script a. True b. False 23) What is the correct way to connect to a MySQL database? a. dbopen("localhost"); b. mysql_connect("localhost"); c. mysql_open("localhost"); d. connect_mysql("localhost");

24) What is the correct way to add 1 to the $count variable? a. count++; b. $count =+1 c. $count++;

d. ++count 25) MySQL supports the complete SQL99 standard a) false b) true 26) Primary Key does allow the Null Values. where as in Unique key doesn't accept the Null values. Question: True or False ? a) False b) True 27) How much character are allowed to create database name? a) 55 b) 72 c) 64 d) 40 28) Which of the following commands should be used to create a database named student? a) CREATE ?I student b) CREATE DATABASE student c) DATABASE /student d) DATABSE student 29) Which one will delete the table data as well as table structure? a) TRUNCATE b) DROP

30) The USE command? a) Is used to load code from another file b) Has been deprecated and should be avoided for security reasons c) Is a pseudonym for the SELECT command d) Should be used to choose the database you want to use once you've connected to MySQL 31) Given an employees table as follows: emp_id emp_name

1 Brush 2 Jerrin what value will be return by below query ? Select count(*) from employees a) 3 b) 2 c) 1 d) none of the above 32) The main MySQL program that does all the data handling is called? a) mysql.exe b) mysql c) mysqld d) httpd 33) A SELECT command without a WHERE clause returns? a) All the records from a table that match the previous WHERE clause b) All the records from a table, or information about all the records c) SELECT is invalid without a WHERE clause d) Nothing

34) MySQL Access security is controlled through? a) The ID that the user logged into the server through, and priveliges set up for that account. b) MySQL login accounts, and priveliges set for each account c) The normal login security is sufficient for MySQL, and it does not have any extra controls of its own. d) A table of valid IP addresses, and priveliges set up for each IP address

35) In a SELECT with a GROUP BY clause, a WHERE clause, and a HAVING clause, the WHERE conditions are applied before the HAVING conditions. a) True b) Fasle c) Either True or False

d) None of the above 36) A constructor is a special kind of a) Class b) Method c) Object d) Variable 37) What can you use to replace like with hate in I like Eminem? a) preg_replace("like", "hate", "I like Eminem") b) preg_replace("/like/", "hate", "I like Eminem") c) preg_replace("/like/", "/hate/", "I like Eminem") d) preg_replace("hate", "like", "I like Eminem") 38) What library do you need in order to process images? a) c-client library b) GIF/PNG library c) Image Library d) GD library 39) What is the problem with <?=$expression ?> ? a) It requires short tags and this is not compatible with XML b) There is no problem c) This syntax doesn't even exist It requires a special PHP library that may not always be available

40) What does break; do? a) Ends execution of the current switch structure b) Moves on to the next iteration of the current for, foreach, while, do-while or switch structure c) Ends execution of the current for, foreach, while, do-while or switch structure 41) Can this PHP code be valid: $4bears = $bears->getFirst4();

a) Yes b) No 42) Assuming all the variables a, b, c have already been defined, could this be a variable name: ${$a}[$b][$c] ? a) Yes b) No 43) Put this line php display_errors=false in a .htaccess file when you deploy the application? a) That won't hide any error 'coz you can't use .htaccess to control the PHP engine Bad idea, I want to see when errors occur b) That won't hide any error 'coz it's not the correct code c) Good idea, increases security 44) What does this function do: <?php function my_func($variable) {return (is_numeric($variable) && $variable % 2 == 0);}?> a) tests whether $variable is a number and ends in 2 b) tests whether $variable ends in 2 c) tests whether $variable is a number and contains 2 d) tests whether $variable is an even number 45) A NULL value is treated as a blank or 0. a) True b) False 46) A table may be joined to itself. a) True b) False

47) What SQL clause is used to restrict the rows returned by a query? a)WHEN b)HAVING c)FROM d)WHERE 48) The only way to join two tables is by using standard, ANSI syntax.

a) True b) False 49) A primary key may contain NULLS. a) True b)False 50) Given an employees table as follows: empid name managerid a1 bob NULL b1 jim a1 B2 tom a1 What value will select count(managerid) from employees return? a) 1 b) 2 c) 3 d) non of the above

Part-B

10*5=50

1. Write a sample program implementing foreach for a multi-dimensional array. 2. Write a login script ,Implementing session. 3.Design a sample page which has insertion, deletion and updation process in a single form action. 4.Write a program that retrives the data from the database and display it in a table format. 5.Explain the file handling concept with example.

You might also like