SQL Server Questions and Answers – Data Types

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “Data Types”.

1. Which of the following is a large object data type?
a) varchar(max)
b) varbinary(max)
c) nvarchar(max)
d) image
View Answer

Answer: d
Explanation: In SQL Server, based on their storage characteristics, some data types are designated as large value data types and large object data types.

2. Data types in SQL Server are organized into how many categories?
a) 6
b) 8
c) 9
d) 10
View Answer

Answer: 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.

3. Exact Numeric data type is ___________
a) bigint
b) int
c) smallmoney
d) all of the mentioned
View Answer

Answer: d
Explanation: Exact numeric data types store numeric values where you wish to specify the precision of the variable. They may include integer or decimal numbers.
advertisement
advertisement

4. ntext data type falls under which category?
a) Exact numerics
b) Character strings
c) Unicode character strings
d) None of the mentioned
View Answer

Answer: c
Explanation: ntext is fixed and variable-length data type for storing large non-Unicode and Unicode character.

5. A column of type __________ may contain rows of different data types.
a) ntext
b) date
c) smallmoney
d) sql_variant
View Answer

Answer: d
Explanation: sql_variant is data type that stores values of various SQL Server-supported data types.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. 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

Answer: a
Explanation: The correct answer is Add a DATETIME column to the table and write a trigger that sets its value.

7._________ is a spatial data type.
a) geometry
b) sql_variant
c) cursor
d) all of the mentioned
View Answer

Answer: b
Explanation: SQL Server supports the geometry and geography data types for storing spatial data. These types support methods and properties that allow for the creation, comparison, analysis, and retrieval of spatial data.
advertisement

8. Which of the following data type is not present in SQL Server?
a) bit
b) boolean
c) hierarchyid
d) geography
View Answer

Answer: b
Explanation: SQL Server doesn’t have a Boolean data type, at least not by that name. To store True/False, Yes/No, and On/Off values, use the bit data type. It accepts only three values: 0, 1, and NULL.

9. ______________ is monetary data type in SQL Server.
a) Smallmoney
b) sql_variant
c) Cursor
d) None of the Mentioned
View Answer

Answer: a
Explanation: Monetary data types are data types that represent monetary or currency values such as smallmoney and money.
advertisement

10. Which of the data type has a storage size of 8 bytes?
a) timestamp
b) uniqueidentifier
c) real
d) smallmoney
View Answer

Answer: a
Explanation: uniqueidentifier, real and smallmoney data types have storage size of 16,4 and 4 bytes respectively.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.