SQL Set 1 (40 mcqs)

1. …………………… is the full form of SQL.
A) Standard Query Language
B) Sequential Query Language
C) Structured Query Language
D) Server Side Query Language

2. SQL Server 2005 NOT includes the following system database ………….
A) tempdb Database
B) Master Database
C) Model Database
D) sqldb Database

3. SQL Server stores index information in the ………………… system table.
A) sysindexes
B) systemindexes
C) sysind
D) sysindexes

4. ………………… is a read-only database that contains system objects that are included with SQL Server 2005.
A) Resource Database
B) Master Database
C) Model Database
D) msdb Database

5. The SQL Server services includes …………………
A) SQL server agent
B) Microsoft distribution transaction coordinator
C) Both a & b
D) None of the above

6. …………………. is a utility to capture a continuous record of server activity and provide auditing capability.
A) SQL server profile
B) SQL server service manager
C) SQL server setup
D) SQL server wizard

7. The query used to remove all references for the pubs and newspubs databases from the system tables is ……………………..
A) DROP DATABASE pubs, newpubs;
B) DELETE DATABASE pubs, newpubs;
C) REMOVE DATABASE pubs, newpubs;
D) DROP DATABASE pubs and newpubs;

8. …………………. clause specifies the groups into which output rows are to be placed and, if aggregate functions are included in the SELECT clause.
A) ORDER BY
B) GROUP
C) GROUP BY
D) GROUP IN

9. ……………… are predefined and maintained SQL Server where users cannot assign or directly change the values.
A) Local Variables
B) Global Variables
C) Assigned Variables
D) Direct Variables

10. Microsoft SQL Server NOT uses which of the following operator category?
A) Bitwise Operator
B) Unary Operator
C) Logical Operator
D) Real Operator

11. Which of the following query is correct for using comparison operators in SQL?

A) SELECT sname, coursename FROM studentinfo WHERE age>50 and <80;

B) SELECT sname, coursename FROM studentinfo WHERE age>50 and age <80;

C) SELECT sname, coursename FROM studentinfo WHERE age>50 and WHERE age<80;

D) None of the above

12.How to select all data from studentinfo table starting the name from letter ‘r’?

A) SELECT * FROM studentinfo WHERE sname LIKE ‘r%’;

B) SELECT * FROM studentinfo WHERE sname LIKE ‘%r%’;

C) SELECT * FROM studentinfo WHERE sname LIKE ‘%r’;

D) SELECT * FROM studentinfo WHERE sname LIKE ‘_r%’;

13. Which of the following SQL query is correct for selecting the name of staffs from ‘tblstaff’ table where salary is 15,000 or 25,000?

A) SELECT sname from tblstaff WHERE salary IN (15000, 25000);

B) SELECT sname from tblstaff WHERE salary BETWEEN 15000 AND 25000;

C) Both A and B

D) None of the above

14. The SELECT statement, that retrieves all the columns from empinfo table name starting with d to p is ……………………..

A) SELECT ALL FROM empinfo WHERE ename like ‘[d-p]%’;

B) SELECT * FROM empinfo WHERE ename is ‘[d-p]%’;

C) SELECT * FROM empinfo WHERE ename like ‘[p-d]%’;

D) SELECT * FROM empinfo WHERE ename like ‘[d-p]%’;

15. Select a query that retrieves all of the unique countries from the student table?

A) SELECT DISTINCT coursename FROM studentinfo;

B) SELECT UNIQUE coursename FROM studentinfo;

C) SELECT DISTINCT coursename FROM TABLE studentinfo;

D) SELECT INDIVIDUAL coursename FROM studentinfo;

16. Which query is used for sorting data that retrieves the all the fields from empinfo table and listed them in the ascending order?

A) SELECT * FROM empinfo ORDER BY age;

B) SELECT * FROM empinfo ORDER age;

C) SELECT * FROM empinfo ORDER BY COLUMN age;

D) SELECT * FROM empinfo SORT BY age;

17. Select the right statement to insert values to the stdinfo table.

A) INSERT VALUES (“15”, “Hari Thapa”, 45, 5000) INTO stdinfo;

B) INSERT VALUES INTO stdinfo (“15”, “Hari Thapa”, 45, 5000);

C) INSERT stdinfo VALUES (“15”, “Hari Thapa”, 45, 5000);

D) INSERT INTO stdinfo VALUES (“15”, “Hari Thapa”, 45, 5000);

18. How to Delete records from studentinfo table with name of student ‘Hari Prasad’?

A) DELETE FROM TABLE studentinfo WHERE sname=’Hari Prasad’;

B) DELETE FROM studentinfo WHERE sname=’Hari Prasad’;

C) DELETE FROM studentinfo WHERE COLUMN sname=’Hari Prasad’;

D) DELETE FROM studentinfo WHERE sname LIKE ‘Hari Prasad’;

19. Constraint checking can be disabled in existing …………. and ………….. constraints so that any data you modify or add to the table is not checked against the constraint.

A) CHECK, FOREIGN KEY

B) DELETE, FOREIGN KEY

C) CHECK, PRIMARY KEY

D) PRIMARY KEY, FOREIGN KEY

20. ………………… joins two or more tables based on a specified column value not equaling a specified column value in another table.

A) OUTER JOIN

B) NATURAL JOIN

C) NON-EQUIJOIN

D) EQUIJOIN

21. …………………… is a procedural extension of Oracle – SQL that offers language constructs similar to those in imperative programming languages.
A) SQL
B) PL/SQL
C) Advanced SQL
D) PQL

22. ……………….. combines the data manipulating power of SQL with the data processing power of Procedural languages.
A) PL/SQL
B) SQL
C) Advanced SQL
D) PQL

23. ………………. has made PL/SQL code run faster without requiring any additional work on the part of the programmer.
A) SQL Server
B) My SQL
C) Oracle
D) SQL Lite

24. A line of PL/SQL text contains groups of characters known as …………………..
A) Lexical Units
B) Literals
C) Textual Units
D) Identifiers

25. We use …………………… name PL/SQL program objects and units.
A) Lexical Units
B) Literals
C) Delimiters
D) Identifiers

26. A ……………….. is an explicit numeric, character, string or Boolean value not represented by an identifier.
A) Comments
B) Literals
C) Delimiters
D) Identifiers

27. If no header is specified, the block is said to be an …………………. PL/SQL block.
A) Strong
B) Weak
C) Empty
D) Anonymous

28. …………. is a sequence of zero or more characters enclosed by single quotes.
A) Integers literal
B) String literal
C) String units
D) String label

29. In ……………………, the management of the password for the account can be handled outside of oracle such as operating system.
A) Database Authentication

B) Operating System Authentication
C) Internal Authentication
D) External Authentication

30. In ………………………. of Oracle, the database administrator creates a user account in the database for each user who needs access.
A) Database Authentication
B) Operating System Authentication
C) Internal Authentication
D) External Authentication

31. In SQL, which command is used to remove a stored function from the database?

Cover of SQL Server magazine (Photo credit: Wikipedia)

A) REMOVE FUNCTION
B) DELETE FUNCTION
C) DROP FUNCTION
D) ERASE FUNCTION

32. In SQL, which command is used to select only one copy of each set of duplicate rows
A) SELECT DISTINCT
B) SELECT UNIQUE
C) SELECT DIFFERENT
D) All of the above

33. Count function in SQL returns the number of
A) Values
B) Distinct values
C) Groups
D) Columns

34. Composite key is made up of …………….
A) One column
B) One super key
C) One foreign key
D) Two or more columns

35. What command is used to get back the privileges offered by the GRANT command?
A) Grant
B) Revoke
C) Execute
D) Run

36. Which command displays the SQL command in the SQL buffer, and then executes it?
A) CMD
B) OPEN
C) EXECUTE
D) RUN

37. What is a DATABLOCK?
A) Set of Extents
B) Set of Segments
C) Smallest Database storage unit
D) Set of blocks

38. If two groups are not linked in the data model editor, what is the hierarchy between them?
A) There is no hierarchy between unlinked groups.
B) The group that is right ranks higher than the group that is to right or below it.
C) The group that is above or leftmost ranks higher than the group that is to right or below it.
D) The group that is left ranks higher than the group that is to the right.

39. Which of the following types of triggers can be fired on DDL operations?
A) Instead of Trigger
B) DML Trigger
C) System Trigger
D) DDL Trigger

40. What operator performs pattern matching?
A) IS NULL operator
B) ASSIGNMENT operator
C) LIKE operator
D) NOT operator

Answers

1.C 2.D 3.D 4.A 5.C 6.B
7.A 8.C 9.B 10.D 11.B 12.A
13.A 14.D 15.A 16.A 17.D 18.B
19.A 20.C 21.B 22.A 23.C 24.A
25.D 26.B 27.D 28.B 29.B 30.A
31.C 32.A 33.A 34.D 35.B 36.D
37.C 38.C 39.C 40.C
Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *