Вы находитесь на странице: 1из 19

1)

a) 4
b) 8
c) 14
d) compilation error
.

2) What will be output if you will execute following c code?

a) 15
b) 16
c) 17
d) 18
.

3) What will be output if you will execute following c code?

a) 0
b) -1
c) 1
d) Garbage
.
4) What is the output of the following code?

a) a=5 in fun a=0


b) a=0 in fun a=5
c) a=5 in fun a=5
d) a=0 in fun a=0
.
5) What is the output of this C code?

a) a after loop
b) a a after loop
c) after loop
d) None of the mentioned
.
6) What is the output of this C code?

a) Compile time error


b) Whatever character getchar function returns
c) Ascii value of character getchar function returns
d) 2
.

7) What will be output if you will compile and execute the following c code?

a) 2 -6 5
b) 2 -6 1
c) 2 2 1
d) Compiler error
.
8) What will be output if you will compile and execute the following c code?

a) 0 0 0 0
b) Garbage Value
c) 102 56 -80 32
d) 102 102 -90 64
.

9) What will be output if you will compile and execute the following c code?

a) -51 -52 -52 -52 -52 -52 20 64


b) 51 52 52 52 52 52 20 64
c) Eight garbage values
d) Compiler error
.
10) What will be output if you will compile and execute the following c code?

a) c question bank
b) c
c) bank
d) cquestionbank
.

11) What will be output if you will compile and execute the following c code?

a) c-pointer
b) c-point
c) cpointer null null
d) c-point
.
12) What will be output if you will compile and execute the following c code?

a) 0
b) 1
c) Garbage value
d) Compiler error
.

13) What will be output if you will compile and execute the following c code?

a) 3
b) 21
c) 17
d) 7
.
14) What will be output if you will compile and execute the following c code?

a) 0
b) 2
c) 23
d) Compiler error
.

15) What will be output if you will compile and execute the following c code?

a) 5
b) 3
c) 1
d) equal
.
16) What will be output if you will compile and execute the following c code?

a) 25 25
b) 025 0x25
c) 12 42
d) 31 19
.

17) What will be output if you will compile and execute the following c code?

a) union is power of c
b) unionispower of c
c) union is Power of c
d) Compiler error
.

18) When new data are to be inserted into a data structure, but there is no available space; this situation is
usually called____________.
a) underflow
b) overflow
c) houseful
d) saturated
.
19)

a) Google 35000.000000
b) TCS 15000.000000
c) IBM 25000.000000
d) null 15000.000000
e) Google null
.

20)

a) 2 98 3 513 29 73 0 -1
b) 2 98 3 513 30 73 1 -1
c) 2 99 3 513 29 73 1 -1
d) 2 98 3 513 29 73 1 -1
e) Compilation error
.
Question 1

What is the output of the following C code ?

int func(int num)


{
int count = 0;
while (num)
{
count++;
num >>= 1;
}
return (count);
}
int main()
{
func(323);
}
Choices (With Correct Answers)
9
13
6
3

Question 2

What is the output of the following code snippet ?

#include<stdio.h>
int main()
{
typedef int arr[5];
arr arr1 = {10,20,30,40,50};
int i;
for(i=0; i<4; i++)
printf("%d,", arr1[i]);
return 0;
}
Choices (With Correct Answers)
10, 20, 30, 40
10, 20, 30, 40, 50
No output
Error: Cannot use typedef with an array

Question 3

Which of the following is not possible?

Choices (With Correct Answers)


A structure variable pointing to itself.
A structure variable pointing to another structure variable of same type.
Two different type of structure variable pointing at each other.
None of these.

Question 4

What is the output of the following code snippet

#include <stdio.h>
void main()
{
int x = 97;
int y = sizeof(x++);
printf("y is %d", y);
}
Choices (With Correct Answers)
4
5
97
Compilation Error

Question 5

What is the output of the following code snippet ?


#include<stdio.h>
void main ()
{
int a=5;
if(a==5)
{
a=~a+5<<1;
printf("%d",a);
}
else
{
a=~a;
}
}
Choices (With Correct Answers)
0
-2
6
None of the above

Question 6

Which of the following is not a standard C Library?


Choices (With Correct Answers)
errno.h
setjmp.h
signal.h
retarg.h

Question 7

What is the output of the following C code ?

#include<stdio.h>
#include<stdarg.h>

void fun(char *msg, ...);


int main ()
{
fun("Codeground", 2 , 7 , 8 , 10, 20);
return 0;
}
void fun(char *msg, ...)
{
va_list ptr;
{
int num;
va_start(ptr, msg);
num = va_arg(ptr, int);
num = va_arg(ptr, int);
printf("%d", num);
}
}
show less
Choices (With Correct Answers)
Codeground 2 , 7 , 8 , 10
7
Codeground 2 , 7
2 , 7 , 10 , 20

Question 8

What value strcmp() function returns when two strings are the same?
Choices (With Correct Answers)
0
1
0.5
2

Question 9

What is the following program doing?

#include<stdio.h>
main()
{
FILE *stream=fopen("a.txt",'r');
}
Choices (With Correct Answers)
Trying to open “a.txt” in read mode
Trying to open “a.txt” in write mode.
Compile error
“stream” is an invalid identifier

Question 10

What is the output of the following C code ?

#include<stdio.h>
#include<string.h>
void fun(char *p)
{
p=(char *) malloc(6);
strcpy(p,"Code");
}
void main( )
{
char *p="Ground";
fun(p);
printf("%s",p);
}
Choices (With Correct Answers)
Code
Ground
CodeGround
Compilation Error

Question 11

What is the output of the following C code ?

#include<stdio.h>
void main()
{
int code[]={1,2,3,4};
printf("%d", -2[code]);
}
Choices (With Correct Answers)
0
-6
-3
Compilation Error

Question 12

What will be the output when you execute the following c code?

#include<stdio.h>
void main()
{
int const SIZE=5;
int expr;
double value[SIZE]={2.0,4.0,6.0,8.0,10.0};
expr=1|2|3|4;
printf("%f",value[expr]);
}
Choices (With Correct Answers)
2.000000
4.000000
8.000000
Compilation Error

Question 13

What is the output when you compile and run the code?

#include<stdio.h>
void main()
{
printf("%d",printf("CODEGROUND"));
getch();
}
Choices (With Correct Answers)
CODEGROUND12
CODEGROUND11
CODEGROUND10
Compilation Error
Question 14

What will be the output of the code ?

#include<stdio.h>
int main()
{
int printf=12;
printf("%d",printf);
return 0;
}
Choices (With Correct Answers)
12
Compilation Error
0
5

Question 15

What will be the output of the code ?

#include<stdio.h>
int main(){
int _=3;
int __=9;
int ___;
___=_+__;
printf("%i",___);
return 0;
}
Choices (With Correct Answers)
9
15
12
Compilation Error

Question 16
what will be the output of the code ?

#include <stdio.h>
#define MULTIPLY(a, b) a*b
int main()
{
printf("%d", MULTIPLY(3+6,2+3));
return 0;
}
Choices (With Correct Answers)
12
45
18
21

Question 17

Which of the following is not a derived data type in c?

Choices (With Correct Answers)


Function
Enumeration
Pointer
Array

Question 18

Which of the following is integral data type?

Choices (With Correct Answers)


char
float
double
void
Question 19

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

#include<stdio.h>
int main()
{
double num=6.9;
int var=4;
printf("%d\t",sizeof(!num));
printf("%d\t",sizeof(var=12/2));
printf("%d",var);
return 0;
}
Choices (With Correct Answers)
426
444
225
246

Question 20

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

#include<stdio.h>
int main()
{
printf("%d\t",sizeof(90000));
printf("%d\t",sizeof(18.5));
printf("%d",sizeof('C'));
return 0;
}
Choices (With Correct Answers)
442
884
484
844

Вам также может понравиться