Note: We have tried to upload as much as we can, all the question and answers might be shuffled - Please find the answer below each question, some answers might be wrong please review on the last date(some answers might be changed) if you find any wrong answer please comment down below.
Questions:
1.
#include <stdio.h>
int main()
{int x; x = 5;
if(x > 5)x -= 5;
else if(x >= 0)x += 00;
else if(x)x += 5;
else x -= 5;
printf("%d\n",x);
return 0;
}Select one:
A. None of the above
B. 10
C. -5
D. 5
E. 6
The correct answer is: 5
2.
What is the output of the following code?
#include "stdio.h"
extern int a=5;
main(){
void fun();
printf("\n a=%d",a);
fun();
return 0;
}
void fun()
{
int a;
printf(" in fun a=%d",a);
}Select one:
A. a=0 in fun a=5
B. Error
C. None
D. a=5 in fun a=0
The correct answer is: a=5 in fun a=0
3.
What is the output of following program?
#include <stdio.h>
void abc(int a, int b)
{
printf("%d%d",++a,++b);
}
int main()
{
int a=10;
abc(++a,a++);
abc(a++,++a);
printf("%d",a);
return 0;
}
Select one:
A. None
B. Error
C. 13 11 14 14 14
D. 13 11 14 15 14
Select one:
A. None
B. Error
C. 13 11 14 14 14
D. 13 11 14 15 14
The correct answer is: 13 11 14 15 14
4.
What should be the output:
void main()
{
int a = 10/3;
printf("%d",a);
}Select one:
A. 0
B. 3.0
C. 3.33
D. 3
The correct answer is:3
5.
#include <stdio.h>
int main()
{
int i;
if (printf("0"))
i = 3;
else
i = 5;
printf("%d", i);
return 0;
}Select one:
A. Error
B. 3
C. 03
D. None
The correct answer is: 03
6.
#include <stdio.h>
int main()
{
int i = 0;
switch (i)
{
case '0': printf("Hello");
break;
case '1': printf("world");
break;
default: printf("Helloworld");
}
return 0;
}Select one:
A. Hello
B. Helloworld
C. None of these
D. world
The correct answer is: Helloworld
7.
What will be output of following program?
#include <stdio.h>
void convention(int,int,int);
int main()
{
int a=5;
convention(a,++a,a++);
return 0;
}
void convention(int p,int q,int r)
{
printf("%d %d %d",p,q,r);
}Select one:
A. Error
B. None
C. 7 5 5
D. 7 7 5
The correct answer is: 7 7 5
8.#include<stdio.h>
void main()
{ int a=15; printf("%x", a); getchar();
}A. 15.0
B. 12
C. None of the above
D. f
E. c
The correct answer is: f
9.
What is the correct way to round off x, a float, to an int value?
Select one:
A. y=(int)(x+0.5)
B. y=(int)x+0.5
C. y=int(x+0.5)
D. y=(int)(int)x+0.5)
The correct answer is: y=(int)(x+0.5)
#include<stdio.h>
int main()
{
int i=10;
printf("i=%d", i);
{
int i=20;
printf("i=%d", i);
i++;
printf("i=%d", i);
}
printf("i=%d", i);
return 0;
}
Select one:
A. 10,10,20,21
B. None
C. Error
D. 10,20,21,10
A. 10,10,20,21
B. None
C. Error
D. 10,20,21,10
The correct answer is: 10,20,21,10