Question 1

Time: 00:00:00
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?

header files

header files

Iteration

Iteration

pre proccessor

pre proccessor

Comments

Comments

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

Obviously answer is \"comments\" only

PrepInsta User

why?

PrepInsta User

preprocessor directive

PrepInsta User

c

PrepInsta User

header files

PrepInsta User

header files

PrepInsta User

comments

PrepInsta User

no

PrepInsta User

The answer is header files

PrepInsta User

header files

PrepInsta User

header files

PrepInsta User

header files

PrepInsta User

pre processor

PrepInsta User

Comments in the codes are used to explain what is happening in the code. It is helpful as if one coder writes code he also writes comments so that other developers can understand easily about the coding logic.

PrepInsta User

comments

PrepInsta User

Sir how the ans came

PrepInsta User

header file is the correct answer as we can use the #include header file

PrepInsta User

comments

PrepInsta User

comments

PrepInsta User

comment

PrepInsta User

Preprocessor

PrepInsta User

header files

Question 2

Time: 00:00:00
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.
integer a
pointer c, d
a = 30c = &a
c = &a
d = c
a = a + 10
print *c

30

30

40

40

4165

4165

4166

4166

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

*c points to the value of a; so given a=30 output is 40. Had it been to print only c then the output would have been the address of a that is 4165

PrepInsta User

check the pic

PrepInsta User

A is assigned as 30 initially Then C contain the adress of A Then d stores c which means value at the adress which c holds that means 30.. Then a is updated and become 40.. Hence when *C is printed then value at A is printed..

PrepInsta User

Actually *c=*(&a) a=30+10 a=40 There fore a=40

PrepInsta User

int a; *c, *d; a = 30; c = &a; //pointer c has the memory location of a i.e 4165 d = c ; //d is 4165 a = a +10; print *c //*c is a defererence pointer which gives the value of the variable to which it is pointing at, so 40 is the answer

PrepInsta User

output is 40

PrepInsta User

#include int main() { int a; int *c, *d; a=30; c = &a; d=c; a=a+10; printf(\"%d\",c); } o/p: 4165 i.e is the address of c but is we print ----- printf(\"%d\",*c); then o/p is : 40

PrepInsta User

As c is assigned with address of a,a is updated , so when we print c, updated value of a will be printed. a=30 c=&a a=a+10 /a=40----> c=30 print(*c)

PrepInsta User

4165

PrepInsta User

40

PrepInsta User

4165

PrepInsta User

a=30; c=&a; so c=4165; d=4165; c=4165

PrepInsta User

4165

PrepInsta User

why?

PrepInsta User

why?

Question 3

Time: 00:00:00
A data type is stored as a 6 bit signed integer. Which of the following cannot be represented by this data type?

-12

-12

32

32

18

18

6

6

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

-12 , in question they mention signed integer

PrepInsta User

i think -12

PrepInsta User

-12

Question 4

Time: 00:00:00
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.

7

7

28

28

72

72

196

196

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

how it can be 35. someone pls explain

PrepInsta User

In binary, there are only two possibilities- zero and one.  Thus, looking at the powers of 2, we realize that 32 is the closest exponential result of 2 to 28, where 2^5 = 32. Hence, to cover all the possibilities, we need 5 bits at the least. But there are seven letters. Thus, the number of bits we require is 7 * 5 = 35 bits  Read more on Brainly.in - https://brainly.in/question/3672631#readmore

PrepInsta User

35

PrepInsta User

196

PrepInsta User

didn\'t understand please explain anyone

PrepInsta User

196

Question 5

Time: 00:00:00
A 10-bit unsigned integer has the following range:

0 to 1000

0 to 1000

0 to 1024

0 to 1024

0 to 1023

0 to 1023

0 to 1025

0 to 1025

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

0 to 1023

PrepInsta User

0 to 1023

Question 6

Time: 00:00:00
Parul takes as input two numbers: a and b. a and b can take integer valuesbetween 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 = 200 b = 10

a = 200 b = 10

a = 10 b = 200

a = 10 b = 200

a = 100 b = 50

a = 100 b = 50

a = 50 b = 100

a = 50 b = 100

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

option B gives wring output for given range

PrepInsta User

Option A

Question 7

Time: 00:00:00
Which is used to convert source code to target language

Linker

Linker

Loader

Loader

Executer

Executer

Compiler

Compiler

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

compiler

PrepInsta User

compiler

PrepInsta User

D

Question 8

Time: 00:00:00
Tricha wants to store a list of binary data.Which of following data types should she use?

Integer

Integer

Float

Float

Character

Character

Boolean

Boolean

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

binary data means either 0 or 1 boolean value are 0\'s and 1\'s so answer boolean

PrepInsta User

D

Question 9

Time: 00:00:00
Which of the following options is an exception to being a part of composite data types?

Arrays

Arrays

Structure

Structure

Union

Union

Stacks

Stacks

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

stack

PrepInsta User

Union

Question 10

Time: 00:00:00
Which data type is most suitable for storing a number 65000 in a 32-bit system?

short

short

int

int

long

long

double

double

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

PrepInsta User

Long

PrepInsta User

65000 comes in the range of short (16-bit) which occupies the least memory. Signed short ranges from -32768 to 32767 and hence we should use unsigned short.

["0","40","60","80","100"]
["Need more practice! \r\n \r\n \r\n","Keep trying! \r\n \r\n \r\n","Not bad! \r\n \r\n \r\n","Good work! \r\n \r\n \r\n","Perfect! \r\n \r\n \r\n"]

Buy TCS Prog. Logic (C MCQ) Paid Materials

Join TCS Online Classes

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments

2 comments on “TCS Data Types Quiz-1”