Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: Basic Concepts

Home > C Programming > Basic Concepts > General Questions

21. What is the output of the following 'C' program?

#include
void main()
{
printf("%c", "abcdefgh"[4]);
}

Answer: Option B

Explanation:

printf("%c","abcdefgh"[4]);............simply means the character at 4th index should be displayed.

Hence, the output is e.

Workspace


Tags:  No Tags on this question yet!

22. What is the output of the following 'C' program ?

#include
void main()
{
char ch = 'A';
printf ("%d%d",sizeof(ch),sizeof('A'));
}

Answer: Option C

Explanation:

Here, 'ch' is a character type variable. 

The size of char is 1 byte, hence sizeof(ch) is equal to 1.

Whereas, 'A' is a character constant, which is seen as an int. We know the size of int is 4 bytes hence, sizeof('A') is equal to 4.

Therefore, the output is 1 4.

Workspace


Tags:  No Tags on this question yet!

23. What is the output of the following 'C' program?

#include
void main()
{
printf("\n%d%d%d",sizeof("3"),sizeof("3"),sizeof (3));
}

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

24. What is the output of the following 'C' program?

#include
void main()
{
printf("\n%x", -1 >> 4);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

25. What is the output of the following 'C' program ?

#include
void main()
{
unsigned int num;
int c = 0;
scanf("%u", &num);
for(; num; num >>=1)
{
if(num & 1)
c++;
printf ("%d", c);
}
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

26. What is the output of the following 'C' program?

#include
void main()
{
printf("%d", printf("tim"));
}

Answer: Option B

Explanation:

First, tim is printed. Then, we know that printf() function returns the number of characters as argument. Here, 'tim' contains 3 characters, so 3 will be printed alongwith.

Hence, the output is tim3.

Workspace


Tags:  No Tags on this question yet!

27. What is the output of the following program ?

nt main()
{
char x, y, z;
printf("%d", scanf ("%c%c%c", &x, &y, &z));
return 0;
}

Note: "abc" as input

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

28. What is the output of the following program ?

#include
int main()
{
int a;
if (a=0)
printf("a is zero");
else
printf ("a is not zero");
return 0;
}

Answer: Option C

Explanation:

Here, inside if we are actually initializing a=0, and we know that "0 is not equal to 0" will result to False, hence if block won't get executed.

Therefore, else block will get executed and the output will be a is not zero

Workspace


Tags:  No Tags on this question yet!

29. #include
void main()
{
char c=' ',x,convert(z);
getc(c);
if((c>='a') && (c<='z'))
x=convert(c);
printf("%c",x);
}
convert(z)
{
return z-32;
}

Answer: Option D

Explanation:

Declaration of convert and format of getc() are wrong.

Workspace


Tags:  No Tags on this question yet!

30. What is the output of the following C Program?

#include
int swap(int *a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
void main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y = %d\n",x,y);
}

Answer: Option A

Explanation:

This is one way of swapping two values.

Workspace


Tags:  No Tags on this question yet!



Most Popular Qs.

Latest MCQ Qs.