0% found this document useful (0 votes)
210 views9 pages

Updated Quiz1 C

1) The allowable range for integer constants in a 16-bit compiler is -32768 to 32767. 2) The statement printf ("%d", 10? 0? 5: 1: 12); will print 1. 3) The output of the program with if statement checking multiple variables separated by commas will be compiler dependent. 4) The value of a after a = square(2+3) will be 25, as square(x) is defined as x*x.

Uploaded by

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

Updated Quiz1 C

1) The allowable range for integer constants in a 16-bit compiler is -32768 to 32767. 2) The statement printf ("%d", 10? 0? 5: 1: 12); will print 1. 3) The output of the program with if statement checking multiple variables separated by commas will be compiler dependent. 4) The value of a after a = square(2+3) will be 25, as square(x) is defined as x*x.

Uploaded by

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

1) For 16-bit compiler allowable range for integer constants is ______?

a) -3.4e38 to 3.4e38
b) -32767 to 32768
c) -32768 to 32767
d) -32668 to 32667

2) The statement printf ("%d", 10? 0? 5: 1: 12); will print?


a) 10
b) 0
c) 12
d) 1

3) Predict the output of following program?


void main()
{
int a=10,b=20;
char x=1,y=0;
if(a, b, x, y)
{
printf("EXAM");
}
}
What is the output?
a) XAM is printed
b) exam is printed
c) Compiler Error
d) Nothing is printed

4) What will be the value of `a` after the following code is executed
#define square(x) x*x
a = square(2+3)
a) 25
b) 13
c) 11
d) 10

5) Predict the output of following program?


void main()
{
int a,b;
a=1, 3, 15;
b= (2, 4, 6);
printf("%d ",a+b);
}
a) 3
b) 21
c) 17
d) 7
e) Compiler error

6) Predict the output of following program?


void main()
{
if(printf("cquestion"))
printf("I know c");
else
printf("I know c++");
}
a) I know c
b) I know c++
c) cquestionI know c
d) cquestionI know c++

7) continue statement is used


a) to go to the next iteration in a loop
b) come out of a loop
c) exit and return to the main function
d) restarts iterations from beginning of loop.

8) Predict the output of following program?


#include<stdio.h>
int main(){
int a;
a=015 + 0x71 +5;
printf("%d",a);
return 0;
}
a) 130
b) 256
c) 131
d) 132

9) Predict the output of following program?


#include<stdio.h>
int main(){
int a=2;
a=a++ + ~++a;
printf("%d",a);
return 0;
}
a) 0
b) -1
c) 1
d) 2

10)Predict the output of following program?


#include<stdio.h>
int main(){
int i=5;
int a=++i + ++i + ++i;
printf("%d",a);
return 0;
}
a) 21
b) 15
c) 24
d) 18

11)Predict the output of following program?


#include "stdio.h"
int main()
{
char arr[10];
printf("%d", scanf("%s", arr));
/* Suppose that input value given for above scanf is "JIET" */
return 1;
}
a) 9
b) 1
c) 10
d) 100

12)What does the following C statement mean?


scanf("%4s", str);
Run on IDE and find the output
a) Read exactly 4 characters from console.
b) Read maximum 4 characters from console.
c) Read a string str in multiples of 4
d) Nothing

13) Find Output of following program?


#include<stdio.h>
int main()
{
printf("%d", printf("%d", 1234));
return 0;
}
a) 12344
b) 12341
c) 11234
d) 41234

14)What is the return type of getchar()?


a) int
b) char
c) unsigned char
d) float

15)Predict the output of following program?


#include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
What is the output of the above program?
a) 3
b) 4
c) 5
d) Compile-time error

16)Predict the output of following program?


#include <stdio.h>
int main()
{
//Assume sizeof character is 1 byte and sizeof integer is 4 bytes
printf("%d", sizeof(printf("JIET UNIVESE")));
return 0;
}
a) JIET UNIVESE12
b) JIET UNIVESE4
c) 4
d) Compile-time error

17)Predict the output of the below program:


#include <stdio.h>
int main()
{
int a = 1;
int b = 1;
int c = a || --b;
int d = a-- && --b;
printf("a = %d, b = %d, c = %d, d = %d", a, b, c, d);
return 0;
}
a) a = 0, b = 1, c = 1, d = 0
b) a = 0, b = 0, c = 1, d = 0
c) a = 1, b = 1, c = 1, d = 1
d) a = 0, b = 0, c = 0, d = 0

18)Predict the output of the below program:


#include <stdio.h>
int main()
{
printf("%d", 1 << 2 + 3 << 4);
return 0;
}
a) 112
b) 52
c) 512
d) 0

19)Predict the output of following program?


#include<stdio.h>
int main()
{
int a = 2,b = 5;
a = a^b;
b = b^a;
printf("%d %d",a,b);
return 0;
}
a) 5 2
b) 2 5
c) 7 7
d) 7 2

20)Predict the output of following program?


# include <stdio.h>
int main()
{
int x = 10;
int y = 20;
x += y += 10;
printf (" %d %d", x, y);
return 0;
}
a) 40 20
b) 40 30
c) 30 30
d) 30 40

21)Predict the output of following program?


#include <stdio.h>
int main()
{
int x = 10;
int y = (x++, x++, x++);
printf("%d %dn", x, y);
return 0;
}
a) 13 12
b) 13 13
c) 10 10
d) Compiler Dependent

22)Predict the output of following program?


#include <stdio.h>
int main()
{
int y = 0;
int x = (~y == 1);
printf("%d", x);
return 0;
}
a) 0
b) 1
c) negative Number
d) Compiler Error

23)Predict the output of following program?


#include<stdio.h>
int main(){
int i,j,k;
for(i=0,j=2,k=1;i<=4;i++){
printf("%d ",i+j+k);
}
return 0;
}
a) 3 4 5 6 7
b) 3 5 7 9 10
c) 3 5 6 7
d) 3 4 5 6 7 8

24)Predict the output of following program?


void main(){
int i,j=2;
for(i=0;i<=5,j>=0;i++){
printf("%d ",i+j);
j--;
}
a) 2 2 2
b) 1 1 1
c) 3 3 3
d) 1 2 3

25)Predict the output of following program?


#include<stdio.h>
int main(){
int i,j,k;
for(i=0,j=0,k=0;i<=5,j<=4,k<=3;i++,++j,k+=2)
printf("%d ",i+j+k);
}
a) 0 4
b) 0 3
c) 0 2
d) 0 5

26)What will be output when you will execute following c code?


#include<stdio.h>
void main(){
switch(5||2|1){
case 3&2:printf("C");
break;
case -~11:printf("C++");
break;
case 6-3<<2:printf("JAVA");
break;
case 5>=5:printf("C#");
}
}
a) C
b) JAVA
c) C++
d) Compilation error

27)What will be output when you will execute following c code?


#include<stdio.h>
void main(){
switch(6){
case 6.0f:printf("C");
break;
case 6.0: printf("C++");
break;
case 6.0L:printf("JAVA");
break;
default: printf(“C#");
}
}
a) C
b) C++
c) JAVA
d) Compilation error

28)What will be output when you will execute following c code?


#include<stdio.h>
void main(){
switch(5/2*6+3.0){
case 3:printf("C ");
break;
case 15:printf("C++");
break;
case 0:printf("JAVA");
break;
default:printf("C#");
}
}
a) C
b) C++
c) JAVA
d) Compilation error

29)#include<stdio.h>
int main()
{
char c = 125;
c = c+10;
printf("%d", c);
return 0;
}
a) 135
b) +INF
c) -121
d) -8

30)#include <stdio.h>
int main()
{
if (sizeof(int) > -1)
printf("Yes");
else
printf("No");
return 0;
}

a) Yes
b) No
c) Compiler Error
d) Runtime Error

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy