O Level C Language Important MCQs

1. What is the following is invalid header file in C ?

(A) math.h

(B) mathio.h

(C) string.h

(D) ctype.h

 

2. Which of the following is not a keyword of 'C' ?

(A) auto

(B) case

(C) break

(D) function

 

3. Strings are character arrays it always ends with ______.

(A) \n

(B) \t

(C) \0

(D) \1

 

4. Find an integer constant

(A) 3.145

(B) 34

(C) "125"

(D) None of the above

5. Standard ANSI C recognizes ______ number of keywords.

(A) 16

(B) 32

(C) 64

(D) 128

 

6. Which is the only function that all C program must contain?

(A) start()

(B) system()

(C) main()

(D) scanf()

 

7. Find output of the following program

#include<stdio.h>

#include<conio.h>

void main()

{

char a[] = { 'A', 'B', 'C', 'D' };

char* ppp = &a[0];

*ppp++;

printf("%c %c ", *++ppp, --*ppp);

}

(A) C A

(B) C B

(C) B C

(D) B A

 

8. Find output of the following program

#include <stdio.h>

#include<conio.h>

void main()

{

char ch;

int i;

ch = 'G';

i = ch-'A';

printf("%d", i);

}

(A) 5

(B) 6

(C) 7

(D) 8

 

9. How many times is a do while loop guaranteed to loop ?

(A) 0

(B) Infinitely

(C) 1

(D) Variable

10. Which of the following is not a proper storage class in 'C'?

(A) auto

(B) dec

(C) static

D) extern

 

11. Which of the following is a keyword used for a storage class ?

(A) printf

(B) external

(C) auto

(D) scanf

12. Which pair of functions below are used for single character I/O ?

(A) getchar( ) and putchar( )

(B) scanf( ) and printf( )

(C) input( ) and output( )

(D) None of these

13. What is the output of below program ?

void main( ){

char*p="Hello world";

int*q;

p++;

q = (int*)p;

q++;

printf("\n%s\n%s",p,q); }

(A) ello world

Ello world

(B) Compiler error

(C) lo world

lo world

(D) ello world

World

14. Which of the following is a Scalar Data type ?

(A) Float

(B) Union

(C) Array

(D) Linked list

15. Header files in C contain :

(A) Compiler commands

(B) Library functions

(C) Header information of C programs

(D) Operator for files

16. What is the binary number equivalent of the decimal number 12 ?

(A) 1100

(B) 1010

(C) 1001

(D) 1110

 

18. Pointers are of :

(A) integer data type

(B) character data type

(C) unsigned integer data types

(D) none of these

19. In C, if you pass an array as an argument to a function, what actually passed ?

(A) Value of elements in array

(B) First element of the array

(C) Base address of the array

(D) Address of the last element of array

20. Which of the following fopen( ) statements is illegal in C ?

(A) fp = fopen("abc.txt", "r");

(B) fp = fopen("c:/user1/abc.txt", "w");

(C) fp = fopen("abc", "w");

(D) none of the mentioned

21. Which one of the following is not a keyword in C language ?

(A) main

(B) endl

(C) float

(D) switch

 

22. Which of the following is true for variable names in C ?

(A) They can contain alphanumeric characters as well as special characters.

(B) It is not an error to declare a variable to be one of the keywords

(like goto, static).

(C) Variable names cannot start with a digit.

(D) Variable can be of any length.

23. What is the output of this C code ?

#include <stdio.h>

int main( )

{

int x = 2, y = 0;

int z = y && (y |= 10);

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

return 0;

}

(A) 1

(B) 0

(C) Undefined behaviour due to order

of evaluation

(D) 2

24. Point out the error if any, in the while loop :

main( )

{

int i=1;

while ( )

{

printf(“%d”,i++);

if( i > 10)

break;

}}

(A) The condition in while loop is must

(B) There should be a semicolon in the

while loop

(C) The while loop should be replaced

by for loop

(D) No error

25. What is right way to initialize arrays ?

(A) intnum[6]={2,4,12,5,45,5};

(B) int n{ }={2,4,12,5,45,5};

(C) int n{6}={2,4,12};

(D) int n(6)={2,4,12,5,45,5};

26. In C, if you pass an array as an argument to a function, what actually gets passed ?

(A) Value of elements in array

(B) First element of array

(C) Base address of array

(D) Address of the last element of array

27. The output of below program is :

# include <stdio.h>

void fun(int *ptr)

{

*ptr = 30;

}

int main( )

{

int y = 20;

fun(&y);

printf("%d", y);

return 0;

}

 (A) 20

(B) 30

(C) Compiler error

(D) Runtime error

28. If the two strings are identical, then strcmp( ) function returns

(A) –1

(B) 1

(C) 0

(D) infinity

 

29. What is the maximum number of dimensions an array in C may have ?

(A) 2

(B) 8

(C) 20

(D) Theoretically no limits. The only practical limits are memory and compilers.

30. Is the following statement declaration or definition :

extern int i;

(A) Declaration

(B) Definition

(C) Function

(D) Error

 

31. Which programming method is followed in C language?

A) Algorithm

B) Flow-charts

C) Procedural

D) Object Oriented

 

32. getchar() function is available in which header file?

A) stdio.h

B) conio.h

C) math.h

D) header.h

 

33. Find the output of following code

int main()

{

int i=-2;

printf(“-i = %d”,-i);

return 0;

}

A) -i=2

B) i=-2

C) -i=-2

D) -i=+2

 

34. Which numbering system is not handled directly by the printf() conversion specifiers?

A) Decimal

B) Binary

C) Octal

D) Hexadecimal

 

35. Which of the following is an incorrect assignment statement?

A) N=m=0

B) Value+=10

C) mySize=x<y?9:11

D) Value=+=10

 

36. What will be the output of the following program?

int main()

{

int x=5;

printf(“%d %d %d”,x,x<<2,x>>2); }

A) 1 20 5

B) 5 1 20

C) 5 20 1

D) 20 1 5

 

37. A programming construct in which a set of statement in a computer program can be executed repeatedly.

A) Loop statement

B) Conditional statement

C) Block statement

D) All of the above

 

38. What will be the output of following program?

int main()

{

for(int c=1;c<=5;++c);

printf(“%d”,c);

}

A) 1

B) 5

C) 6

D) 12345

 

39. In C, if you pass an array as an argument to a function, what actually gets passed?

A) Value of elements in array

B) First element of the array

C) Base address of the array

D) Address of the last element of array

40. How many times is a do while loop guaranteed to loop?

A) 0

B) Infinitely

C) 1

D) Variable

 

41 .What will be output if you compile and execute the following ‘C’ code?

void main(){

float a=5.2;

if(a==5.2)

printf("Equal");

else if(a<5.2)

printf("Less than");

else

printf("Greater than");

}

A) Equal

B) Less than

C) Greater than

D) Compilation error

 

42. What will be output if you compile and execute the following ‘C’ code?

void main(){

int i=4,x;

x=++i + ++i + ++i;

printf("%d",x);

}

A) 21

B) 18

C) 12

D) Compilation error

 

43. The following code ‘for(;;)’ represents an infinite loop. It can be terminated by.

A) break

B) exit(0)

C) abort()

D) All of the mentioned

 

44. 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

45. Automatic variables are allocated memory in

A) heap

B) Data segment

C) Code segment

D) stack.

 

46. End of file is detected by

A) fend( )

B) endf( )

C) EOF

D) FEND

 

47. If the first string and the second string both are identical, then strcmp function returns

A) a value of 0

B) either 1 or 0

C) a value of 1

D) any positive integer

 

48. Register variable are active

A) outside the function

B) throughout the program

C) only in the function where it is defined

D) surrounding of that function

49. What will be the output of following program

#include

main()

{

int x,y = 10;

x = y * NULL;

printf(“\n %d \n", x);

}

A) error

B) 0

C) 10

D) Garbage value

50. What is the output of this C code?

#include <stdio.h>

void main()

{

static int x;

if (x++ < 2)

main();

}

A) Infinite calls to main

B) Run time error

C) Varies

D) main is called twice

 

51. Which one is incorrect statement for C Language?

A) C compiler supports octal integer constant.

B) C compiler supports hexadecimal integer constant.

C) C compiler supports binary integer constant.

D) C compiler supports decimal integer constant.

52. What will be the output of the following code?

A) 0

B) Error because of incorrect line-1 only.

C) Error because of incorrect line-1 and line-2.

D) Error because of incorrect line-2 only. 

53. *ptr++ is equivalent to

A) ptr++

B) *ptr

C) ++ptr

D) ++*ptr

54. Which of the following is not a proper storage class

A) auto

B) dcc

C) static

D) extern

55. Which of the following cannot be used as

identifiers?

A) spaces

B) digits

C) underscores

D) letters

 

56. How many times is a do while loop guaranteed to

loop?

A) 0

B) Infinitely

C) 1

D) Variable

 

57. Precedence is used

A) To determine which operator evaluated first from

left to right.

B) To determine the level of an operator in a program.

C) To determine how an expression involving more

than one operator is evaluated.

D) To check the expression is valid or not.

58. Identify the correct sequence of steps to run a

program

A) Link, Load, Code, Compile & Execute

B) Code, Compile, Link, Execute & Load

C) Code, Compile, Link, Load & Execute

D) Compile, Code, Link, Load & Execute

59. Which of the following software translates source code into object code?

A) Compiler

B) Interpreter

C) Assembler

D) None

60. Which one of the following is not a keyword in C language?

A) main

B) endl

C) float

D) switch

61. Identify the invalid character constant:

A) '\n'

B) '$'

C) '12'

D) 'p'

62. What is the binary number equivalent of the decimal number 12?

A) 1100

B) 1010

C) 1001

D) 1110

63. Determine the order of evaluation of operations within the expression A<B&&C||D>A

A) &&, ||, <, >

B) <, >, &&, ||

C) >, <, &&, ||

D) &&,<, >, ||

64. How many times the printf statement within the while loop will be executed?

x=1;

while(x=0)

printf("hello");

A) 1

B) 0

C) infinite

D) 2

65. Find the output generated by the given program.

#include <stdio.h.

void main()

{

printf("Bre\nak");

}

A) Break

B) Bre\nak

C) Break

D) None

66. Which of the following is not an iterative statement?

A) switch

B) while

C) do while

D) for

67. Identify the storage class with which & operator cannot be used.

A) register

B) static

C) extern

D) auto

68. Identify the invalid declaration:

A) int &p;

B) int *p[10];

C) int **p;

D) int *p[ ];

69. How many times below for loop will be executed?

#include<stdio.h>

int main()

{

int i=0;

for(;;)

printf("%d",i);

return 0;

}

A) 0 times

B) Infinite times

C) 10 times

D) 1 times

70. Find output of the following program?

#include<stdio.h>

int main()

{

char str[] = "Smaller";

int a = 100;

printf(a > 10 ? "Greater" : "%s", str);

return 0;

}

A) Greater

B) Smaller

C) Compile Error

D) 100

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

A) Character

B) Integer

C) Float

D) enum

72. Difference between calloc() and malloc() is:

A) calloc() takes a single argument while malloc() needs two arguments

B) malloc() takes a single argument while calloc() needs two arguments

C) malloc() initializes the allocated memory to ZERO

D) calloc() initializes the allocated memory to NULL

73. What is the purpose of getc()?

A) read a character from STDIN

B) read a character from a file

C) read all file

D) read file randomly

74. Difference between structure and union is

A) We can define functions within structures but not within a union

B) We can define functions within union but not within a structure

C) The way memory is allocated

D) There is no difference

75. What is correct order of precedence in C?

A) Addition, Division, Modulus

B) Addition, Modulus, Division

C) Multiplication, Substration, Modulus

D) Modulus, Multiplication, Substration

76. Disadvantage of array in C is

A) We can easily access each element

B) It is necessary to declare too many variables

C) It can store only one similar type of data

D) It is difficult to perform sorting operation on it

77. Which is invalid name of identifier?

A) world

B) addition23

C) test-name

D) factorial

78. Due to variable scope in C

A) Variables created in a function cannot be used another function

B) Variables created in a function can be used in another function

C) Variables created in a function can only be used in the main function

D) None of the above

79. Which one of the following is incorrect for structure?

A) It is a convenient tool to handle a group of logically related data items.

B) Structure of array variables can be passed as argument in a function.

C) It is a user-defined data type.

D) Structure within structure is not supported.

 

80. Which one of the following is VALID in C language?

A)printf(“%d”,++4);

B) float n, a[n];

C) int *p=&a, a=3;

D) for( ; ; );

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) * % / - + =

 

81.  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 the above

 

82. How many times "IndiaBIX" is get printed?

int main()

{

int x;

for(x=-1; x<=10; x++)

{

if(x < 5)

continue;

else

break;

printf("IndiaBIX");

}

return 0;

}

M3-R4 Page 2 of 5 July, 2015

A) Infinite times

B) 11 times

C) 0 time

D) 10 times

 

83. What do the following declaration signify? void *cmp();

A) cmp is a pointer to an void type.

B) cmp is a void type pointer variable.

C) cmp is a function that return a void pointer.

D) cmp function returns nothing.

 

84. When following piece of code is executed, what output will be generated?

#include<stdio.h>

int main(){

char arr[7]="Network";

printf("%s", arr);

return 0; }

A) Network

B) N

C) Garbage value

D) Compilation error

 

85. The result of a Relational operation is always

A) either True or False

B) is less than or is more than

C) is equal or less or more

D) All of the above

 

86. The keyword used to transfer control from a function back to the calling function is

A) switch

B) goto

C) go back

D) return

 

87. What is the similarity between a structure, union and enumeration?

A) All of them let you define new values

B) All of them let you define new data types

C) All of them let you define new pointers

D) All of them let you define new structures

 

88. Which of the following cannot be used as identifiers?

A) Spaces

B) Digits

C) Underscores

D) Letters

 

89.  How many times is a do while loop guaranteed to loop?

A) 0

B) Infinitely

C) 1

D) Variable

90. The two type of file structures existing in VSAM file are

A) Key sequenced structures, entry sequenced structures

B) Key sequenced structure, exit sequenced structures

C) Entry sequenced structures, exit sequenced structures

D) None of the above

 

91.  In a multilist organisation

A) records that have an equivalent value for a given secondary index item are linked together to

form a list

B) records are loaded in ordered sequence defined by collating sequence by content of key

C) records are directly accessed by records key field

D) none of the above

 

92. *ptr ++ is equivalent to

A) ptr++

B) *ptr

C) ++ptr

D) ++*ptr

 

93. Declaration int *(*p) int(*a) is

A) A pointer to function that accept an integer argument and return an integer

B) A pointer to a, which returns an integer

C) A pointer to subroutine which returns an integer

D) None of the above

 

 

94. The output of following program would be

main()

{ printf(“d%d%d%” sizeof(3.14f), sizeof(3.14l);}

is

A) 4,8,10

B) 8,4,10

C) 18,8,4

D) None of the above

 

95. An example of hierarchical data structure is

A) array

B) link list

C) tree

D) all of the above

 

96. The do..while looping statement

A) is executed only once if the conditions is true

B) is also known as entry-controlled loop

C) is executed at least once if the conditions is false

D) the unconditional loop

 

97. Which of the following is not a proper storage class in ‘C’?

A) auto

B) dec

C) static

D) extern

 

98.  The average number of comparison is sequential search is

A) n**2

B) n(n-1)/2

C) n(n+1)/2

D) (n+1)/2

 

99.  Tell whether the following tree is:

A) Heap

B) Full and Complete

C) Heap Complete

D) None of the above

100. Which of the following function declaration need not have a return statement in its body?

A) int a(char *s)

B) void b(int a[], int n)

C) float *c()

D) short d(long x)

 

101.  Identify the correct sequence of steps to run a program

A) link, load, code, compile and execute

B) code, compile, link, execute and load

C) code, compile, link, load and execute

D) compile, code, link, load and execute

 

102.  What will be the output of the following code segment?

char *p = "Structured Programming";

printf("%s", p + 5);

A) Structured Programming

B) tured Programming

C) ctured Programming

D) There will be no output as there is a syntax error in code

 

103.  Which of the following is an incorrect syntax?

A) void outerFn() {

...

int innerFn(float f) {

...

}

}

B) struct outer {

...

struct inner {

...

}I;

};

 

C) if (i < 10) {

if (x == y) {

...

}

...

}

D) for (i = 0; i < 10; i++) {

...

for (j = 0; j < 10; j++) {

...

}

}

 

104.  For the following definitions

char a[] = "Hello World!";

int i;

Which of the following loop will print the output as Hello World!

A) for (i = 0; a[i] != '/0'; i++)

printf("%s", a[i]);

B) for (i = 0; a[i] != '/0'; i++)

printf("%c", a[i]);

C) for (i = 0; a[i] != '\0'; i++)

printf("%s", a[i]);

D) for (i = 0; a[i] != '\0'; i++)

printf("%c", a[i]);

 

105.  Consider the statement given below:

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

Which printf statement will print the value of fourth element of the array?

A) printf("%d ", *(p + 3));

B) printf("%d", p[4]);

C) printf("%d ", a + 3);

D) printf("%d ", *a + 3);

 

106.  What will be the output of the following code segment?

int x = 24, y = 39, z = 45;

z = x + y;

y = z - y;

x = z - y;

printf("\n%d %d %d", x, y, z);

A) 24 39 63

B) 39 24 63

C) 24 39 45

D) 39 24 45

 

107.  Which of the following is the correct way to define a two dimensional array?

A) int a[ ][4];

B) int b[2, 4];

C) int c[2][ ];

D) int d[ ] [ 4] = {{1, 3, 5, 7}, {2, 4, 6, 8}};

 

 

108. What will be the output of the following code segment if Hello there is given as input?

char a[20];

scanf("%s", a);

printf("%s", a);

A) Hello there

B) Hello

C) "Hello there"

D) "Hello"

 

109.  What will be the output of the following code segment?

void fn() {

static int i = 10;

printf("%d ", ++i);

}

main() {

fn();

fn();

}

A) 10 10

B) 11 11

C) 11 12

D) 12 12

110. What will be output if you will compile and execute the following c code?

#include<stdio.h>

int main(){ int a=5; float b;

printf("%d",sizeof(++a+b)); printf(" %d",a); return 0;}

A) 2 6

B) 4 6

C) 2 5

D) 4 5

 

111.  What will be output if you will compile and execute the following C code?

#include<stdio.h>

int main(){

int check=2;

switch(check){

case 1: printf("D.W.Steyn");

case 2: printf(" M.G.Johnson");

case 3: printf(" Mohammad Asif");

default: printf(" M.Muralidaran");

}

return 0;

}

A) M.G.Johnson

B) M.Muralidaran

C) M.G.Johnson Mohammad Asif M.Muralidaran

D) Compilation error

 

 

112.  How many times "IndiaBIX" is get printed?

int main()

{

int x;

for(x=-1; x<=10; x++)

{

if(x < 5)

continue;

else

break;

printf("IndiaBIX");

}

return 0;

}

A) Infinite times

B) 11 times

C) 0 times

D) 10 times

 

113.  What do the following declarations signify? void *cmp();

A) cmp is a pointer to an void type.

B) cmp is a void type pointer variable.

C) cmp is a function that return a void pointer.

D) cmp function returns nothing.

 

114. When following piece of code is executed, what output will be generated?

#include<stdio.h>

int main(){

char arr[7]="Network";

printf("%s", arr);

return 0;

}

A) Network

B) N

C) Garbage value

D) Compilation error

 

115. The result of a Relational operation is always

A) either True or False

B) is less than or is more than

C) is equal or less or more

D) All of the above

 

116.  The keyword used to transfer control from a function back to the calling function is

A) switch

B) goto

C) go back

D) return

 

117.  What is the similarity between a structure, union and enumeration?

A) All of them let you define new values

B) All of them let you define new data types

C) All of them let you define new pointers

D) All of them let you define new structures

 

118.  How many times is a do while loop guaranteed to loop?

A) 0

B) Infinitely

C) 1

D) Variable

 

119. Which of the following can not be used as identifiers?

A) Letters

B) Digits

C) Underscores

D) Spaces

120. In the passage of text, individual words and punctuation marks are known as

A) Constants

B) Keywords

C) Operators

D) Tokens

 

121.  Choose the option that contains only valid hexadecimal integers.

A) 0x9F, 0xbcd, 0x1

B) 037, 0xx, 01000

C) 0x561u, 0x9h, 0xdd

D) H9F, HFF, HAA

 

122.  Which one of the following are not valid variable names in C?

A) float_int, keyword, A1

B) ANSI, ascii, cpu

C) valid, variable, name

D) None of the above

 

123.  What is the output of the following code?

main()

{ static int num=8;

printf(“%d ”,num=num-2);

if(num!=0) main(); }

A) 8 6 4 2

B) Infinite output

C) 6 4 2 0

D) Invalid because main function can’t call itself.

 

124.  What is the effect of the following code?

main() { int a[4] = {25, 16};

printf(“%d %d”, a[0] & a[1], a[1]|a[2]) ; }

A) 16 16

B) Syntax error because of invalid operator symbol

C) 25 16

D) Syntax error because of invalid array initialization

 

125.  What will be the output of the following code?

main() { int c,d, *p1=&c,*p2=&d, x;

c =10,d =4;

x = –3* – *p2 / *p1 + 5;

printf(“%d ”,x);

}

A) 6

B) Invalid syntax because / * is used for comments.

C) 8

D) Invalid syntax because three binary operators can’t be together in an expression.

 

126. What is the output of the following code?

main(){ int a, b; a=b=4;

b=a++;

printf("%d %d %d %d", a++, --b, ++a, b--); }

A) 5 3 7 3

B) Syntax error

C) 5 4 5 3

D) 6 2 6 4

 

127.  When we declare an array

A) Compiler declare array name itself as a constant pointer to base address

B) A continuous file is allocated to store the elements value

C) Index of elements is declared automatically

D) All elements are initialized to zero

 

128. The do…while looping statement

A) is executed only once if the condition is true.

B) is also known as entry-controlled loop.

C) is executed at least once if the condition is false.

D) is unconditional looping statement..

 

129.  What will be the output of the following code?

struct { int si;

double d;

float *cp; } s ;

void main() {

printf(“%d, %d, %d”, sizeof(s.d), sizeof(s.cp), sizeof(s)); }

A) 4, 4, 12

B) 8, 2, 12

C) 10, 4, 16

D) 8, 4, 14

130. If a=8, b=3 and c=-5 are integers, then value of a*b/c is

A) -4

B) -2.8

C) +2.8

D) +3

 

131.  Which of the following is a valid identifier?

A) 1return

B) return1

C) return

D) $return_1

 

132.  Which of the following is a valid string constant?

A) “programming”

B) “programming

C) ‘programming

D) $ programming $

 

133.  How will you free the allocated memory?

A) remove(var-name);

B) free(var-name);

C) delete(var-name);

D) dalloc(var-name);

 

134. If i = 8 and j = 5 are two integers, then the value of (i>0) || (j < 5) is

A) -5

B) 1

C) 0

D) +5

 

135.  How many times "INDIA" will get printed?

#include<stdio.h>

int main()

{

int x;

for(x=-1; x<=10; x++)

{

if(x < 5)

continue;

else

break;

printf("INDIA");

}

return 0;

}

A) Infinite times

B) 11 times

C) 0 times

D) 10 times

 

136.  A group of related data that share a common name is

A) Pointer

B) Array

C) Function

D) None of the above

 

137.  In ‘C’, if you pass an array as an argument to a function, what actually gets passed?

A) Value of elements in array

B) First element of the array

C) Base address of the array

D) Address of the last element of array

 

138.  What does fp point to in the program?

#include<stdio.h>

int main()

{

FILE *fp;

fp=fopen("trial", "r");

return 0;

}

A) The first character in the file

B) A structure which contains a char pointer which points to the first character of a file

C) The name of the file

D) The last character in the file

 

139.  Which of the following language is predecessor to ‘C’ Programming Language?

A) A

B) B

C) ADA

D) C++

140. Which of the following is not an unconditional control statement in ‘C’?

A) break

B) continue

C) exit()

D) while

 

141.  What will be the output of the following program?

Main()

{ int x = 5;

While ( x = = 1)

x = x -1;

printf ( “ %d\n”, x);

}

A) 5

B) 4

C) 0

D) syntax error

 

142.  Which of the following is not a proper storage class in ‘C’?

A) auto

B) dec

C) static

D) extern

 

143. Which of the following is a wrong pointer declaration?

A) int *int(a);

B) int *x, *y;

C) float *aptr;

D) int *x, float *y;

 

144. The value of S[5] in the segment char s[15] = “ MICROPROCESSOR” is

A) P

B) O

C) R

D) None of the above

 

145.  Function putchar() displays

A) one word at a time on the screen

B) one character at a time

C) result on the screen

D) None of the above

 

146.  The sqrt() function is available in

A) conio.h

B) string.h

C) math.h

D) graphic.h

 

147.  If ‘a’ is an integer variable, then a = 5/2 will return a value

A) 2.5

B) 2

C) 2.000000

D) 2.500000

 

148.  Which of the following a not a basic data type used in C language?

A) double

B) float

C) char

D) array

 

149.  pow(x,y) is used to

A) power of yx

B) power of xy

C) logarithm of x on the base y

D) Such function does not exist

150. What would be value of j after the following is executed?

k=17;

j=6;

if (k < 10)

j=8;

j=j+1;

j=j+2;

A) 8

B) 9

C) 7

D) 10

 

151. What will be output after compilation and execution of the following code?

#include<stdio.h>

int main(){ int array[3]={5}; int i;

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

printf("%d ",array[i]); return 0;}

A) 5 garbage garbage

B) 5 0 0

C) 0 0 0

D) 5 5 5

 

152.  In an assignment statement a=b; which of the following statement is true?

A) The variable a and the variable b are same.

B) The value of b is assigned to variable a but if b changes later, it will not effect the value of

variable a.

C) The value of b is assigned to variable a but if b changes later, it will effect the value of

variable a.

D) The value of variable a is assigned to variable b, and the value of variable b is assigned to

variable a.

 

 

153.  Which code will print k 20 times?

A) for (i=1; i < 20; i++)

printf (“k”);

B) for (i=1; i = 20; i++)

printf (“k”);

C) for (i=0; i < 20; i++)

printf (“k”);

D) for (i=0; i <= 20; i++)

printf (“k”);

 

154.  When the following piece of code is executed, what happens?

b = 3; a = b++;

A) a contains 3 and b contains 4

B) a contains 4 and b contains 4

C) a contains 4 and b contains 3

D) a contains 3 and b contains 3

 

155.  What is the value of r after this code is executed?

r=2;

k=8;

if (r>3 || k>6 && r<5 ||k>10)

r=9;

else

r=6

A) 9

B) 2

C) 6

D) 8

156.  Which of the following is not a valid relational operator?

A) <

B) =

C) >=

D) <=

 

157.  What is the final value of x when the code int x; for(x=0; x<10; x++) {} is executed?

A) 10

B) 9

C) 0

D) 1

 

158.  For the function

int operation (int A[], int n)

{

}

Which is the appropriate calling statement from main program?

A) s=operation(A[], 6)

B) operation(A, 6)

C) k=operation(A, 6)

D) d=operation(int A, 6)

 

159. Which is an incorrect variable name?

A) Id_No

B) ID_NO

C) IdNo

D) Id No

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

A) Character

B) Integer

C) Float

D) enum

 

161. Which header file should be included to use functions like malloc() and calloc()?

A) memory.h

B) stdlib.h

C) string.h

D) dos.h

 

162.  For the program given below, which of the following statement is correct?

void main ( )

{

int i;

for(;scanf(“%d”.&i);printf(“%d”,i))

;

}

A) The for loop would not get executed at all.

B) The for loop would get executed only once.

C) The for loop would get executed 5 times.

D) The for loop would get executed infinite times.

 

163.  In which order do the Relational, Arithmetic, Logical and Assignment operators get evaluated in C?

A) Arithmetic, Relational, Logical, Assignment

B) Relational, Logical, Arithmetic, Assignment

C) Logical, Relational, Arithmetic, Assignment

D) Assignment, Arithmetic, Relational, Logical

 

164.  By default a real number is treated as a

A) float

B) double

C) long double

D) integer

 

165.  Which of the following function can be used to find the first occurrence of a given string in another string?

A) strchr( )

B) strrchr( )

C) strstr( )

D) strnset( )

 

166.  What will be the output of the following program?

void main( )

{

struct emp

{

char name[20];

int age;

float sal;

};

struct emp e ={“Tiger”};

printf(“\n%d %f”,e.age,e.sal);

A) 0 0.000000

B) Garbage values

C) Error

D) None of the above

 

167.  If a file is opened in ‘write’ mode, then

A) If it does not exist, an error is returned

B) If it does not exist, it is created

C) If it exists, then data is written at the end

D) If it exists, error is returned

 

168.  If a variable is a pointer to a structure, then which of the following operator is used to access

data members of the structure through the pointer variable.

A) ‘.’

B) ‘&’

C) ‘*’

D) ‘->’

 

169. The && and | | operators

A) compare two numeric values

B) combine two numeric values

C) compare two boolean values

D) None of the above

170. ‘C’ Programming Language was developed and written by

A) Martin Richards

B) Dennis Ritchie

C) Ken Thompson

D) Herman Hellorith

 

171.  Which of the following is false in ‘C’ Programming Language

A) Keywords can be used as variable names

B) Variable names can contain digits

C) Variable names do not contain blank spaces

D) Capital letters can be used in variable names.

 

172.  What will be the output of the following ‘C’ program

main()

{

int a=5;

float b=5.0;

if(a==b)

printf(“a and b are equal”);

else

printf(“a and b are different”);

}

A) a and b are equal

B) a and b are different

C) Error

D) None of the above

 

173.  What will be the output of the following ‘C’ program?

main()

{

int a=1;

int b=5;

if(a=5||b>10)

printf(“I will certainly pass”);

else

printf(“I am not so sure about the result”);

}

A) I will certainly pass

B) I am not so sure about the result

C) Error

D) None of the above

 

174.  What will be the output of the following program?

main()

{

int a;

printf(“%d”,a);

}

A) 0

B) 1

C) Error

D) Unpredictable Value

 

175.  A ‘C’ expression contains relational, assignment and arithmetic operators. There are no parentheses used. They will be evaluated in which of the following order

A) Assignment Relational Arithmetic

B) Arithmetic Relational Assignment

C) Relational Arithmetic Assignment

D) Assignment Arithmetic Relational

 

176.  Prototype of function named ‘fun’ is: int fun(int a, float b) Which of the following is true about function ‘fun’:

A) It takes two inputs, one integer type and the other float type but returns nothing

B) It takes two inputs, one integer type and the other float type but returns 0

C) It takes two inputs, one integer type and the other float type but returns an integer

D) It takes two inputs, one integer type and the other integer type but returns float

 

177.  What will happen if an element is assigned a value to an element of an array whose subscript exceeds the size of the array

A) It will not be allowed, but no error message will be generated

B) Compiler will generate an error message suggesting the same

C) The element will be assigned NULL VALUE.

D) Some other data may be overwritten.

 

179.  In the following ‘C’ code

{

FILE *f = fopen( fileName, "r");

fread(f);

if(????)

puts(“End of file reached”);

}

Which one of the following can replace the ???? in the code above to determine if the end of a file has been reached?

A) f == EOF

B) feof( f )

C) eof( f )

D) f == NULL

 

180.  With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?

A) unalloc()

B) Dropmem()

C) Dealloc()

D) free()

181. By default a real number is treated as a

A) float

B) double

C) long double

D) integer

 

182.  Which of the following expression is equivalent to ++*ptr?

A) (*ptr)++

B) ++*(ptr)

C) (ptr)*++

D) (ptr)++*     

 

183.  The default storage class of a ‘C’ variable is

A) auto

B) static

C) extern

D) register

 

184.  Which header file should be included to use functions like malloc() and calloc()?

A) memory.h

B) stdlib.h

C) string.h

D) dos.h

 

185. We can combine the following two statements into one using

char *p;

p = (char*) malloc(100);

A) char p = *malloc(100);

B) char *p = (char) malloc(100);

C) char *p = (char*)malloc(100);

D) char *p = (char *)(malloc*)(100);

 

186. How many times "DOEACC" will get printed?

#include<stdio.h>

int main()

{

int x;

for(x=-1; x<=10; x++)

{

if(x < 5)

continue;

else

break;

printf("DOEACC");

}

return 0;

}

A) Infinite times

B) 11 times

C) 0 times

D) 10 times    

 

187. Which of the following statement is correct about the following program?

#include<stdio.h>

long fun(int num)

{

int i;

long f=1;

for(i=1; i<=num; i++)

f = f * i;

return f;

}

A) The function calculates the value of 1 raised to power num

B) The function calculates the square root of an integer

C) The function calculates the factorial value of an integer

D) None of the above

 

188.  In C, if you pass an array as an argument to a function, what actually gets passed?

A) Value of elements in array

B) First element of the array

C) Base address of the array

D) Address of the last element of array

 

189. If a file is open in ‘write’ mode, then

A) If it does not exist, an error is returned

B) If it does not exist, it is created

C) If it exists, then data is written at the end

D) If it exists, error is returned

 

190.  Which of the following functions is used to free the allocated memory?

A) remove(var-name);

B) free(var-name);

C) delete(var-name);

D) dalloc(var-name);