Search Placementyogi.com
 

C Basics Objective Questions and Answers

  :: Topics ::

1

What is the output of:

#include<stdio.h>
int main()
{
	int x=40;
	{
		int x=20;
		printf("%d",x);
	}
	printf("%d",x);
	return 0;
}
A.

40 40

B.

20 40

C.

40 20

D.

Compilation Error

See Answer & Explanation Lets Discuss
Correct answer is : B
Explanation

The variable declared inside the  inner block replaces the x declared in the outer block, hence it prints 20 at 1st printf.

When the inner block ends, the scope of inner x also ends and hence the value of x becomes 40 in the outer block.

 
2

What is the output of the following program:

void main( )
{
int i = 2, j = 3, k, l ;
float a, b ;
k = i / j * j ;
l = j / i * i ;
a = i / j * j ;
b = j / i * i ;
printf( "%d %d %f %f", k, l, a, b ) ;
}
A.

3 3 2 2

B.

3 3 0 2.000000

C.

3 2 0.000000 3.000000

D.

0 2 0.000000 2.000000

See Answer & Explanation Lets Discuss
Correct answer is : D
Explanation

RHS is evaluated first and then the value is promoted to float, float arithmetic is not used here as there is no variable on the RHS that is float.
The Float is printed with decimal followed by 6 zeros.

 
3

What is the output of:

main( )
{
int a, b ;
a = -3 - - 3 ;
b = -3 - - ( - 3 ) ;
printf ( "a = %d b = %d", a, b ) ;
}
A.

-3 3

B.

-6 0

C.

0 -6

D.

None of the Above

See Answer & Explanation Lets Discuss
Correct answer is : C
Explanation

-3 - -3= -3 + 3 = 0
-3 --(-3)= -3 - 3 = -6

 
4

C language was developed by?

A.

Dennis Richie

B.

Martin Richards

C.

Bill Gates

D.

Ken Thompson

See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

No Explanation needed !!!

 
5

A character variable can store  x characters at a time:

A.

1 character

B.

8 character

C.

256 character

D.

None of the above

See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

A character variable is of 1 byte length and can store just 1 character at a time

 
 

Crackbill Ad
Hide Page Information

C Objective Questions and Answers

Here you can find C Basics interview questions with answers and explanation.

Where can I practice C Objective Questions

Placement yogi will be launching online test for C objective Questions very shortly , in the mean time practice the questions given in the website

Why C Basics?

In this section you can learn and practice C Basics (Questions with Answers) to improve your skills in order to face the interview, competitive examination and various entrance test (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

Where can I get C Basics Questions and Answers with Explanation?

PlacementYogi provides you lots of fully solved C Basics questions and answers with explanation. Fully solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, freshers can download C Basics quiz questions with answers as PDF files and eBooks.

Where can I get C Basics Interview Questions and Answers (objective type, multiple choice)?

Here you can find objective type C Basics questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.

How to solve C Basics problems?

You can easily solve all kind of questions based on C Basics by practicing the exercises (including shortcut methods to solve problems) given below.