TCS Digital Variable and Register 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!"]

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%

Completed

0/0

Accuracy

0%

Comments