0% found this document useful (0 votes)
2K views17 pages

RDBMS and HTML Mock Test - 1549089885404

The document contains a summary of 9 multiple choice questions from an online exam on SQL and database concepts. The questions cover topics such as retrieving unique values, using LIKE operator in WHERE clauses, renaming tables, updating columns to NULL, constraints, and aggregation with GROUP BY. For each question, the document lists the question, possible answer options, and time taken and marks obtained for that question.

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)
2K views17 pages

RDBMS and HTML Mock Test - 1549089885404

The document contains a summary of 9 multiple choice questions from an online exam on SQL and database concepts. The questions cover topics such as retrieving unique values, using LIKE operator in WHERE clauses, renaming tables, updating columns to NULL, constraints, and aggregation with GROUP BY. For each question, the document lists the question, possible answer options, and time taken and marks obtained for that question.

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: 51 Sec Marks: 0/ 1

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.

Options Response Answer

SELECT jobBand DISTINCT from


Employee;

n
SELECT DISTINCT jobBand,empId

tio
from Employee;

ca
SELECT DISTINCT(jobBand) from
Employee; du
SELECT DISTINCT jobBand from
Employee;
4E

Question 2:
ut

Time: 33 Sec Marks: 1/ 1


o

Consider table Department(deptId,deptName). Which of the following query is used to display the department details whose
Sh

deptname has second letter as 'a' and second last letter as 'e'? Choose most appropriate option.

Options Response Answer

SELECT * FROM department WHERE


deptname LIKE '_a%e_';

SELECT * FROM department WHERE


deptname LIKE 'a%e_';

SELECT * FROM department WHERE


deptname LIKE '%a%e_';

SELECT * FROM department WHERE


deptname LIKE 'a%e%';

Shout4Education
2 / 18
Shout4Education
Question 3: Time: 48 Sec Marks: 0/ 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;

ALTER TABLE Products UPDATE TO


ProductsInfo;

ALTER TABLE RENAME Products TO


ProductsInfo;

n
ALTER TABLE Products RENAME TO

tio
ProductsInfo;

ca
Question 4:
du Time: 47 Sec Marks: 0/ 1
4E

Consider the table Employee(empid,jobBand).


ut

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

Options Response Answer


Sh

UPDATE TABLE employee SET


jobBand is NULL;

UPDATE employee SET jobBand =


NULL;

UPDATE TABLE employee SET


jobBand = NULL;

UPDATE employee SET jobBand is


NULL;

Question 5: Time: 34 Sec Marks: 0/ 1

Shout4Education
3 / 18
Shout4Education
Identify the CORRECT statements with respect to constraints.

(i) A table can have only one FOREIGN KEY

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

choose most appropriate option.

Options Response Answer

only (i)

only (ii)

n
tio
both (i) and (ii)

neither (i) nor (ii)

ca
du
Question 6: Time: 35 Sec Marks: 1/ 1
4E

Identify the CORRECT statement(s)


ut


o
Sh

(a) A column with UNIQUE constraint can have NULL values

(b) FOREIGN KEY column can have NULL values

(c) A TABLE can have more than one PRIMARY KEY column

(d) FOREIGN KEY column can refer to PRIMARY KEY column of same table only

Choose most appropriate option.


Shout4Education
4 / 18
Shout4Education
Options Response Answer

a and b

a and d

b and c

a, b and d

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

Consider the table Project(ProjectId, ProjectName, ProjectType) is created without any constraint and has the records as per

n
the attachment.

tio
ca
du
4E
o ut


Sh

Identify the ALTER statement which executes successfully on project table. Choose most appropriate option.

Shout4Education
5 / 18
Shout4Education
Options Response Answer

ALTER TABLE Project ADD


CONSTRAINT proj_pk PRIMARY
KEY(ProjectId);

ALTER TABLE Project ADD


CONSTRAINT proj_uq
UNIQUE(ProjectName);

ALTER TABLE Project ADD


CONSTRAINT proj_nn NOT
NULL(ProjectType);

ALTER TABLE Project ADD


CONSTRAINT proj_chk

n
CHECK(ProjectType IN('A1','A2'));

tio
ca
Question 8: du Time: 1 Min 28 Sec Marks: 0/ 1

Consider table Students(studentId, branchid). Identify the CORRECT SQL statement to retrieve the branches which has more
than 3 students. Choose most appropriate option.
4E

Options Response Answer


ut

SELECT branchid FROM Students


WHERE COUNT(*) > 3 GROUP BY
o

branchid;
Sh

SELECT branchid FROM Students


HAVING COUNT(*) > 3;

SELECT branchid FROM Students


GROUP BY studentId HAVING
COUNT(*) > 3;

SELECT branchid FROM Students


GROUP BY branchid HAVING
COUNT(*) > 3;

Question 9: Time: 3 Min 0 Sec Marks: 0/ 1

Shout4Education
6 / 18
Shout4Education
Consider the table Account (accid, balance, accountType). The following constraints to be enforced.

1. Accid should be unique and Not Null

2. Account type should be 'C' or 'S'. Balance should be greater than 1000 and 3000 for account type 'C' and 'S' respectively

Identify the CORRECT SQL statement to create the Account table with the above mentioned constraints. Choose most
appropriate option.

n
tio
ca
du
4E
o ut
Sh

Shout4Education
7 / 18
Shout4Education
Options Response Answer

CREATE TABLE account( accid


NUMBER(2) CONSTRAINT acc_pk
PRIMARY KEY, balance NUMBER(4),
accountType CHAR, CONSTRAINT
acc_chk CHECK (accountType='S'
AND balance>3000) AND
(accountType='C' AND balance
>1000)) );

CREATE TABLE account( accid


NUMBER(2) CONSTRAINT acc_pk1
PRIMARY KEY, balance NUMBER(4)
CONSTRAINT acc_chk

n
CHECK(balance>1000 OR balance
>3000), accountType CHAR

tio
CONSTRAINT acc_chk CHECK
(accountType='S' OR accounTtype='C')

ca
);

CREATE TABLE account( accid


du
NUMBER(2) CONSTRAINT acc_pk
PRIMARY KEY, balance NUMBER(4),
accountType CHAR, CONSTRAINT
4E

acc_chk1 CHECK (accountType='S'


AND balance>3000), CONSTRAINT
ut

acc_chk2 CHECK (accountType='C'


AND balance >1000) );
o

CREATE TABLE account( accid


Sh

NUMBER(2) CONSTRAINT acc_pk


PRIMARY KEY, balance NUMBER(4),
accountType CHAR, CONSTRAINT
acc_chk CHECK ( (accountType='S'
AND balance>3000) OR
(accountType='C' AND balance
>1000)) );

Question 10: Time: 1 Min 23 Sec Marks: 1/ 1

Shout4Education
8 / 18
Shout4Education
You are suppose to create a table "ExamResult" with the following description. studentId NUMBER(4), courseId
VARCHAR2(10), mark NUMBER(3) There should not be duplicate combination of studentId and courseId in any record. Identify
the correct DDL statement to create ExamResult table. Choose the most apprpriate option.

Options Response Answer

CREATE TABLE ExamResult(


studentId NUMBER(4), courseId
VARCHAR2(10), mark NUMBER(3),
CONSTRAINT er_pk PRIMARY
KEY(studentId, courseId));

CREATE TABLE ExamResult(


studentId NUMBER(4) CONSTRAINT
stud_pk PRIMARY KEY, courseId
VARCHAR2(10) CONSTRAINT cid_pk

n
PRIMARY KEY, mark NUMBER(3));

tio
CREATE TABLE ExamResult(
(studentId NUMBER(4), courseId

ca
VARCHAR2(10) ) CONSTRAINT er_pk
PRIMARY KEY), mark NUMBER(3));
du
CREATE TABLE ExamResult(
studentId NUMBER(4), courseId
4E

VARCHAR2(10), mark NUMBER(3),


CONSTRAINT er_pk COMPOSITE
PRIMARY KEY(studentId, courseId));
o ut
Sh

Question 11: Time: 1 Min 29 Sec Marks: 0/ 1

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.

Shout4Education
9 / 18
Shout4Education
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
runs_scored>( SELECT
AVG(runs_scored) FROM player);

SELECT p1.playerid, p1.playername,


p1.runs_scored FROM player p1

n
WHERE p1.runs_scored>( SELECT

tio
p2.runs_scored FROM player p2
GROUP BY p2.playergroup HAVING

ca
p2.runs_scored>AVG(p2.runs_scored))
; du
SELECT p1.playerid, p1.playername,
p1.runs_scored FROM player p1
WHERE p1.runs_scored>( SELECT
4E

AVG(p2.runs_scored) FROM player p2


WHERE
p1.playergroup=p2.playergroup);
o ut
Sh

Question 12: Time: 44 Sec Marks: 0/ 1

Shout4Education
10 / 18
Shout4Education
Consider the Tables given below:

Product(productId,productName)

ProductOrder(orderId,productId,quantity)

productId column of ProductOrder is a Foreign key reffering to Product Table. Identify the appropriate SQL statement which will
fetch the ProductId,ProductName,OrderId for all the Product ordered and display 'Yet to be Ordered' if a product has not been
ordered till now.

Choose most appropriate option.

n
tio
Options Response Answer

SELECT

ca
p1.productId,p1.productName,NVL(p2.
orderId,'Yet to be Ordered') FROM
Product p1 INNER JOIN ProductOrder
du
p2 ON p1.productId=p2.productId;

SELECT
4E

p1.productId,p1.productName,NVL(p2.
orderId,'Yet to be Ordered') FROM
ut

Product p1 LEFT OUTER JOIN


ProductOrder p2 ON
o

p1.productId=p2.productId;
Sh

SELECT
p1.productId,p1.productName,NVL(p2.
orderId,'Yet to be Ordered') FROM
Product p1 RIGHT OUTER JOIN
ProductOrder p2 ON
p1.productId=p2.productId;

SELECT
p1.productId,p1.productName,NVL('Yet
to be Ordered',p2.orderId) FROM
Product p1 LEFT OUTER JOIN
ProductOrder p2 ON
p1.productId=p2.productId;

Shout4Education
11 / 18
Shout4Education
Question 13: Time: 18 Sec Marks: 1/ 1

1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script>
5 var x = (3 + 3) + 4 + "6";
6 alert(x); //line 1
7 </script>
8 </body>
9 </html>
10

n
tio
What will be printed in alert box in line 1? Choose most appropriate option.

ca
Options Response du Answer

3346

646
4E

106
ut

16
o
Sh

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

What would be the ouput of the javascript code given below?

1 <html>
2 <head>
3 <script>
4 var data=10;
5 document.write(typeof(data));
6 </script>
7 </head>
8 </html>
9

Shout4Education
12 / 18
Shout4Education
Options Response Answer

int

number

integer

numberType

Question 15: Time: 12 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: 31 Sec Marks: 1/ 1


o

Which is the correct CSS code to display the text "Accenture" in light grey back ground? Choose most appropriate option.
Sh

Options Response Answer

<h2 style = "background-color :


lightgrey">Accenture</h2>

<h2 background-color :
lightgrey>Accenture</h2>

<h2 style = "background-


color(lightgrey)">Accenture</h2>

<h2 style = "background-color =


lightgrey">Accenture</h2>

Shout4Education
13 / 18
Shout4Education
Question 17: Time: 2 Min 4 Sec Marks: 0/ 1

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>

n
13 </head>
14 <body>

tio
15 </body>
16 </html>
17

ca
du

4E

Choose most appropriate option.


ut

Options Response Answer


o

100
Sh

200

210

110

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

Shout4Education
14 / 18
Shout4Education
Which of the following are CSS selectors?

(i) Element Selector

(ii) Class Selector

(iii) Style Selector

Options Response Answer

(i) and (ii) only

(ii) and (iii) only

n
tio
(i) and (iii) only

(i), (ii) and (iii)

ca
du
Question 19: Time: 19 Sec Marks: 1/ 1
4E
o ut
Sh

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: 33 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