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
11.
Is it true that a function may have several declarations, but only one definition?
Select one:
A. True
B. False
The correct answer is: True
12.
#include <stdio.h>
B. \a ,\t,\n
C. Compiler error
D. \a \t \n
E. \a \\t \n
The correct answer is: \a ,\t,\n
13.
What is the output of following program?
The correct answer is: 9 7
14.
Find the output
15.
#include<stdio.h>
The correct answer is: 6 6
16.
#include<stdio.h>
Select one:
A. True
B. False
The correct answer is: True
12.
#include <stdio.h>
void main()
{ printf("\\a, \\t ,\\n");
}
Select one:
A. \\a,\\t,\\nB. \a ,\t,\n
C. Compiler error
D. \a \t \n
E. \a \\t \n
The correct answer is: \a ,\t,\n
13.
What is the output of following program?
#include <stdio.h>
#define sqr(i) i*i
main()
{
printf("%d %d", sqr(3), sqr(3+1));
}
Select one:
A. Error: macro cannot be defined in lower case
B. 9 7
C. None of the above
D. 9 16
A. Error: macro cannot be defined in lower case
B. 9 7
C. None of the above
D. 9 16
The correct answer is: 9 7
14.
Find the output
main()
{
int x = 10;
{
int x = 0;
printf("%d",x);
}
}
Select one:
A. 10
B. Compilation Error
C. 0
D. Undefined
The correct answer is: 0A. 10
B. Compilation Error
C. 0
D. Undefined
15.
#include<stdio.h>
int main() {
int a=11,b=5;
if(a=5) b++;
printf("%d %d", ++a, b++);
return 0;
}
Select one:
A. 12 7
B. 6 7
C. 5 6
D. 11 6
E. 6 6
A. 12 7
B. 6 7
C. 5 6
D. 11 6
E. 6 6
The correct answer is: 6 6
16.
#include<stdio.h>
int main()
{
int a = -2;
if(a)
{
printf("Hello");
}
else{
printf("Hai");
}
return 0;
}
Select one:
A. Error
B. Hello
C. Hai
D. None of these
The correct answer is: Hello
17.
#include <stdio.h>
The correct answer is: Hello
18.
What is the output of following program?
The correct answer is: None
19.
What will be output of following program?
The correct answer is: 3 3 1
A. Error
B. Hello
C. Hai
D. None of these
The correct answer is: Hello
17.
#include <stdio.h>
int main()
{
int i = 3;
switch (i)
{
case 0+1: printf("Welcome");
break;
case 1+2: printf("Hello");
break;
default: printf("Hai");
}
return 0;
}
Select one:
A. Welcome
B. Error
C. Hello
D. Hai
A. Welcome
B. Error
C. Hello
D. Hai
The correct answer is: Hello
18.
What is the output of following program?
#include <stdio.h>
int main()
{
int a=1;
void xyz(int , int);
xyz(++a,a++);
xyz(a++,++a);
printf("%d",a);
return 0;
}
void xyz(int x, int y)
{
printf("%d%d",x,y);
}
Select one:
A. 3 1 1 4 5
B. 3 1 4 4 5
C. Error
D. None
A. 3 1 1 4 5
B. 3 1 4 4 5
C. Error
D. None
The correct answer is: None
19.
What will be output of following program?
#include <stdio.h>
main() {
int i=1;
printf("%d%d%d",i,++i,i++);
}
Select one:
A. 3 3 1
B. 2 2 1
C. 1 2 2
D. 1 3 3
A. 3 3 1
B. 2 2 1
C. 1 2 2
D. 1 3 3
The correct answer is: 3 3 1
It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing. https://computersciencehomeworkhelpers.com
ReplyDelete