SQL Boolean Data Types MCQ


Hello friends in this post we are going to discuss about SQL boolean Multiple choice questions with answer | SQL Boolean Data Types MCQ | SQL Boolean Objective type questions | SQL Boolean Question Answer | SQL Boolean Wipro Dumps | SQL Data Retrieval Manipulation Multiple choice questions with answer | Data Retrieval Manipulation MCQ | Data Retrieval Manipulation Objective type question

1.Which of the following is not true regarding LONG values?
a) A table can contain only one LONG column
b) LONG columns can appear in where clauses
c) Stored function cannot return a LONG value
d) LONG columns cannot be indexed

Ans: b

2.A table can have column of boolean data type.

a) TRUE
b) FALSE

Ans: a

3.Oracle Table can have a boolean data type for its column(s)?

a) TRUE

 b) FALSE 

Ans: b

4.A long column can store data upto

 a) 2 Megabytes

 b) 2 Gigabytes 

 c) 2000 bytes

 d) None of the above

Ans: b

5.BFILE data type can store upto a maximum of

a) 1 GB

 b) 2 GB

 c) 4 GB 

 d) None of the above

Ans: c

6.Create table tab_name(col1 long, col2 long); The above statement will create a table tab_name

a) TRUE
b) FALSE (only one long col can be there)

Ans: b

7.CREATE TABLE table_name(column_name CHAR); What will be the length of the column column_name in the table table_name

 a) 1  (default is 1)

 b) 2

 c) 10

 d) 2000

Ans: a

8.Which all are DATETIME data types that can be used when specifying column definitions?

a) TIMESTAMP
b) INTERVAL MONTH TO DAY
c) DATE
d) A & C

Ans: d

9.CREATE TABLE table_name(column_name CHAR); The above SQL statement will throw an error as length for CHAR data type is not specified

a) TRUE
b) FALSE

Ans: b

10.Which of the following is not a valid data type in Oracle 10g?

a) DATE
b) TIMESTAMP(3)
c) TIMESTAMP(6)
d) TIME

Ans: d

11.What is the maximum length of a CHAR data type

a) 2000
b) 4000
c) 8000
d) No limit

Ans: a

12.Assume we want to store patient’s image onto the hospital database while creating the patient table which of the following data types should be used for storing image within the database.

a) CLOB
b) BFILE – store a link to an external binary file (file stored outside of the database)
c) BLOB
d) NCLOB

Ans: c

13.Which of the following is a not Unicode-only datatype?

a) CHAR
b) NCHAR
c) NVARCHAR2
d) All of the above

Ans: a

14.How many columns are allowed in Oracle10g table?

a) 255

 b) 10000

 c) 1000

 d) there is no limit (infinite) 

Ans: d

15.What is the maximum length we can give to VARCHAR2( )?

 a) 2000

 b) 4000 

 c) 1000

 d) there is no limit (infinite)

Ans: b

16.Which data type(s) can hold a null value?

a) VARCHAR2( )
b) NUMBER( )
c) DATE
d) All of the above

Ans: d

17.Which of the following is a Unicode-only datatype?

a) Char

 b) NCHAR 

 c) VARCHAR2

 d) None

Ans: b

18.What would be the value stored in database, if 123.89 is stored in a column of datatype NUMBER(6,-2)? -2 means round to hundreds

a) 123
b) 100
c) 120
d) 123.9

Ans: b

19.Which of the following datatype is stored as an external file on the server?

a) BLOB
b) NCLOB
c) CLOB
d) BFILE

Ans: d

20.Which of the following SQL functions can operate on any datatype?

a) MAX
b) LOWER
c) LPAD
d) ADD_MONTHS

Ans: a

21.Which of the following can be stored in a NUMBER(8,2) datatype?

a) 999999.99
b) 999999.999
c) 9999999.99
d) 99999.999


Ans: c

22.Which of the following datatypes cannot be used with any of the built-in functions?

a) NUMBER
b) LONG RAW
c) VARCHAR2
d) BOOLEAN

Ans: d

23.Which datatype can be used for loop counters?

a) LONG
b) FLOAT
c) PLS_INTEGER
d) ROWID

Ans: c

24.Which datatype is used to store unstructured binary data outside the database?

a) BLOB
b) CLOB
c) NCLOB
d) BFILE

Ans: d

25.Which of the following SQL functions is used to convert a string from one CHARACTERSET to another?

a) CAST
b) CONVERT
c) TO_CHAR

Ans: b

26.Which of the following is a pseudocolumn?

a) ROWID ( SYSDATE, SYSTIMESTAMP,ROWID, ROWNUM, UID, USER, LEVEL, CURRVAL, NEXTVAL, ORA_ROWSCN, etc.)
b) NUMBER
c) CHAR
d) VARCHAR2

Ans: a

27.What is the output for the following query? select NULL + 5 from dual ;

a) NULL (“Any arithmetic expression containing a null always evaluates to null.”)
b) 5
c) Will give an Error
d) 0

Ans: a

28.What is the output for the following query?
Select round(15.193,-1) from dual;

a) 20
b) 10
c) 15.2
d) 15

Ans: a

29.Which of the following will slow down the query most:-

a) name=Ram
b) name like Ram%
c) name like %Ram%
d) None of the above

Ans: c

30.What is the output for the following query?
select NULL||’ORACLE L.1.1′ from dual ;

a) NULL
b) ORACLE L.1.1
c) A and B
d) None of the above

Ans: b

31.In SQL string length constraints for VARCHAR2 must be in range

a) 1 .. 2000
b) 1 .. 4000
c) 1 .. 32767
d) None of the above

Ans: b

32.select name from salesreps where sales between 1000 and 2000;

a) Query will display the name from the salesreps table whose sales is >1000 and sales < 2000

b) Query will display the name from the salesreps table whose sales is >=1000 and sales <= 2000

c) Query will display the name from the salesreps table whose sales is >=1000 and sales < 2000

Ans: b

33.Table A has 120 rows ; Table B has no rows .
How many rows will be returned by the following SQL statement
SELECT * FROM A,B;

a) 0
b) 120
c) 121
d) None of the above

Ans: a

34.If a table (table_name) contains the values 10,20,30,null,null for a column col1,What will the output of the below select statement. Select count(col1) from table_name;

a) 3
b) 5
c) 2
d) None

Ans: b

35.When does a foreign key constraint enforce domain integrity?

a) During inserts
b) During select
c) During optimization
d) During create

Ans: d

36.Which of the following query will print Even number of records ?

a) select * from emp where (rowid,1)
b) select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp)
c) select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
d) select * from emp where (rowid,0)

Ans: b

37.In NVL2(expr1,expr2,expr3), if expr1 is not null, then NVL2 returns

a) expr1
b) expr2
c) expr3
d) null

Ans: b

38.The EMP table contains these columns:
LAST NAME VARCHAR2(25)
SALARY NUMBER(6,2)

DEPARTMENT_ID NUMBER(6)
You need to display the employees who have not been assigned to any department.
You write the SELECT statement:
SELECT LAST_NAME, SALARY, DEPARTMENT_ID
FROM EMP
WHERE DEPARTMENT_ID = NULL;
What is true about this SQL statement?

a) The SQL statement displays the desired results.
b) The column in the WHERE clause should be changed to display the desired results.
c) The operator in the WHERE clause should be changed to display the desired results.
d) The WHERE clause should be changed to use an outer join to display the desired results.

Ans: a

39.What is true about ORDER BY clause?

a) The SQL statement displays the desired results.
b) The column in the WHERE clause should be changed to display the desired results.
c) The operator in the WHERE clause should be changed to display the desired results.
d) The WHERE clause should be changed to use an outer join to display the desired results.

Ans: a

40.What is true about ORDER BY clause?

a) Can appear only at the very end of the statement
b) Will accept the column name, aliases from the first SELECT statement
c) Will accept the positional notation
d) All of the above

Ans: d

41.Group functions ignore null values.

a) TRUE
b) FALSE

Ans: a

42.select 1,5 from dual
intersect
select 1,5 from dual;
What will be the output of the above statement?

a) 1 5
b) null null
c) 0 0
d) None of the above

Ans: a

43.What is the output of the below sql statement
select * from dual;

a) NULL
b) SYSDATE
c) ‘X’
d) Number of Tables

Ans:c

44.Which are true about aggregate functions?

a) You can use aggregate functions in any clause of a SELECT statement.
b) You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT statement.
c) You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns.
d) You can use aggregate functions on a table, only by grouping the whole table as one single group.

Ans:b

45.Examine the following statements.

Insert into tableXYZ values (1, 2, 3);
Create table ABC (sno CHAR(1));
Rollback;
What happens to the row inserted into tableXYZ?

a) Record available in the table
b) Record not available in the table
c) Record available in table with inconsistent state
d) none of the above

Ans: a

46.1 select 1 from dual
2 minus
3 select ‘a’ from dual ;
The above statement will through error on line

a) 1
b) 2
c) 3
d) None of the above

Ans: a

47.Which SQL function can be used instead of the IF construct?

a) Coalesce
b) Decode
c) Nullif
d) B and C

Ans: d

48.Which of the following is multiple-row comparison operator?

a) IN
b) ANY
c) ALL
d) All of the above

Ans: d

49.select 1,5 from dual
minus
select 1,5 from dual;
What will be the output of the above statement

a) 0 0
b) null null
c) No rows selected
d) None of the above

Ans: c

50.Evaluate the SQL statement:
SELECT ROUND(45.953, -1), TRUNC(45.936, 2) FROM Dual;
Which values are displayed?

a) 46 and 45
b) 46 and 45.93
c) 50 and 45.93
d) 45 and 45.93

Ans: c


1 Comment

Leave a Reply

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