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

1. Which of the following statements should be used to obtain a remainder after dividing 3 by 2 ?

A. rem = 3.00 % 2.00;

B. rem = 3/2;

C. rem = 3%2;

D. Remainder cannot be obtain ininteger division.


View Answer:

Answer: Option C

2. Which of the following special symbol allowed in a variable name?


A. * (asterisk) B. | (pipeline)

C. - (hyphen) D. _ (underscore)
View Answer:

Answer: Option D

3. By default a real number is treated as a


A. float B. double

C. long double D. far double


View Answer:

Answer: Option B

4. Which of the following is not user defined data type?

1:
struct book
{
char name[10];
float price;
int pages;
};

2:
long int l = 2.35;
A. 1 B. 2

C. None of the mentioned D. Both 1 and 2


View Answer:

Answer: Option B

5. Is the following statement a declaration or definition?


extern int i;

A. Declaration B. Definition

C. Function D. Error

View Answer:

Answer: Option A

6. Identify which of the following are declarations

1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);

A. 1 B. 2

C. 1 and 3 D. 3
View Answer:

Answer: Option C

7. In the following program where is the variable a getting defined and where it is getting declared?

#include<stdio.h>
#include<conio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
getch();
}
int a=20;

A. extern int a is declaration, int a = 20 is the definition

B. int a = 20 is declaration, extern int a is the definition

C. int a = 20 is definition, a is not defined

D. a is declared, a is not defined


View Answer:

Answer: Option A

8. When we mention the prototype of a function?


A. None of the mentioned B. Declaring the function

C. Prototyping the function D. Calling the function


View Answer:

Answer: Option B

9. How many times "PDS" is get printed?

#include<stdio.h>
#include<conio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("PDS");
}
return 0;
getch();
}

A. Infinite times B. 11 times

C. 0 times D. 10 times
View Answer:

Answer: Option C

10. How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
#include<conio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf("%c %d\n", j, j);
j++;
}
return 0;
getch();
}
A. Infinite times B. 255 times

C. 256 times D. 254 times


View Answer:

Answer: Option B

11. Which of the following is not logical operator?


A. & B. &&

C. || D. !
View Answer:

Answer: Option A

12. In mathematics and computer programming, which is the correct order of mathematical operators
?
A. Addition, Subtraction, Multiplication, Division
B. Division, Multiplication, Addition, Subtraction

C. Multiplication, Addition, Division, Subtraction

D. Addition, Division, Modulus, Subtraction

View Answer:

Answer: Option B

13. Which of the following cannot be checked in a switch-case statement?


A. Character B. Integer

C. Float D. None of the mentioned.


View Answer:

Answer: Option C

14.Which of the following is the correct order of


evaluation for the below expression?
z=x+y*z/4%2-1

A. */%+-= B. =*/%+-

C. /*%-+= D. *%/-+=
View Answer:

Answer: Option A

15. Which of the following correctly shows the


hierarchy of arithmetic operations in C?
A. /+*- B. *-/+

C. +-/* D. /*+-

View Answer:

Answer: Option D

16. Which of the following is the correct usage of


conditional operators used in C?
a>b ? c=30 : a>b ?
A. B.
c=40; c=30;

return
C. a>b?(c=30):(c=40) D.
(a>b)?(a:b)
View Answer:

Answer: Option C

17. Which of the following is the correct order if calling functions in the below code?
a = f1(23, 14) * f2(12/4) + f3();
A. f1, f2, f3

B. f3, f2, f1

C. Order may vary from compiler to compiler

D. None of above
Answer & Explanation
Answer: Option C

18. Which of the following are unary operators in C?

1. !

2. sizeof

3. ~

4. &&

A. 1, 2 B. 1, 3

C. 2, 4 D. 1, 2, 3
View Answer:

Answer: Option D

19. In which order do the following gets evaluated

1. Relational

2. Arithmetic

3. Logical

4. Assignment

A. 2134 B. 1234

C. 4321 D. 3214
View Answer:

Answer: Option A
20.What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
getch();
}

A. -2, 3, 1, 1 B. 2, 3, 1, 2

C. 1, 2, 3, 1 D. 3, 3, 1, 2
View Answer:

Answer: Option A

21.Assunming, integer is 2 byte, What will be the output of the program?

#include<stdio.h>
#include<conio.h>

int main()
{
printf("%x\n", -2<<2);
return 0;
getch();
}

A. Ffff B. 0

C. fff8 D. Error
View Answer:

Answer: Option C

22.What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i || ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
getch();
}

A. 2, 2, 0, 1 B. 1, 2, 1, 0

C. -2, 2, 0, 0 D. -2, 2, 0, 1
View Answer:

Answer: Option D

23. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int x=12, y=7, z;
z = x!=4 || y == 2;
printf("z=%d\n", z);
return 0;
getch();
}

A. z=0 B. z=1

C. z=4 D. z=2
Answer & Explanation

Answer: Option B

24. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
static int a[20];
int i = 0;
a[i] = i ;
printf("%d, %d, %d\n", a[0], a[1], i);
return 0;
getch();
}

A. 1, 0, 1 B. 1, 1, 1

C. 0, 0, 0 D. 0, 1, 0
Answer & Explanation
Answer: Option C

25. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d\n", w, x, y, z);
return 0;
getch();
}

A. 1, 1, 1, 1 B. 1, 1, 0, 1

C. 1, 0, 0, 1 D. 1, 0, 1, 1
View Answer:

Answer: Option D

26. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j || ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
getch();
}

A. 1, 2, 0, 1 B. -3, 2, 0, 1

C. -2, 3, 0, 1 D. 2, 3, 1, 1
View Answer:

Answer: Option C
27. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int x=4, y, z;
y = --x;
z = x--;
printf("%d, %d, %d\n", x, y, z);
return 0;
getch();
}

A. 4, 3, 3 B. 4, 3, 2

C. 3, 3, 2 D. 2, 3, 3
View Answer:

Answer: Option D

28. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=3;
i = i++;
printf("%d\n", i);
return 0;
getch();
}

A. 3 B. 4

C. 5 D. 6
View Answer:

Answer: Option B

29. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int a=100, b=200, c;
c = (a == 100 || b > 200);
printf("c=%d\n", c);
return 0;
getch();
}

A. c=100 B. c=200

C. c=1 D. c=300
View Answer:

Answer: Option C

30. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int x=55;
printf("%d, %d, %d\n", x<=55, x=40, x>=10);
return 0;
getch();
}

A. 1, 40, 1 B. 1, 55, 1

C. 1, 55, 0 D. 1, 1, 1
View Answer:

Answer: Option A

31. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=2;
printf("%d, %d\n", ++i, ++i);
return 0;
getch();
}

A. 3, 4
B. 4, 3

C. 4, 4

D. Output may vary from compiler to compiler


View Answer:

Answer: Option D

32. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int k, num=30;
k = (num>5 ? (num <=10 ? 100 : 200): 500);
printf("%d\n", num);
return 0;
getch();
}

A. 200 B. 30

C. 100 D. 500
View Answer:

Answer: Option B

33. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
ch = 'A';
printf("The letter is");
printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch);
printf("Now the letter is");
printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A');
return 0;
getch();
}

The letter is a The letter is A


A. B.
Now the letter is A Now the letter is a
C. Error D. None of above
View Answer:

Answer: Option A

34. What will be the output of the program?

#include<stdio.h>
#include<conio.h>
int main()
{
int i=2;
int j = i + (1, 2, 3, 4, 5);
printf("%d\n", j);
return 0;
getch();
}

A. 4 B. 7

C. 6 D. 5
View Answer:

Answer: Option B

35.Comment on the output of this C code?

#include <stdio.h>

#include<conio.h>

int main()

int a[5] = {1, 2, 3, 4, 5};

int i;

for (i = 0; i < 5; i++)

if ((char)a[i] == '5')

printf("%d\n", a[i]);

else

printf("FAIL\n");

getch();
}

A. The compiler will flag an error

B. Program will compile and print the output 5

C. Program will compile and print the ASCII value of 5

D. Program will compile and print FAIL for 5 times

ANSWER: D

36.What is the output of this C code?

#include <stdio.h>

void main()

char chr;

chr = 128;

printf("%d\n", chr);

return 0;

A. 128

B. -128

C. Depends on the compiler

D.error

ANSWER: D

37.The output of the code below is

#include <stdio.h>

#include<conio.h>

void main()

int x = 5;

if (x < 1)

printf("hello");
if (x == 5)

printf("hi");

else

printf("no");

getch();

A. hi

B. hello

C. no

D. None of the mentioned

ANSWER: A

38. How many times i value is checked in the below code?

#include <stdio.h>

int main()

int i = 0;

do {

i++;

printf("in while loop\n");

} while (i < 3);

getch();

a) 2

b) error

c) 4

d) 1

View Answer

Answer:b
39. How many times i value is checked in the below code?

#include <stdio.h>

#include<conio.h>

int main()

int i = 0;

while (i < 3)

i++;

printf("In while loop\n");

return 0;

getch();

a) 2

b) 3

c) 4

d) 1

View Answer

Answer:c

40. What is the output of this C code?

#include <stdio.h>

void main()

int i = 2;

do

printf("Hi");

} while (i < 2);

getch();

}
a) Compile time error

b) Hi Hi

c) Hi

d) Varies

View Answer

Answer:a

41. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

int i = 0;

while (++i)

printf("H");

getch();

a) H

b) H is printed infinite times

c) Compile time error

d) Varies

View Answer

Answer:b

42. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

int i = 0;
do

printf("Hello");

} while (i != 0);

getch();

a) Nothing

b) H is printed infinite times

c) Hello

d) Run time error

View Answer

Answer:c

43. Which keyword can be used for coming out of recursion?

a) break

b) return

c) exit

d) Both (a) and (b)

View Answer

Answer:b

44. What is the output of this C code?

#include <stdio.h>

int main()

int a = 0, i = 0, b;

for (i = 0,i < 5, i++)

a++;

continue;

printf(“%d”,a);
}

a) 2

b) 3

c) 4

d) error

View Answer

Answer:d

45. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

int main()

int i ;

for (i = 0;i < 5; i++)

if (i == 3)

break;

printf(“%d”,i);

getch();

a) 1

b) 2

c) 3

d) 4

View Answer

Answer:c

46. Which keyword is used to come out of a loop only for that iteration?

a) break
b) continue

c) return

d) None of the mentioned

View Answer

Answer:b

47. The keyword ‘break’ can used within:

a) switch case

b) if

c) for

d) all of the mentioned

View Answer

Answer:d

48. What is the output of this C code?

#include <stdio.h>

void main()

int i = 0;

int j = 0;

for (i = 0;i < 5; i++)

for (j = 0;j < 4; j++)

if (i > 1)

continue;

printf("Hi \n");

a) Hi is printed 9 times
b) error

c) Hi is printed 7 times

d) Hi is printed 6 times

View Answer

Answer:b

49. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

int i = 0;

for (i = 0;i < 5; i++)

if (i < 4)

printf("Hello");

break;

getch();

a) Hello is printed 5 times

b) Hello is printed 4 times

c) Hello

d) Hello is printed 3 times

View Answer

Answer:c

50. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()
{

void foo();

printf("1 ");

foo();

getch();

void foo()

printf("2 ");

a) 1 2

b) Compile time error

c) 1 2 1 2

d) Depends on the compiler

View Answer

Answer:a

51. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

int main()

void foo();

f();

f();

return 0;

getch();

void foo()

printf("2 ");
}

void f()

printf("1 ");

foo();

a) Compile time error as foo is local to main

b) 1212

c) 2 1

d) Compile time error due to declaration of functions inside main

View Answer

Answer:b

52. What is the output of this C code?

#include <stdio.h>

int main()

void foo();

void f()

foo();

f();

getch();

void foo()

printf("2 ");

a) 2 2

b) 2
c) Compile time error

d) Depends on the compiler

View Answer

Answer: c

53. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void foo();

int main()

foo();

return 0;

getch();

void foo()

printf("2 ");

a) Compile time error

b) 2

c) Depends on the compiler

d) Depends on the standard

View Answer

Answer:b

54. What is the output of this C code?

#include <stdio.h>

void foo();

int main()

void foo(int);
foo(1);

return 0;

getch();

void foo(int i)

{ printf("2 ");

a) 2

b) Compile time error

c) Depends on the compiler

d) Depends on the standard

View Answer

Answer:b

55. What is the output of this C code?

#include <stdio.h>

void foo();

int main()

void foo(int);

foo();

return 0;

void foo()

printf("2 ");

a) 2

b) Compile time error

c) Depends on the compiler

d) Depends on the standard


View Answer

Answer:b

56. What is the output of this C code?

include <stdio.h>

void m()

printf("hi");

void main()

m();

getch();

a) hi

b) error

c) Nothing

d) Varies

View Answer

Answer: b

57. What is the output of this C code?

#include <stdio.h>

void m();

void n()

m();

void main()

void m()

{
printf("hi");

a) hi

b) Compile time error

c) Nothing

d) Varies

View Answer

Answer:b

58. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

m();

getch()’

void m()

printf("hi");

m();

a) Compile time error

b) hi

c) Infinite hi

d) Nothing

View Answer

Answer:c

59. What is the output of this C code?


#include <stdio.h>

#include<conio.h>

void main()

static int x = 3;

x++;

if (x <= 5)

printf("hi");

main();

getch();

a) Run time error

b) hi

c) Infinite hi

d) hihi

View Answer

Answer:d

60. Which of the following is a correct format for declaration of function?

a) return-type function-name(argument type);

b) return-type function-name(argument type)

{}

c) return-type (argument type)function-name;

d) Both (a) and (b)

View Answer

Answer:a

61. Which of the following function declaration is illegal?

a) int 1bhk(int);

b) int 1bhk(int a);


c) int 2bhk(int*, int []);

d) All of the mentioned

View Answer

Answer:d

62. Which function definition will run correctly?

a) int sum(int a, int b)

return (a + b);

b) int sum(int a, int b)

{return (a + b);}

c) int sum(a, b)

return (a + b);

d) Both (a) and (b)

View Answer

Answer:b

63. Can we use a function as a parameter of another function? [ Eg: void wow(int func()) ]

a) Yes, and we can use the function value conveniently

b) Yes, but we call the function again to get the value, not as convenient as in using
variable

c) No, C does not support it.

d) This case is compiler dependent

View Answer

Answer:c

64. The value obtained in the function is given back to main by using ________ keyword?

a) return

b) static

c) new

d) volatile

View Answer

Answer:a
65. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

char *p = NULL;

char *q = 0;

if (p)

printf(" p ");

else

printf("nullp");

if (q)

printf("q\n");

else

printf(" nullq\n");

getch();

a) nullp nullq

b) Depends on the compiler

c) x nullq where x can be p or nullp depending on the value of NULL

d) p q

View Answer

Answer:a

66. What is the output of this C code?

#include <stdio.h>

void main()

int i = 10;

void *p = &i;

printf("%d\n", (int)*p);
return 0;

a) error

b) Segmentation fault/runtime crash

c) 10

d) Undefined behaviour

View Answer

Answer:a

67. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

int main()

int i = 10;

void *p = &i;

printf("%f\n", *(float*)p);

return 0;

getch();

a) Compile time error

b) Undefined behaviour

c) 10

d) 0.000000

View Answer

Answer:d

68. What is the output of this C code?

#include<stdio.h>

#include<conio.h>
Void main()

Printf(“hhhhhhh”);

getch();

a) h

b) error

c) hhhhhhhhhh

d) Undefined behaviour

View Answer

Answer:b

69. What is the output of this C code?

#include <stdio.h>

int *f();

int main()

int *p = f();

printf("%d\n", *p);

int *f()

int j = 10;

return &j;

a) 10

b) Compile time error

c) Segmentation fault/runtime crash

d) Undefined behaviour

View Answer

Answer:b
70. Comment on the following pointer declaration?

int *ptr, p;

a) ptr is a pointer to integer, p is not

b) ptr and p, both are pointers to integer

c) ptr is a pointer to integer, p may or may not be

d) ptr and p both are not pointers to integer

View Answer

Answer: a

71. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

int *ptr, a = 10;

ptr = &a;

*ptr += 1;

printf("%d,%d/n", *ptr, a);

getch();

a) 10,10

b) 10,11

c) 11,10

d) 11,11

View Answer

Answer:d

72. Comment on the following?

const int *ptr;

a) You cannot change the value pointed by ptr

b) You cannot change the pointer ptr itself

c) Both (a) and (b)


d) You can change the pointer as well as the value pointed by it

View Answer

Answer:a

73. Which is an value at address operator among the following?

a) &

b) *

c) ->

d) .

View Answer

Answer:b

72. Which of the following does not initialize ptr to null (assuming variable declaration of a
as int) a=0;?

a) int *ptr = &a;

b) int *ptr = &a – &a;

c) int *ptr = a – a;

d) All of the mentioned

View Answer:

Answer:a

74. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

int x = 0;

void main()

int *ptr = &x;

printf("%p\n", ptr);

x++;

printf("%p\n ", ptr);

getch();
}

a) Same address

b) Different address

c) Compile time error

d) Varies

View Answer

Answer:a

75. What is the output of this C code?

#include <stdio.h>

int x = 0;

void main()

int *const ptr = &x;

printf("%p\n", ptr);

ptr++;

printf("%p\n ", ptr);

getch();

a) 0 1

b) Compile time error

c) 00

d) 10

View Answer

Answer:b

76. What is the output of this C code?

#include <stdio.h>

void main()

int x = 0;

int *ptr = &x;


. printf("%p\n", ptr);

ptr++;

printf("%p\n ", ptr);

getch();

a) 01

b) 10

c) 00

d) error

View Answer

Answer:d

77. What is the output of this C code?

#include <stdio.h>

void main()

int x = 0;

int *ptr = &5;

printf("%p\n", ptr);

getch();

a) 5

b) Address of 5

c) Nothing

d) Compile time error

View Answer

Answer:d
78. What is the output of this C code?

#include <stdio.h>

void main()

int x = 0;

int *ptr = &x;

printf("%d\n", *ptr);

getch();

a) Address of x

b) Junk value

c) 0

d) error

View Answer

Answer:d

79. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

int a[3] = {1, 2, 3};

int *p = a;

printf("%p\t%p", p, a);

getch();

a) Same address is printed.

b) Different address is printed.

c) Compile time error


d) Nothing

View Answer

Answer:a

80. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

char *s = "hello";

char *p = s;

printf("%p\t%p", p, s);

getch();

a) Different address is printed

b) Same address is printed

c) Run time error

d) Nothing

View Answer

Answer:b

81. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

char *s= "hello";

char *p = s;

printf("%c\t%c", p[0], s[1]);

getch();

a) Run time error


b) h h

c) h e

d) h l

View Answer

Answer:c

82. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

char *s= "hello";

. char *p = s;

printf("%c%c", *(p + 3), s[1]);

getch();

a) he

b) ll

c) lo

d) le

View Answer

Answer:d

83. What is the output of this C code?

#include <stdio.h>

#include<conio.h>

void main()

char *s= "hello";

char *p = s;
printf("%c\t%c", 1[p], s[1]);

getch();

a) h h

b) Run time error

c) l l

d) ee

View Answer

Answer:d

84. What is the output of the code given below?

#include <stdio.h>

#include<conio.h>

void foo( int[] );

int main()

int ary[4] = {1, 2, 3, 4};

foo(ary);

printf("%d ", ary[0]);

return 0;

getch();

void foo(int p[4])

int i = 10;

p = &i;

printf("%d ", p[0]);

a) 10 10

b) Compile time error

c) 10 1
d) Undefined behaviour

View Answer

Answer:c

85. What is the output of the code given below?

#include <stdio.h>

int main()

int ary[4] = {1, 2, 3, 4};

int *p = ary + 3;

printf("%d\n", p[-2]);

getch();

a) 1

b) 2

c) Compile time error

d) Some garbage value

View Answer

Answer:c

86. What is the output of the code given below?

#include <stdio.h>

int main()

int ary[4] = {1, 2, 3, 4};

int *p = ary + 3;

printf("%d %d\n", p[-2], ary[*p]);

getch();

a) 2 3

b) Compile time error

c) 2 4
d) 2 somegarbagevalue

View Answer

Answer:b

87. What is the output of this C code?

#include <stdio.h>

int main()

int ary[4] = {1, 2, 3, 4};

printf("%d\n", *ary);

a) 1

b) Compile time error

c) Some garbage value

d) Undefined variable

View Answer

Answer:a

88. What is the output of this C code?

#include <stdio.h>

int main()

const int ary[4] = {1, 2, 3, 4};

int *p;

p = ary + 3;

*p = 5;

printf("%d\n", ary[3]);

a) 4

b) 5
c) Compile time error

d) 3

View Answer

Answer:c

89. Different ways to initialize an array with all elements as zero are

a) int array[5] = {};

b) int array[5] = {0};

c) int a = 0, b = 0, c = 0;

int array[5] = {a, b, c};

d) All of the mentioned

View Answer

Answer:d

90. The elements in the array of the following code are

int array[5] = {5};

a) 5, 5, 5, 5, 5

b) 5, 0, 0, 0, 0

c) 5, (garbage), (garbage), (garbage), (garbage)

d) (garbage), (garbage), (garbage), (garbage), 5

View Answer

Answer:b

91. Which of the following declaration is illegal?

a) int a = 0, b = 1, c = 2;

int array[3] = {a, b, c};

b) int size = 3;

int array[size];

c) int size = 3;

int array[size] = {1, 2, 3};

d) All of the mentioned

View Answer

Answer:c
92. An array of similar data types which themselves are collection of dissimilar data type
are

a) Linked Lists

b) Trees

c) Array of Structure

d) All of the mentioned

View Answer

Answer:c

93. Comment on an array of void data type:

a) It can store any data-type

b) It only stores element of similar data type to first element

c) It acquires the data type with the highest precision in it

d) You cannot have an array of void data type

View Answer

Answer:d

94. What is the output of the code given below?

#include <stdio.h>

int main()

int ary[4] = {1, 2, 3, 4};

int p[4];

p = ary;

printf("%d\n", p[1]);

a) 1

b) Compile time error

c) Undefined behaviour

d) 2

View Answer

Answer:b
95. Which of the following can never be sent by call-by-value?

a) Variable

b) Array

c) Structures

d) Both (b) and (c)

View Answer

Answer:b

96. Which type of variables can have same name in different function:

a) global variables

b) static variables

c) Function arguments

d) Both (b) and (c)

View Answer

Answer:d

97. Arguments that take input by user before running a program are called?

a) main function arguments

b) main arguments

c) Command-Line arguments

d) Parameterized arguments

View Answer

Answer:c

98. The maximum number of arguments that can be passed in a single function
are_____________

a) 127

b) 253

c) 361

d) No limits in number of arguments

View Answer
Answer:b

99. What is the output of this C code?

1. #include <stdio.h>

2. void m(int *p, int *q)

3. {

4. int temp = *p; *p = *q; *q = temp;

5. }

6. void main()

7. {

8. int a = 6, b = 5;

9. m(&a, &b);

10. printf("%d %d\n", a, b);

11. }

a) 5 6

b) 6 5

c) 5 5

d) 6 6

View Answer

Answer:a

100. What is the output of this C code?

1. #include <stdio.h>

2. void m(int *p)

3. {

4. int i = 0;

5. for(i = 0;i < 5; i++)

6. printf("%d\t", p[i]);

7. }

8. void main()

9. {

10. int a[5] = {6, 5, 3};


11. m(&a);

12. }

a) 0 0 0 0 0

b) 6 5 3 0 0

c) Run time error

d) 6 5 3 junk junk

View Answer

Answer:b

101.What is the output of the following code?


#include<stdio.h>
#include<conio.h>
void main()
{
char name[10]=”debanjan”;
printf(“%d”,strlen(name));
getch();
}

a)0
b)8
c)error
d)none

View Answer
Answer:c

102.What is the output of the following code?

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[10]=”monkey”;
char name1[10]=”donkey”;
int j;
j=strcmp(name,name1);
printf(“%d”,j);
getch();
}

a)0
b)9
c)error
d)8

View Answer
Answer:b

103.Which one of the following is an example of abstract data type?

a)pointer
b)stack
c)structure
d)union

View Answer
Answer:b

104.Which one of the following is operated LIFO operation?


a)stack
b)structure
c)linklist
d)queue

View Answer
Answer:a

105.Give the example of non linear data structure.


a)graph
b)tree
c)a&b both
d)none.

ViewAnswer
Answer:c

106.Give the example of linear data structure.


a)graph
b)tree
c)array
d)none.
View answer
Answer:c
107.There are how many type of recursion process?
a)2
b)5
c)3
d)none

View Answer
Answer:a

108.Which operation can be operate by using data structure?


a)traversing
b)merging
c)a&b both
d)none
View Answer
Answer:c

109. When 1 is entered, The output of the code below is?

1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. int ch;
6. printf("enter a value btw 1 to 2:");
7. scanf("%d", &ch);
8. switch (ch)
9. {
10. case 1:
11. printf("1\n");
12. break;
13. printf("Hi");
14. default:
15. printf("2\n");
16. }
17. getch();
18. }
a)1
b) Hi 2
c) Run time error
d) 2
View Answer
Answer:a

110. When 1 is entered, The output of the code below is?

1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. int ch;
6. printf("enter a value btw 1 to 2:");
7. scanf("%d", &ch);
8. switch (ch, ch + 1)
9. {
10. case 1:
11. printf("1\n");
12. break;
13. case 2:
14. printf("2");
15. break;
16.
}
getch();
17. }
a)1
b) 2
c) 3
d) Run time error
View Answer
Answer:b

111. What is the output of this C code(when 1 is entered)?

1. #include <stdio.h>
2. void main()
3. {
4. double ch;
5. printf("enter a value btw 1 to 2:");
6. scanf("%lf", &ch);
7. switch (ch)
8. {
9. case 1:
10. printf("1");
11. break;
12. case 2:
13. printf("2");
14. break;
15. }
16. }
a)Compile time error
b) 1
c) 2
d) Varies
View Answe:
Answer:a

112. What is the output of this C code(When 1 is entered)?

1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. char *ch;
6. printf("enter a value btw 1 to 3:");
7. scanf("%d", ch);
8. switch (ch)
9. {
10. case "1":
11. printf("1");
12. break;
13. case "2":
14. printf("2");
15. break;
16. }
17. getch();
18. }
a) 1
b) Compile time error
c) 2
d) Run time error
View Answer
Answer:b

113. What is the output of this C code(When 1 is entered)?

1. #include <stdio.h>
#include<conio.h>
2. void main()
3. {
4. int ch;
5. printf("enter a value btw 1 to 2:");
6. scanf("%d", &ch);
7. switch (ch)
8. {
9. case 1:
10. printf("1\t");
11. default:
12. printf("2");
13. }
14. getch();
15. }
a) 1
b) 2
c) 1 2
d) error
View Answer
Answer:c

114. What is the output of this C code(When 2 is entered)?

1. #include <stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. float ch;
6. printf("enter a value btw 1 to 2:");
7. scanf("%f", &ch);
8. switch (ch)
9. {
10. case 1:
11. printf("1\n");
12. break;
13. printf("hi");
14. default:
15. printf("2\n");
16. }
17. getch();
18. }
a) 1
b) hi 2
c) error
d) 2
View Answer
Answer:c

115. What is the output of this C code(When 1 is entered)?

1. #include <stdio.h>
2. void main()
3. {
4. int ch;
5. printf("enter a value btw 1 to 2:");
6. scanf("%d", &ch);
7. switch (ch, ch + 1)
8. {
9. case 1:
10. printf("1\n");
11. break;
12. case 2:
13. printf("2");
14. break;
15. }
16. }
17.
a) 1
b) 2
c) 3
d) can not view any result.
View Answer
Answer:d

116. What is the output of this C code?

1. #include <stdio.h>
2. #include<conio.h>
3. int main()
4. {
5. int a = 10;
6. double b = 5.6;
7. int c;
8. c = a + b;
9. printf("%d", c);
10. }
a) 15
b) 16
c) 15.6
d) error
View Answer
Answer:d

117. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. int a = 10, b = 5, c = 5;
5. int d;
6. d = a == (b + c);
7. printf("%d", d);
8. getch();
9. }
a) Syntax error
b) 1
c) 10
d) 5
View Answer
Answer: a
118. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. int i = -3;
5. int k = i % 2;
6. printf("%d\n", k);
7. return 0;

getch();
}
a) error
b) -1
c) 1
d) Implementation defined
View Answer
Answer:a

119. What is the output of this C code?

1. #include <stdio.h>

#include<conio.h>
int main()
2. {
3. int i = 3;
4. int l = i / 2;
5. int k = i % 2;
6. printf("%d %d\n", l, k);
7. return 0;
8. getch();
9. }
a) Compile time error
b) 1 1
c) 1 -1
d) Implementation defined
View Answer
Answer:b
120. What is the output of this C code?

1. #include <stdio.h>
#include<conio.h>
int main()
2. {
3. int i = 5;
4. i = i / 3;
5. printf("%d\n", i);
6. return 0;
7. }
a) Implementation defined
b) 1
c) 3
d) not able to view the result
View Answer
Answer:d