Sei sulla pagina 1di 2

Fahaheel Al-Watanieh Indian Private School, Ahmadi, Kuwait

Weekly Test -1 Term-2 (16 September 2018)


Multimedia and Web Technology (067)
Class XII
Maximum Marks: 30
Time: 1 Hours

Q1 Questions based on Database


a) Write any two examples of RDBMS. 1
b) Study the given Table below and answer the following questions.

(i) Which key can be chosen as the primary key of the above table ? Give two
Characteristics of Primary key 2
(ii) What is the degree and cardinality of the given table ? 1
(iii) Write the suitable data types of SID and DOB columns. 1
(iv) With reference to the above given table, write commands in SQL to 4
(A) Insert First record in the table.
(B) Display the names of employees who have salary higher than 45000.
(C) Delete a Record of employee who lives in East
(D) increase the salary for employees whose name ends with ‘a’

Q2 Questions based on PHP


a) Chamge the for loop to while loop without affecting the output 2
<?php
$sum=0;
for ($a=1; $a<=10; $a+=3)
{ if ($a%2==1)
echo $a,"<br>";
$sum += $a; }
echo $sum;
?>
b) Identify the errors and rewrite the following code underlining the changes : 2
<? PHP
for ( $x = = 0; $x < = 8; $x ++)
{
If ( $x == 6)
{
continue;
}
echo $x;
>

c) Give the output of the following statements : 2


(i) echo substr("Multimedia and Web Technology", -10,4) ;
(ii) echo(12*3/(4+2)*8%5);
(iii) echo date("M-d-Y", mktime(0,0,0,14,1,2018));
(iv) echo strncmp("Cloudways","ClouDWAYS",3);
XII 1st Weekly Test September 2018 Page 1 / 2 Subject: MMWT (067)
d) explain die() function with example 2

e) What will be the values of the variables x and y after executing the following code ? 1
<?php
$x=0;
$y=0;
for($x=1;$x<=5; ++$x)
{ $y= $x++;
--$y; }
?>
f) Rewrite the following code segment using while loop without affecting the output: 2
<?PHP
$sum = 0;
echo "The sum is: <BR>";
for ($A=1; $A!=11; $A+=2)
echo 2*$A."<BR>";
echo $A;
?>

g) Following is the code to create a connection to the server and to create a database named
myDB in mySql. Fill in the blanks to complete the code : 4
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = ______________(_$servername, $username,________);
// Check connection
if __________
{
_______("Connection failed:" . mysqli_connect_error());
}
// Create database
$sql = "______________________________myDB";
if (________________($conn, ___________))
{ echo "Database created successfully"; }
else
{ echo "Error creating database:" . mysqli_error($conn); }
mysqli_close(___________);
?>

h) Write the PHP code to set a cookie named ‘‘user’’ and value ‘‘exam’’. The cookie should expire
after a week. Also display the values stored in _COOKIE. 3

i) Create a text file named try.txt using PHP and write the following lines into it : 3
Hello students!
How are you?
All the best for exams.
Then write the code to count the number of vowels in it.

XII 1st Weekly Test September 2018 Page 2 / 2 Subject: MMWT (067)

Potrebbero piacerti anche