SQL Data Types Questions and Answers
SQL Data Types MCQs : This section focuses on the "Data Types" of the SQL. These Multiple Choice Questions (mcq) should be practiced to improve the SQL skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Choose a data type to store weight of a person in kilograms with accuracy of 1 gram. As per wikipedia, Jon Brower Minnoch was the heaviest human ever recorded with a weight of 635kg.
A. NUMBER(3,3)
B. NUMBER(3,2)
C. NUMBER(6,2)
D. NUMBER(6,3)
View Answer
Ans : D
Explanation: NUMBER(6,3) a data type to store weight of a person in kilograms with accuracy of 1 gram
2. What is the maximum value that can be stored in NUMERIC(4,2)?
A. 9999.99
B. 99.9999
C. 99.99
D. 9.99
View Answer
Ans : C
Explanation: 99.99 is the maximum value that can be stored in NUMERIC(4,2)
3. Which of the following statements are TRUE?
A. Scale denotes number of digits allowed after decimal point
B. SQL performs rounding if user attempts to store a value that has higher scale than the data type
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: Both A and B is the following statements are TRUE.
4. Determine data type for the given column? Column Name: Price ; Description: Cost of an item in rupees and paise ; Example: 200.21
A. VARCHAR2(50)
B. NUMBER
C. NUMBER(5,2)
D. NUMBER(6)
View Answer
Ans : C
Explanation: NUMBER(5,2) is the data type for the given column.
5. Determine data type for the given column? Column Name: IFSC_Code ; Description: A 11 Character alphanumeric code that identifies a bank branch ; Example: SBIN0009044
A. VARCHAR2(50)
B. NUMBER
C. Char(11)
D. NUMBER(11)
View Answer
Ans : C
Explanation: Char(11) is the data type for the given column.
6. Determine the most suitable data type for the given column? Column Name: Profile_Image ; Description: Image of the employee
A. Clob
B. Blob
C. Varchar(100)
D. None of the above
View Answer
Ans : B
Explanation: Blob is the data type for the given column.
7. This set of Database Questions & Answers focuses on SQL Data Types and Schemas Dates must be specified in the format
A. mm/dd/yy
B. yyyy/mm/dd
C. dd/mm/yy
D. yy/dd/mm
View Answer
Ans : B
Explanation: yyyy/mm/dd is the default format in sql.
8. The user defined data type can be created using
A. Create datatype
B. Create data
C. Create definetype
D. Create type
View Answer
Ans : D
Explanation: The create type clause can be used to define new types.Syntax : create type Dollars as numeric(12,2) final; .
9. Values of one type can be converted to another domain using which of the following ?
A. Cast
B. Drop type
C. Alter type
D. Convert
View Answer
Ans : A
Explanation: cast (department.budget to numeric(12,2)). SQL provides drop type and alter type clauses to drop or modify types that have been created earlier.
10. In contemporary databases, the top level of the hierarchy consists of ______ each of which can contain _____
A. Catalogs, schemas
B. Schemas, catalogs
C. Alter typeEnvironment, schemas
D. Schemas, Environment
View Answer
Ans : A
Explanation: In contemporary databases, the top level of the hierarchy consists of Catalogs each of which can contain schemas.
11. Choose the most suitable data type in case multiple data types are possible for the column. Column Name: Gender ; Description: A single character; gender code, M or F Example: M
A. CHAR(11)
B. VARCHAR2(50)
C. CHAR(1)
D. VARCHAR2(1)
View Answer
Ans : C
Explanation: CHAR(1) is the most suitable data type in case multiple data types are possible for the column
12. Choose the most suitable data type in case multiple data types are possible for the column. Column Name: PIN_Code ; Description: Six digit numeric PIN code for any address in India ; Example: 560100
A. Integer
B. VARCHAR2(11)
C. CHAR(11)
D. Number(6)
View Answer
Ans : D
Explanation: Number(6) is the most suitable data type in case multiple data types are possible for the column
13. Choose the most suitable data type in case multiple data types are possible for the column. Column Name: Student_id ; Description: Unique number assigned to every Student ; Example: 100000
A. Integer
B. VARCHAR2(11)
C. CHAR(11)
D. Number(6)
View Answer
Ans : A
Explanation: Integer is the most suitable data type in case multiple data types are possible for the column
14. Choose the most suitable data type in case multiple data types are possible for the column.Column Name: Date_Of_Birth ; Description: Date of Birth of the employee ; Example: 1990/01/01
A. Timestamp
B. VARCHAR2(11)
C. Blob
D. Date
View Answer
Ans : D
Explanation: Date is the most suitable data type in case multiple data types are possible for the column
15. Many current-generation database applications need to store photographs, or of the order megabytes and gigabytes using
A. Large-index type
B. Large-object type
C. Large-location type
D. Large-locator type
View Answer
Ans : B
Explanation: Many current-generation database applications need to store photographs, or of the order megabytes and gigabytes using Large-object type.
16. SQL allows comparison operations on the data types i.e.
A. Date
B. Timestamp
C. Time
D. All of the above
View Answer
Ans : D
Explanation: SQL allows comparison operations on the all of the above data types .
17. Current date is returned by the method
A. system.date
B. current.date
C. machine.date
D. today.date
View Answer
Ans : B
Explanation: Current date is returned by the method current.date
18. Data types in SQL Server are organized into how many categories?
A. 6
B. 7
C. 8
D. 9
View Answer
Ans : A
Explanation: SQL Server offers six categories of data types for your use:-exact numeric, Unicode character strings, approximate numeric, Binary strings, Date and time and Character strings.
19. You want to track date and time of the last write access per row?
A. Add TIMESTAMP column to the table
B. Add a DATETIME column to the table and assign getdate() as the default value
C. Add a DATETIME column to the table and write a trigger that sets its value
D. Add a UNIQUEIDENTIFIER column to the table and use it with SQL Server's built-in functions
View Answer
Ans : A
Explanation: The correct answer is Add a DATETIME column to the table and write a trigger that sets its value.
20. In case of SQL Server 2005, binary data type can hold:
A. Fixed-length binary data with a maximum of 6000 bytes.
B. Fixed-length binary data with a maximum of 3000 bytes.
C. Fixed-length binary data with a maximum of 1024 bytes.
D. Fixed-length binary data with a maximum of 8000 bytes.
View Answer
Ans : D
Explanation: In case of SQL Server 2005, binary data type can hold Fixed-length binary data with a maximum of 8000 bytes.
Also check :
Discussion