TCS Data Type Questions with Solutions

1.Neelam wants to share her code with a colleague, who may modify it. Thus she wants to include the date of the program creation, the author and other she wants to include the date of the program creation, the author and other information with the program. What component should she use?
A.Header files
B.Iteration
C.Comments
D.Preprocessor directive
Answer: D

2.What is the output of the following code statements? The compiler saves the first integer at the memory location 4165 and the rest at consecutive memory spaces in order of declaration. Integer is one byte long.
A.30
B.4165
C.40
D.4166
Answer: C

3.A data type is stored as an 6 bit signed integer. Which of the following cannot be represented by this data type?
A. -12
B. 0
C.32
D.18
E.64
Answer: c

4.A language has 28 different letters in total. Each word in the language iscomposed of maximum 7 letters. You want to create a data-type to store a word ofthis language. You decide to store the word as an array of letters. How many bits will you assign to the data-type to be able to store all kinds of words of the language.
a.7
b.35
c.28
d.196
Answer:  b

5. A 10-bit unsigned integer has the following range:
a.0 to 1000
b.0 to 1024
c.1 to 1025
d.0 to 1023
Answer: D

6.Parul takes as input two numbers: a and b. a and b can take integer values between 0 and 255. She stores a, b and c as 1-byte data type. She writes the following code statement to process a and b and put the result in c. c = a + 2*b To her surprise her program gives the right output with some input values of a and b, while gives an erroneous answer for others. For which of the following inputs will it give a wrong answer?
a. a = 10 b = 200
b. a = 200 b = 10
c. a = 50 b = 100D
d. a = 100 b = 50
Answer: a

7.Which is used to convert source code to target language
a. linker
b. compiler
c. executer
d. loader
Answer: b

8. Tricha wants to store a list of binary data.Which of following data types should she use?
a. Integer
b. Float
c. Character
d. Boolean
Answer: d

9.Which of the following options is an exception to being a part of composite data types?
a. Union
b. Array
c. Structure
d. Stack
Answer: d

10. The datatype is store as 6 but unsigned integer. Which of the following can’t be represented by the this datatype:
a. -12
b. 0
c. 32
d. 18
Answer: a