SQL Online Quiz


Advertisements


Following quiz provides Multiple Choice Questions (MCQs) related to SQL. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 2 - What is returned by TRUNC(789.8389, 2)?

A - 789.84

B - 789.83

C - 78

D - 789.00

Answer : B

Q 5 - A subquery can be placed in which of the SQL clauses?

A - The WHERE clause

B - The HAVING clause

C - The FROM clause

D - All of the above.

Answer : D

Q 7 - Consider the following schema −

LOCATIONS(subject_code, department_name, location_id, city);

Which code snippet will alter the table LOCATIONS and add a column named Address, with datatype VARCHAR2(100)?

A - ALTER TABLE locations ADD (address varchar2(100));

B - ALTER TABLE locations ADD COLUMN(address varchar2(100));

C - MODIFY TABLE locations ADD COLUMN (address varchar2(100));

D - None of the above.

Answer : A

Q 8 - Consider the following schema −

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

Which of the following code will create a simple view named all_marks_english that contains the names and percentage of marks of the students in the honours_subject ‘Eng01’?

A - create view all_marks_english as select first_name, last_name, percentage_of_marks from students where honours_subject = ‘Eng01’;

B - create view all_marks_english as ( first_name, last_name, percentage_of_marks from students where honours_subject = ‘Eng01’);

C - select view all_marks_english as select first_name, last_name, percentage_of_marks from students where honours_subject = ‘Eng01’;

D - None of the above.

Answer : A

Q 9 - Which of the following minimal code would create a sequence named loc_seq as a primary key of the LOCATIONS table?

A - create sequence loc_seq;

B - create sequence loc_seq on locations;

C - create loc_seq;

D - None of the above.

Answer : A

Q 10 - Which of the following is a system privilege?

A - Creating new users

B - Removing users

C - Removing tables

D - All of the above.

Answer : D


sql_questions_answers.htm

Advertisements