Datatype in C MCQs Exercise I


Ques 1 Datatype


Which is the following is not primitive datatype ?
  a) int
  b) float
  c) Array
  d) char


c is the correct option

An array, on the other hand, is not a primitive data type. It's a composite data structure that stores a collection of elements of the same data type. Each element in an array has a specific index or position, allowing you to access and manipulate individual elements within the collection. Arrays provide a way to organize and manage multiple related values under a single name.





Ques 2 Datatype


What is the range of the char ?
  a) -128 to 127
  b) -127 to 128
  c) -128 to 0
  d) -127 to 128


a is the correct option

A char data type typically stores signed integers and covers the range from -128 to 127. This holds true across most programming languages. It uses 1 byte of memory, and half of that goes to representing the sign. If you need non-negative values, use unsigned char (ranging from 0 to 255). While some systems might use 2 bytes for char, the standard representation and common range is -128 to 127.





Ques 3 Datatype


What is the range of the char ?
  a) 2 byte
  b) 4 byte
  c) 1 byte
  d) None of these


a is the correct option

The size of a char data type can vary depending on the system and compiler, but it is typically 1 byte. This allows it to represent integer values from -128 to 127. However, some systems might use 2 bytes for char, extending the range to -32768 to 32767. If you need to store unsigned characters (non-negative values), you can use the unsigned char type, which typically has a range of 0 to 255.





Ques 4 Datatype


Which of the following is not a data type in C?
  a) string
  b) int
  c) float
  d) double


a is the correct option





Ques 5 Datatype


What is the range of values that can be stored by an int data type in C?
  a) -2147483648 to 2147483647
  b) -32768 to 32767
  c) -9223372036854775808 to 9223372036854775807
  d) -1.7976931348623157e+308 to 1.7976931348623157e+308


a is the correct option





Ques 6 Datatype


What is the range of values that can be stored by a float data type in C?
  a) -32768 to 32767
  b) -2147483648 to 2147483647
  c) -9223372036854775808 to 9223372036854775807
  d) -3.4028234663852886e+38 to 3.4028234663852886e+38


d is the correct option





Ques 7 Datatype


What is the data type of the following expression: 2 + 3?
  a) int
  b) float
  c) double
  d) char


a is the correct option





Ques 8 Datatype


What is the data type of the following expression: 2.0 + 3.0?
  a) int
  b) float
  c) double
  d) char


c is the correct option





Ques 9 Datatype


What is the data type of the following expression: "Hello, world!"?
  a) int
  b) float
  c) string
  d) char*


d is the correct option