SQL MCQ - SQL Data Type
11. 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
12. 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.
13. 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.
14. 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.
15. 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
16. 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.
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