0% found this document useful (0 votes)
229 views17 pages

RDBMS and HTML Mock Test 1546944945554

The document provides details of 9 multiple choice questions related to SQL statements. Question 1 asks about renaming a table, Question 2 about updating a column to NULL, Question 3 about retrieving records within a price range, and so on. Each question has 4 possible answer options and identifies the correct option. The questions cover topics such as table operations, data retrieval and manipulation, data types, constraints and aggregation.

Uploaded by

sanjay bhatt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
229 views17 pages

RDBMS and HTML Mock Test 1546944945554

The document provides details of 9 multiple choice questions related to SQL statements. Question 1 asks about renaming a table, Question 2 about updating a column to NULL, Question 3 about retrieving records within a price range, and so on. Each question has 4 possible answer options and identifies the correct option. The questions cover topics such as table operations, data retrieval and manipulation, data types, constraints and aggregation.

Uploaded by

sanjay bhatt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Shout4Education

Question-wise Details

Section #1

Question 1: Time: 1 Min 34 Sec Marks: 1/ 1

Consider the table Products(pid,pname,pcost). Identify the appropriate SQL statement to rename the table to ProductsInfo .
Choose most appropriate option.

Options Response Answer

ALTER TABLE Products RENAME


ProductsInfo;

n
ALTER TABLE Products UPDATE TO

tio
ProductsInfo;

ca
ALTER TABLE RENAME Products TO
ProductsInfo; du
ALTER TABLE Products RENAME TO
ProductsInfo;
4E

Question 2:
ut

Time: 1 Min 23 Sec Marks: 0/ 1


o

Consider the table Employee(empid,jobBand).


Sh

Which is the CORRECT DML statement to update the job band of all employees to NULL? Choose most appropriate option.

Options Response Answer

UPDATE TABLE employee SET


jobBand is NULL;

UPDATE employee SET jobBand =


NULL;

UPDATE TABLE employee SET


jobBand = NULL;

UPDATE employee SET jobBand is


NULL;

Shout4Education
2 / 18
Shout4Education

Question 3: Time: 1 Min 32 Sec Marks: 1/ 1

Consider table Product(productId, price). Identify the appropriate SQL statement to display all products whose price range is
2500 and 5000(exclusive 2500 and 5000). Choose two most appropriate options.

Options Response Answer

SELECT * FROM Product WHERE


price BETWEEN 2500 AND 5000;

SELECT * FROM Product WHERE


price>2500 AND price<5000;

n
SELECT * FROM Product WHERE
price>=2500 AND price<=5000;

tio
SELECT * FROM Product WHERE

ca
price BETWEEN 2501 AND 4999;

Candidate responses were captured before updation of the question with restrictions on maximum responses.
du
4E

Question 4: Time: 1 Min 1 Sec Marks: 1/ 1


ut

Consider the table Employee(empId,empName,jobBand). Which is the CORRECT SQL statement to retrieve all UNIQUE
jobBand from Employee table ? Choose most appropriate option.
o
Sh

Options Response Answer

SELECT jobBand DISTINCT from


Employee;

SELECT DISTINCT jobBand,empId


from Employee;

SELECT DISTINCT(jobBand) from


Employee;

SELECT DISTINCT jobBand from


Employee;

Question 5: Time: 23 Sec Marks: 1/ 1

Shout4Education
3 / 18
Shout4Education
Consider table Register(registerId VARCHAR2(10), dateOfRegistration DATE).

Note: There are no constraints added to any columns and table has no records. Which of the following SQL statements
executes successfully on Register table.

a) ALTER TABLE Register MODIFY registerId NUMBER(10);

b) ALTER TABLE Register ADD CONSTRAINT date_nn NOT NULL(DATE);

n
tio

ca
choose most appropriate option. du
Options Response Answer

only a
4E

only b
ut

both a and b
o

neither a nor b
Sh

Question 6: Time: 1 Min 4 Sec Marks: 1/ 1

Consider table Students(sid NUMBER(3), sname VARCHAR2(10), scontact NUMBER(10) ) is already created in the database.
It is required to change the data type of the column "scontact" to VARCHAR2(15). Which of the following is Correct for the
above requirement?

Note: sid column is primary key.

Choose most appropriate option.

Shout4Education
4 / 18
Shout4Education
Options Response Answer

To change the data type of a column, it


is important to ensure that the
corresponding column is not having
data for any of the record

There are no criteria to be followed. We


can change the datatype of the column
irrespective of the data

Data type can be changed only for


primary key column

It is not possible to change the data


type of a column

n
tio
Question 7: Time: 33 Sec

ca
Marks: 1/ 1

du
Identify the CORRECT statements with respect to constraints.
4E

(i) A table can have only one FOREIGN KEY


ut

(ii) A column with UNIQUE constraint cannot have NULL value


o
Sh

choose most appropriate option.

Options Response Answer

only (i)

only (ii)

both (i) and (ii)

neither (i) nor (ii)

Question 8: Time: 41 Sec Marks: 1/ 1

Shout4Education
5 / 18
Shout4Education
Consider table Product(pid, ptype). Identify the appropriate SQL statement to display the product type and count of products in
each product type only if there are more than two products. Choose most appropriate option.

Options Response Answer

SELECT ptype, COUNT(pid) FROM


Product GROUP BY ptype HAVING
COUNT(pid)>2;

SELECT ptype, COUNT(pid) FROM


Product WHERE COUNT(pid)>2
GROUP BY ptype;

SELECT ptype, COUNT(pid) FROM


Product GROUP BY ptype WHERE
COUNT(pid)>2;

n
SELECT ptype, COUNT(pid) FROM

tio
Product HAVING COUNT(pid)>2
GROUP BY ptype;

ca
du
Question 9: Time: 1 Min 48 Sec Marks: 1/ 1
4E

Consider table Employee(EmpId, EmpName,salary,deptNo). Which is the CORRECT SQL statement to list employees whose
salary is more than their department's average salary? The result should be in ascending order of department number. Choose
ut

most appropriate option.


o
Sh

Shout4Education
6 / 18
Shout4Education
Options Response Answer

SELECT e1.empId, e1.empName,


e1.salary,e1.deptNo FROM employee
e1 WHERE e1.salary > (SELECT
avg(e2.salary) FROM employee e2)
ORDER BY e1.deptNo;

SELECT e1.empId, e1.empName,


e1.salary,e1.deptNo FROM employee
e1 ORDER BY e1.deptNo WHERE
e1.salary > (SELECT avg(e2.salary)
FROM employee e2 WHERE
e2.deptNo = e1.deptNo);

SELECT e1.empId, e1.empName,

n
e1.salary,e1.deptNo FROM employee

tio
e1 WHERE avg(e1.salary) > (SELECT
e2.salary FROM employee e2 WHERE

ca
e2.deptNo = e1.deptNo) ORDER BY
e1.deptNo; du
SELECT e1.empId, e1.empName,
e1.salary,e1.deptNo FROM employee
e1 WHERE e1.salary > (SELECT
4E

avg(e2.salary) FROM employee e2


WHERE e2.deptNo = e1.deptNo)
ORDER BY e1.deptNo;
o ut
Sh

Question 10: Time: 2 Min 27 Sec Marks: 0/ 1

Consider the below tables are created and has some records. Account(accountId,accountType,balance)
Transaction(transactionId,accountId,transactionType,amount)

AccountId in transaction table is a foreign key referring to accountId of account table. Which is the CORRECT SQL statement to
retrieve accountId and accountType for which more than three transactions are recorded?

Choose most appropriate option.

Shout4Education
7 / 18
Shout4Education
Options Response Answer

SELECT accountId,accountType
FROM account WHERE accountid IN(
SELECT COUNT(transactionid) FROM
transaction GROUP BY accountid
HAVING COUNT(transactionid)>3);

SELECT accountId,accountType
FROM account WHERE accountid IN(
SELECT accountid FROM transaction
GROUP BY accountid HAVING
COUNT(transactionid)>3);

SELECT accountId,accountType
FROM account WHERE accountid IN(

n
SELECT accountid FROM transaction

tio
WHERE COUNT(transactionid)>3
GROUP BY accountid );

ca
SELECT accountId,accountType
FROM account GROUP BY accountId
du
HAVING COUNT(accountId)=(
SELECT COUNT(accountid)FROM
transaction GROUP BY accountid
4E

HAVING COUNT(transactionid)>3);
ut

Question 11: Time: 1 Min 58 Sec


o

Marks: 0/ 1
Sh

Shout4Education
8 / 18
Shout4Education
Consider the tables given below.

Customer(customerId,customerName)

Book(bookId, bookName)

Purchase(purchaseId, bookId, customerId)

bookId and customerId in purchase table are foreign keys referring to Book and Customer tables respectively. Which is the
CORRECT SQL statement to retrieve customer name and book name for all books purchased by customers?

n
tio
Choose most appropriate option.

Options Response Answer

ca
SELECT
c.customerName,b.bookName FROM
du
customer c INNER JOIN purchase p
ON c.customerId=p.customerId SELF
4E

JOIN book b ON b.bookid=p.bookid;

SELECT
ut

c.customerName,b.bookName FROM
customer c INNER JOIN purchase p
o

INNER JOIN book b ON


b.bookid=p.bookid AND
Sh

c.customerId=p.customerId;

SELECT
c.customerName,b.bookName FROM
customer c INNER JOIN purchase p
ON c.customerId=p.customerId INNER
JOIN book b ON b.bookid=p.bookid;

SELECT
c.customerName,b.bookName FROM
customer c INNER JOIN purchase p
ON c.customerId=p.customerId;

Question 12: Time: 1 Min 9 Sec Marks: 1/ 1

Shout4Education
9 / 18
Shout4Education

Consider table player(playerid, playername, runs_scored, playergroup). Identify the CORRECT SQL statement to retrieve the
details of players who have scored runs which is greater than the average of runs scored by all players in his player group.
Choose most appropriate option.

Options Response Answer

SELECT p1.playerid, p1.playername,


p1.runs_scored FROM player p1
WHERE AVG(p1.runs_scored)>(
SELECT AVG(p2.runs_scored) FROM
player p2 WHERE
p1.playergroup=p2.playergroup);

SELECT playerid, playername,


runs_scored FROM player WHERE

n
runs_scored>( SELECT

tio
AVG(runs_scored) FROM player);

SELECT p1.playerid, p1.playername,

ca
p1.runs_scored FROM player p1
WHERE p1.runs_scored>( SELECT
p2.runs_scored FROM player p2
du
GROUP BY p2.playergroup HAVING
p2.runs_scored>AVG(p2.runs_scored))
4E

SELECT p1.playerid, p1.playername,


ut

p1.runs_scored FROM player p1


WHERE p1.runs_scored>( SELECT
o

AVG(p2.runs_scored) FROM player p2


Sh

WHERE
p1.playergroup=p2.playergroup);

Question 13: Time: 9 Sec Marks: 1/ 1

Shout4Education
10 / 18
Shout4Education
Which of the following is/are the inline html elements?

(i) <i>

(ii) <h6>

(iii) <a>

n
Choose most appropriate option.

tio
Options Response Answer

ca
(i) and (iii)

(ii) and (iii)


du
only (i)
4E

(i), (ii) and (iii)


ut

Question 14: Time: 7 Sec Marks: 1/ 1


o
Sh

Which of the following are the CSS selectors?

a) Element Selector

b) Form Selector

c) Class Selector

Choose most appropriate option.

Shout4Education
11 / 18
Shout4Education
Options Response Answer

a and b

a and c

b and c

a, b and c

Question 15: Time: 34 Sec Marks: 1/ 1

Which of the following is the correct html form element to create the checkbox in a web page? Choose most appropriate option.

n
Options Response Answer

tio
<checkbox>

ca
<input=checkbox> du
<input type="checkbox">

<input checkbox>
4E
ut

Question 16: Time: 1 Min 29 Sec Marks: 1/ 1


o
Sh

Shout4Education
12 / 18
Shout4Education
Refer the incomplete HTML Code given below

1 <html>
2 <body>
3 <form action="abc.html" _____> <!--Line1-->
4 First Name: <input type="text" name="f1"/>
5 <br/>
6 Last Name: <input type="text" name="l1"/>
7 <br/>
8 Password: <input type="password" name="p1"/>
9 <br/>
10 <input type="submit" value="Submit"/> </form>
11 </body>
12 </html>
13

n
tio

ca
Assume abc.html is existing and a valid HTML page. Identify the appropriate option to be placed at Line1 so that values entered
in the text boxes are not appended to URL while submitting to abc.html . Choose most appropriate option.
du
Options Response Answer
4E

method="GET"
ut

method="POST"

submit="GET"
o
Sh

submit="POST"

Question 17: Time: 3 Min 36 Sec Marks: 0/ 1

Shout4Education
13 / 18
Shout4Education
What would be the Output of the below java script Code?

1 <html>
2 <body>
3 <script>
4 var x = 5;
5 var d = (x != "5");
6 document.write(d +"--");
7 d = (x === "5");
8 document.write(d);
9 </script>
10 </body>
11 </html>
12

tio
ca
Choose most appropriate option.
du
Options Response Answer

false--false
4E

false--true
ut

true--false

true--true
o
Sh

Question 18: Time: 1 Min 41 Sec Marks: 0/ 1

Shout4Education
14 / 18
Shout4Education
What would be the output of the java script code given below?

1 <html>
2 <head>
3 <script>
4 var data1=100;
5 function test()
6 {
7 var data1=200;
8 window.data1=data1+10;
9 }
10 test();
11 document.write(data1);
12 </script>
13 </head>
14 <body>
15 </body>
16 </html>

n
17

tio
ca

du
Choose most appropriate option.
4E

Options Response Answer


ut

100

200
o
Sh

210

110

Question 19: Time: 43 Sec Marks: 1/ 1

Shout4Education
15 / 18
Shout4Education
Refer the HTML code given below.

1 <html>
2 <body>
3 <table border="1">
4 <tr>
5 <th>A</th>
6 <th colspan="2">B</th>
7 </tr>
8 <tr>
9 <th rowspan="3">C</th>
10 <th>D</th>
11 <th>E</th>
12 </tr>
13 <tr>
14 <th>A</th>
15 <th>B</th>
16 </tr>

n
17 <tr>
18 <th>D</th>

tio
19 <th>E</th>
20 </tr>
21 </table>
22 </body>

ca
23 </html>
24 du

4E
ut

How many cells will be displayed when the page is displayed on the browser? Choose most appropriate option.
o

Options Response Answer


Sh

11

10

Question 20: Time: 9 Sec Marks: 1/ 1

Shout4Education
16 / 18
Shout4Education
Refer the HTMLcode given below.

1 <html> <body>
2 <table border="1">
3 <tr><th>A</th>
4 <th colspan="2">B</th>
5 </tr>
6 <tr> <th rowspan="3">C</th>
7 <th>D</th>
8 <th>E</th>
9 </tr>
10 <tr>
11 <th>A</th>
12 <th rowspan="2">B</th>
13 </tr>
14 <tr>

n
15 <th>D</th>
16 </tr>

tio
17 </table>
18 </body>
19 </html>
20

ca
du

4E


ut

How many cells will be displayed when the page is displayed on the browser? Choose most appropriate option.
o
Sh

Options Response Answer

10

Shout4Education
17 / 18
Shout4Education

n
tio
ca
du
4E
ut
o
Sh

Shout4Education
18 / 18

You might also like