0% found this document useful (0 votes)
141 views2 pages

Cquiz 1

This document contains questions about C programming concepts like data types, operators, and format specifiers. The key points are: I. Statements I, II, V, VI, VII will result in errors as char, float, and double cannot have modifiers like short or long. II. The output of the given program will be 5 as sizeof(i-a) is 4 and sizeof(b) is 1. III. The statement "printf( “%d”, ++num++ );" will result in an error as it requires an L-value. IV. Array is considered a derived data type. V. The output of the given program will be "num =

Uploaded by

sim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views2 pages

Cquiz 1

This document contains questions about C programming concepts like data types, operators, and format specifiers. The key points are: I. Statements I, II, V, VI, VII will result in errors as char, float, and double cannot have modifiers like short or long. II. The output of the given program will be 5 as sizeof(i-a) is 4 and sizeof(b) is 1. III. The statement "printf( “%d”, ++num++ );" will result in an error as it requires an L-value. IV. Array is considered a derived data type. V. The output of the given program will be "num =

Uploaded by

sim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Which are the following statements will result in error.

int main()
{
short char c1; // I.
long char c2; // II.
short int num1; // III.
long int num2; // IV.
short float f1; // V
long float f2; // VI
short double d1; // VII
long double d2; // VIII
}

3. I, II, V, VI, VII

What is the output of following program?


#include<stdio.h>
int main()
{
int a=10,i = 20;
char b;
printf(“%d\n”,(sizeof(i-a)+sizeof(b)));
return 0;
}

3. 5

Which of the following statement is correct about the code snippet given below?

num = 5;
printf( “%d”, ++num++ );

3. The code will result in L – value required

4. Which of the following can be considered as a derived data type ?


Answers
1. array

5. #include <stdio.h>
int main()
{
int num = 25;
num = !num > 23;
printf("num = %d", num);
}
Answers

2. num = 0

6. What is the use of putchar()?


Answers
1. To write a character always to stdout
How many numbers can print after a point using %.2f
Answers
1. 2

What will be the output?


#include<stdio.h>
int main(void)
{
int j=6;
float f=20.8f;
double d=44.6;
printf("\n%u %u %u %u",sizeof(j),sizeof(6),sizeof('a'),sizeof(20.8f));
printf("\n%u %u %u %u",sizeof(44.6), sizeof(j++), sizeof(j + --f), sizeof(j +
44.6));
printf("\n %.2f %.2f",f,d);
return 0;
}
Answers

2. 4 4 4 4 8 4 4 8 20.80 44.60

What will the output of the following:


int main()
{
int a=1,b=-1,c=2,d;
c = sizeof(++b);
d = a-- && b++ || c++;
printf("a=%d b=%d c=%d z=%d\n",a,b,c,d);
}
Answers

3. a=0 b=0 c=4 d=1

0. int main()
{
int a = 1, b=1,c=1,d;
d = b++ && ++a == --c ;
printf("d = %d",d);
}
Answers
1. d = 0

You might also like