C Programming MCQ Questions and Answers on Data Types and Storage Classes 3

Image

Learn C Data Types and Storage Classes with MCQ Questions and Answers. Find questions on types of Storage Classes like Life, Scope and the default value of variables. Easily attend exams after reading these Multiple Choice Questions.

Go through C Theory Notes on Data Types and Storage Classes before studying questions.



1) Choose a correct statement regarding automatic variables.
A) #include<stdio.h>
main()

{
	auto int a;

	printf("%d", a);
}

//output is compiler error. a is not initialized.
B) #include<stdio.h>
main()

{
	auto int a;

	printf("%d", a);
}

//output = 0
C) #include<stdio.h>
main()

{
	auto int a;

	printf("%d", a);
}

//output = null
D) #include<stdio.h>
main()

{
	auto int a;

	printf("%d", a);
}

//output = some random number
Answer [=]
Answer[=]
2) What is the output of the program.? #include<stdio.h>
int main()
{
	printf("Hello Boss.");
}
A) Hello Boss.
B) hello boss
C) No output
D) Compiler error
Answer [=]
Answer[=]
3) What is the output of the program.?
int main()
{
	auto int a=10;
	{
		auto int a = 15;
		printf("%d ", a);
	}
	printf("%d ", a);
	return 1;
}
A) 10 10
B) 10 15
C) 15 10
D) Compiler error
Answer [=]
Answer[=]
4) What is the output of the program.?
int main()
{
	register a=10;
	{
		register a = 15;
		printf("%d ", a);
	}
	printf("%d ", a);
	
	return 20;
}
A) 15 20
B) 15 10
C) 10 15
D) 15 15
Answer [=]
Answer[=]
5) What is the output of the C Program statement.?
register int b;
prinf("%d", b);
A) null
B) 0
C) random integer number
D) random real number
Answer [=]
Answer[=]
6) What is the output the program.?
int main()
{
	register a=80;
	auto int b;
	b=a;
	printf("%d ", a);
	printf("%d ", b);
	
	return -1;
}
A) Compiler error. You can not assign register value to int variable.
B) 80 80
C) 80 0 Register value can not be copied.
D) Compiles, but output is none.
Answer [=]
Answer[=]
7) What is the output of the program.?
void myshow();

int main()
{
	myshow();
	myshow();
	myshow();
}

void myshow()
{
	static int k = 20;
	printf("%d ", k);
	k++;
}
A) 20 20 20
B) 20 21 21
C) 20 21 22
D) Compiler error.
Answer [=]
Answer[=]


 

8) What is the output of the program.? #include<stdio.h>
static int k;

int main()
{
	printf("%d", k);
	
	return 90;
}
A) -1
B) 0
C) 90
D) Compiler error
Answer [=]
Answer[=]
9) What is the output of the program.?
int main()
{
	register k = 25;
	printf("%d", &k);
	
	return 90;
}

A) prints of address of variable k.
B) 25
C) 0
D) Compiler error
Answer [=]
Answer[=]
10) The statement below is .....a
extern int p;
A) Declaration
B) Definition
C) Initialization
D) None of the above
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Some good C Books

Book Price
1. C: The Complete Reference  Check Price
2. Let Us C Check Price
3. Programming in ANSI C Check Price
4. The C Programming Language Check Price

We may get some affiliate commission for the above purchases.