NEW
Font size
WorksheetsWORKSHOP
Total questions: 20
Worksheet time: 7mins
Which SQL function is used to count the total number of rows in a table, including those with NULL values?
COUNT(column_name)
NUMBER()
SUM()
COUNT(*)
Which of the following is not a DDL command?
UPDATE
TRUNCATE
ALTER
None of the above
How many Primary keys can a table have?
Only 1
Only 2
Depends on number of columns
Depends on DBA
The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate.
WHERE, FROM
FROM, SELECT
SELECT, FROM
FROM, WHERE
his Query can be replaced by which one of the following?
SELECT name, course_id
FROM instructor, teaches
WHERE instructor_ID= teaches_ID;
Select name,course_id from teaches,instructor where instructor_id=course_id;
Select name, course_id from instructor natural join teaches;
Select name, course_id from instructor;
Select course_id from instructor join teaches;
What type of database model organizes data in tables with rows and columns?
Hierarchical
Network
Relational
Object-Oriented
In SQL, which data type is best suited for storing large texts such as articles or comments?
TEXT
VARCHAR
CHAR
BLOB
In SQL, what is the difference between CHAR and VARCHAR data types?
CHAR is fixed length, VARCHAR is variable length
CHAR is variable length, VARCHAR is fixed length
No difference
VARCHAR is used only for numeric data
What is the difference between the DROP and TRUNCATE commands in SQL?
DROP deletes the table, TRUNCATE deletes only the table data
TRUNCATE deletes the table, DROP deletes only the table data
No difference
Both commands modify table data
What does the WHERE clause do in an SQL query?
Sorts the result set
Filters rows before grouping
Joins Tables
Filters rows after grouping
Which of the following is a correct PHP tag?
<?php ?>
<php>
<? ?>
<% %>
PHP can be embedded in which of the following types of documents?
HTML only
CSS only
JavaScript only
HTML, CSS, and JavaScript
What is the correct way to declare a variable in PHP?
int $varName
$varName
var $varName
declare $varName
What will be the output of the following PHP code?
<?php
echo "This", "was", "a", "bad", "idea";
?>
This, was, a, bad, idea
This was a bad idea
Thiswasabadidea
Error
Consider the PHP array:
$arr = array(1, 2, 3, 4);
What is the correct way to access the third element?
$arr[2]
$arr[3]
$arr[2]
$arr(3)
What will be the output of the following PHP code if a user submits a form with an input named email?
if (isset($_POST['email'])) {
echo $_POST['email'];
}
?>
The value of the email input field
NULL
An empty string
An error message
Consider the following PHP code:
for ($i = 1; $i <= 5; $i++) {
if ($i == 3) {
continue;
}
echo $i;
}
?>
1245
12345
1234
125
Which PHP function is used to connect to a MySQL database?
mysql_connect()
mysqli_connect()
connect_db()
db_connect()
Which symbol is used to concatenate strings in PHP?
+
.
&
:
Which of the following statements is true about PHP variables?
PHP variables must begin with a dollar sign ($) followed by a letter or underscore.
PHP variables are case-sensitive.
PHP variables can be declared without specifying a data type.
All of the above
