Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
(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’
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)