Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: SQL AND PYTHON MCQ
Description: MCQ of PYTHON AND SQL with answers

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


OBJECTIVE TYPE QUESTIONS
Multiple Choice Questions
1
...

(a) Rows
(b) Key
(c) Attributes
(d) Fields

1

2
...


Which one of the following uniquely identifies the tuples / rows in a relation
...


The Primary key is selected from the set of __________
...


Which of the following is a group of one or more attributes that uniquely identifies a row?
(a) Key (b) Determinant
(c) Tuple(d) Relation

1

6
...


An attribute in a relation is a foreign key if it is the ______ key in any other relation
...


Consider the table with structure as :
Student(ID, name, dept_name, tot_cred)
In the above table, which attribute will form the primary key?
(a) name (b) dept_name(c) Total_credits
(d) ID

1

9
...


Which of the following is a DDL command?
(a) SELECT (b) ALTER
(c) INSERT

1
(d) UPDATE

11
...

(a) SELECT UNIQUE
(b) SELECT DISTINCT
(c) SELECT DIFFERENT
(d) All of these
...


Which of the following keywords will you use in the following query to display the unique
values of the column dept_name?
SELECT________ dept_name FROM COMPANY;
(a) All (b) From(c) Distinct
(d) Name

1

13
...

(a) where (b) from
(c) having
(d) like

1

93 | P a g e

14
...


Which operator checks a value against a range of values?
(a) BETWEEN
(b) LIKE
(c) IN
(d) NOT

1

16
...


Which of the following queries contains an error ?
(a) Select * from emp where empid=10003;
(b) Select empid from emp where empid=10006;
(c) Select empid from emp;
(d) Select empid where empid=10009 and lastname= ‘GUPTA’;

1

18
...


(c) Japneet

Which operator perform pattern matching ?
(a) BETWEN
(b) LIKE
(c) IN

(d)Misha, Japneet
1

(d) NOT

20
...


Which operator tests a column for the absence of data(i
...
NULL value) ?
(a) Exist Operator (b) NOT Operator (c) IS Operator (d) None of these

1

22
...


By default ORDER BY clause list the result in ________ order
...


Consider the following query
SELECT * FROM employee ORDER BY salary ________, name ______;
To display the salary from greater to smaller and name in alphabetical order which of the
following options should be used ?

1

(a)
(b)
(c)
(d)
94 | P a g e

Ascending, Descending
Asc, Desc
Desc, Asc
Descending, Ascending

What is the meaning of Remark LIKE “%5%5%”;
(a) Column Remark begin with two 5s
(b) Column Remark ends with two 5s
(c) Column Remark has more than two 5s
(d) Column Remark has two 5s in it, at any position

1

26
...


Which of the following is/are the DDL Statement ?
(a) Create
(b) Drop
(c) Alter

1

25
...


A Table can have __________
(a) Many primary keys and many unique keys
...

(d) Many primary keys and one unique key
...


Which of the following types of table constraints will prevent the entry of duplicate rows?
(a) Unique
(b) Distinct
(c) Primary Key (d) Null

1

30
...
What type of statement is this ?
INSERT INTO instructor VALUES (10211, ‘SHREYA’ , ‘BIOLOGY’, 69000);
(a) Procedure
(b) DML
(c) DCL
(d) DDL

1

31
...

(a) DELETE FROM mytable;’
(b) DELETE TABLE mytable;
(c) DROP TABLE mytable;
(d) None of these
...


Which of the following query will drop a column from a table ?
(a) DELETE COLUMN column_name;
(b) DROP COLUMN column_name;
(c) ALTER TABLE table_name DROP COLUMN column_name;
(d) None of these

1

33
...


(c) $,|,!

(d) None of these

Which of the following requirement can be implemented using a CHECK constraint?
(a) Student must be greater than 18 years old
...


An attribute in a relation is termed as a foreign key when it reference the _____ of another
relation
...


Data integrity constraints are used to :
(a) Control the access and rights for the table data
...

(c) Ensure the correctness of the data entered in the table as per some rule or condition
etc
...


1

37
...

(a) Candidate Key (b) Primary Key (c) Foreign Key
(d) Check Constraint

1

38
...
99 (b) 99
...
99
(d) 9
...


What should be the data type for the column Pricestoring values less than Rs
...
g
...
21
(a) VARCHAR(50) (b) NUMBER
(c) NUMBER(5,2) (d) NUMBER(6)

1

40
...


Data manipulation language (DML) includes statements that modify the_____ of the
tables of database
...


All aggregate functions ignore NULLs except for the __________ function
...


Which of the following are correct aggregate functions in SQL
(a) AVERAGE()
(b) MAX()
(c) COUNT()

1
(d) TOTAL()

44
...


Aggregate functions can be used in the select list or the ____ clause of the select statement
...

(a) Where, having
(b) Having, where (c) Group by, having (d) Group by where

46
...

(a) To filter out the summary groups
...

(c) To filter out the row and column values
...

47
...


Which of the following is not a text function?
(a) TRIM ()
(b) TRUNCATE()
(c) LEFT()

What will be returned by the given query ?
SELECT INSTR(‘INDIA’, ‘DI’);
(a) 2
(b) 3
(c) -2

1
(d) MID ()

1
(d) -3

49
...
669,2);
(a) 153
...
66
(c) 153
...
7

1

50
...


Write a query to remove leading space of the string ‘

RDBMS MySQL’
...


Display the position of occurrence of string ‘OR’ in the string ‘CORPORATE FLOOR’

1

26
...


Write a query to extract 2 digit year from a string ‘USS/23/67/09’
...


1

28
...
The first three characters
tell the institute code
...


Write a query to find out the remainder of 11 divide by 4
...


Write a query to round off value 15
...


1

31
...


1

1

1
33
...


1

ANSWER
Multiple Choice Questions
1
5
9

(b) Key
(a) Key
(b) QAL

2 (d) All of these
6 (d) Street
10 (b) ALTER

13
17
21
25

(a) where
(d)
(c) IS Operator
(d)

14
18
22
26

(a) Unique
(a)
(b)Foreign Key
(b) Data
(c) Group by,
having
49 (c) 153
...
99
(b)Count(*)
(a)

50 (a) 5

3 (b) Primary Key
7 (b) Primary
11 (b) SELECT
DISTINCT
15 (a) BETWEEN
19 (b) LIKE
23 (d) Ascending
27 (d) All of these

4 (c) Candidate Key
8 (d) ID
12 (c) Distinct
16
20
24
28

(b) SELECT
(d) %
(c) Desc, Asc
(c)

31
35
39
43
47

32
36
40
44
48

(c)
(c)
(b) column Name
(b)And (c)
(b) 3

(a)
(b) Primary Key
(c) NUMBER(5,2)
(b)And (c)
(b) TRUNCATE()


Title: SQL AND PYTHON MCQ
Description: MCQ of PYTHON AND SQL with answers