100% found this document useful (2 votes)
1K views

Internet Programming II Model Exam

The document contains a 30 question multiple choice exam on topics related to Internet Programming II such as HTML, CSS, PHP, and MySQL. The questions cover syntax, functions, variables, arrays, files, and other programming concepts.

Uploaded by

davegerim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
1K views

Internet Programming II Model Exam

The document contains a 30 question multiple choice exam on topics related to Internet Programming II such as HTML, CSS, PHP, and MySQL. The questions cover syntax, functions, variables, arrays, files, and other programming concepts.

Uploaded by

davegerim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Model Exam Question for Exit Exam

Course Title: Internet Programming II

Instruction: Choose the correct answer from the given alternatives.

1. Based on the html code given below identify the correct statement.

Given Code: <h1 style=”color:red;”>Hello Everyone</h1>

A. </h1> is an end tag and has no problem if we forget it


B. “Hello Everyone” is an element that will be displayed on the browser in red color
C. “style” is a CSS property
D. style=“color:red;”> is an internal CSS
2. Which one of the following statements is the correct way of defining a CSS style using a class
selector?
A. p,h1,h2,li { text-align: center; color: red; }
B. p { background: yellow; color: red; }
C. #par{ background: yellow; color: red; }
D. .par { background: yellow; color: red; }
3. Which one of the HTML5 attributes makes a text box inactive to edit?
A. required B. pattern C. read-only D. disable
4. A program written in _________ language does not require a server to run.

A. PHP B. Servlet C. JSP D. HTML

5. Which one of the following statements is wrong about a web page?


A. The content of a static web page can only change if the source code is changed.
B. The content of a dynamic page may change in response to users’ actions.
C. An application that collects data from users through a form and stores it in a database
requires the integration of client & server-side scripts
D. Source code of a program written in a server-side scripting language is visible on a client
application such as a browser
6. Which of the following is the default file extension of PHP?
A. .php B. .hphp C. .xml D. .html
7. Which one of the following is used to display an output in PHP?
A. document.write() B. out.print() C. print() D. write()
8. A variable declared _____ has a GLOBAL SCOPE?
A. outside program
B. inside function
C. outside function
D. None Of the Above
9. which one of the following is the result of the following PHP code?
Given Code: echo strlen(“IP II Model-Exam !”);
A. 20 B. 18 C. 16 D. 15
10. Which one of the following is the correct way of creating a PHP variable?
A. int stud_age=20; B. $stud-age=20; C. stud_age=20; D. $_age=20;
11. Which one of the following is the output of the given program?
A. 0134 <?php
B. Nov $months=array("Sept","Oct","Nov","Dec","Jan");
C. 2 foreach($months as $k=>$m) {
D. SeptOctDecJan if($k!=2) continue;
else echo $m;
} ?>

12. Which one of the following PHP functions is used to redirect a user to a specific page?
A. Send_redirect() B. header_location() C. header() D. redirect()
13. which one of the following statements is wrong about a session?
A. It is used to make data accessible across all pages of a website
B. echo $_SESSION[“email”]; is used to display the value of a session variable called email.
C. session_start() function is used to start a session and must be there at the beginning of an
index.php page of the website
D. session_unset() function destroys all session variables
14. which one of the following syntaxes is the correct way of defining a function in PHP?
A. functionName(parameters) {function body}
B. function {function body}
C. function functionName(parameters) {function body}
D. data type functionName(parameters) {function body}
<?php
15. what will be the output of the following program?
$x=27;
A. 9 $x/=3;
B. 81 $y=pow($x,0.5);
C. 27 echo $y;
D. 3 ?>
16. Which one of the following PHP functions is used to execute SQL queries?
A. mysqli_select_db() C. mysqli_execute_query()
B. mysqli_fetch_assoc() D. mysqli_query()
17. Based on the code snippet given below, which one of the following statements allow you to
assign an email submitted from the form to a variable called email?
A. $email= $_GET[“email”]; <form action="" method="get">
B. $email= $_POST[“email”]; UserEmail<input type="text" name="email">
C. echo $_REQUEST[“email”]; <input type="submit" name="submit" alue="Submit"></form>
D. $email= $_REQUEST[“UserEmail”];
18. Which one of the following statements is the right way of creating a cookie called product that
can only stay for 2?
A. createcookie(“product”,”smart phone”,time()+(60*60*14),”/”,”localhost”,0);
B. setcookie(“product”,”smart phone”,time()+(60*60*2*24),”/”,”localhost”,0);
C. setcookie(“product”,”smart phone”,time()+(60*60*24*14),”/”,”localhost”,0);
D. setcookie(“product”,”smart phone”,time()+(60*60*24),”/”,”localhost”,0);
19. What is the use of isset() function in PHP?
A. The isset() function is used to check whether a variable is set or not
B. The isset() function is used to check whether a variable is free or not
C. The isset() function is used to check whether a variable is a string or not
D. The isset() function is used to set a new value to a variable
20. Identify the correct statement based on the code snippet given below.
A. xyz.txt file is opened for reading only $fop=fopen(“xyz.txt”,”a+”);
B. the text hello will be appended to the existing content in xyz.txt file fwrite($fop,”hello”);
C. the text hello won’t be written to xyz.txt file, if the file does not exist fclose($fop);
D. xyz.txt file is opened for write-only access
21. Assume we have a text file called “myfile.txt”. The content in the file is “How is the
exam?”. Based on this information, which one of the following will be the output of the
program given below? <?php
A. 15 bytes $fn="myfile.txt";
$fo=fopen($fn,'r');
B. 16 bytes
$fs=filesize($fn)
C. 128 bits echo "$fs bytes";
D. 16 bits ?>
22. Which one of the following statements is the right way of copying the content of a file
called navigation.php into another PHP file?
A. <?php include(“navigation.php”); ?> C. <?php copy(“index.php”); ?>
B. <?php includeOnce(“index.php”); ?> D. <?php requireOnce(“navigation.php”); ?>
23. which one of the following PHP functions removes the last element of an array?
A. array_pop() B. array_unshift() C. array_push() D. array_shift()
24. Which PHP function is capable to read contents of a file character by character?
A. filegets() B. fget() C. fgets() D. fgetc()
25. In the following statement, what does the "+" symbol mean?
preg_match('/^[0-9]+$/', $data)
A. Any character
B. one character between 0 and 9
C. One or more characters between 0 and 9
D. Any character between 0 and 9 followed by a $
26. The updated MySQL extension released with PHP 5 is typically referred to
as__________.
A. MySQL B. mysql C. mysqli D. mysqly
27. Which one of the following statements is true about mysqli_fetch_assoc() function in
PHP?
A. Used to count the number of records a table has
B. Used to retrieve all the records of an existing table at once
C. Used to retrieve only one record from an existing table
D. Retrieves all records of a table at a time in the form of associative array
28. Which one of the following is not included in $_FILES array?
A. temp_name B. name C. size D. type
29. What will be the output of the following PHP code?
<?php
A. 10 C. infinite loop for(;;) { echo "5"; }
B. no output D. error ?>
30. What will be the output of the following PHP code?
A. 100 <?php
B. Error $x = 75;
C. 75 $y = 25;
function addition(){
D. 25
$GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}
addition();
echo $z;
?>

You might also like