TCS Digital Variables and Registers Quiz- 1

Question 1

Time: 00:00:00
What is the output of this C code?

#include <stdio.h>
void main()
{
static int i;
printf(“i is %d”, i);
}

1

1

Garbage Value

Garbage Value

Runtime Error

Runtime Error

Zero

Zero

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What is the output of this C code?

#include <stdio.h>
int *i;
int main()
{
if (i == NULL)
printf(“true\n”);
return 0;
}

true

true

true only if NULL value is 0

true only if NULL value is 0

Compile time error

Compile time error

Nothing

Nothing

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What is the output of this C code?

#include <stdio.h>
static int i;
void main()
{
int i;
printf(“i is %d”, i);
}

Garbage Value

Garbage Value

Runtime Error

Runtime Error

Nothing

Nothing

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What is the output of this C code?

#include <stdio.h>
static int x = 5;
void main()
{
x = 9;
{
int x = 4;
}
printf(“%d”, x);
}

9

9

4

4

5

5

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
The scope of an automatic variable is:

Within the block it appears

Within the block it appears

Within the blocks of the block it appears

Within the blocks of the block it appears

Until the end of program

Until the end of program

Within the block it appears & Within the blocks of the block it appears

Within the block it appears & Within the blocks of the block it appears

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Automatic variables are allocated space in the form of a:

stack

stack

queue

queue

priority queue

priority queue

random

random

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Which of the following is a storage specifier?

enum

enum

union

union

auto

auto

volatile

volatile

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Automatic variables are stored in

stack

stack

data segment

data segment

register

register

heap

heap

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What is the output of this C code?

#include <stdio.h>
int main()
{
register int i = 10;
int *q = &i;
*q = 11;
printf(“%d %d\n”, i, *q);
}

Depends on whether i is actually stored in machine register

Depends on whether i is actually stored in machine register

10 10

10 10

11 11

11 11

Compile time error

Compile time error

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Register storage class can be specified to global variables

True

True

False

False

Depends on the compiler

Depends on the compiler

Depends on the standard

Depends on the standard

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

Please login to submit your explanation

Start

Question 11

Time: 00:00:00
Register variables reside in

stack

stack

registers

registers

heap

heap

main memory

main memory

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

Please login to submit your explanation

Start

Question 12

Time: 00:00:00
Which of the following operation is not possible in a register variable?

Reading the value into a register variable

Reading the value into a register variable

Copy the value from a memory variable

Copy the value from a memory variable

Global declaration of register variable

Global declaration of register variable

All of the mentioned

All of the mentioned

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

Please login to submit your explanation

Start

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

Completed

0/0

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

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.

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.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects