Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

MGMs JNEC Question bank for the subject: CE(FE-All)

1. C programming is ______ language. a. high-level b. low-level c. Medium level d. assembly level 2. The C program is converted to machine language using ______ a. an assembler b. compiler c. interpreter d. operating system 3. The c program should be written in ________ case a. Lower b Upper c. Sentence d. Any 4. The role of compiler is to translate source code program into __________ a. Octal code b. Object code c. decimal code d. any of the above 5. Each C instruction in program should terminate with ___ a. dot(.) b. Comma(,) c. Semicolon (;) d. curly bracket{} 6. An interpreter reads the source code of a program ________ a. one line at a time b. two lines at a time c. complete program d. none of the above 7. In C variable must begin with character w/o spaces but it permits_______ a. an underscore(_) b. A star c. an ampersand

d. any of the above 8. In C the statement following main () are enclosed with _____ a. ( ) b. < > c. {} d. none of the above 9. An integer type variable can occupy _____ bytes of memory. a. 4 b.2 c.8 d.0 10. In C main () is a ________ a. function/starting point b. user created function c. string function d. variable 11. The keyword const keeps the value of a variable_____ a. constant b. variant c. mutable d. none 12. Which one is the incorrect variable name? a. else b.name c. age d. F_name 13. What will be the o/p of the following program? void main() { int ans=2; int m=10; int k; k=!((ans<2) && (m>2)); printf("\n %d",k); } a. 1 b.0 c -1

d. 14. What is the value of ! 0 ? a. 1 b.0 c.-1 d. none of above 15. Is j++ is equal to j+1 ? a. True b. false c. none of the above d. can not compare 16. The range of the integer type no is _____ to ____. a. -32768 to 32767 b. 0 to 65535 c. both d. none of the above 17. charter constants are always enclosed in ____. a. double quotes (") b. single quotes (') c. Any of a or b d. none of the above 18. The %c is used to print the ____ type of data. a. integer b. character c. Array d. none of above 19. The maximum length of variable name supported by most of the compilers is _____. a. 10 b.5 c.8

d. Any of the above 20. ____- data type occupies 4 bytes in memory. a. int b. char c. float d. unsigned 21. The ________ are types of arithmetic operators. a. Unary, binary, turnery b .Unary c. Binary d. none of the above 22. ++ is the unary operator used for ______ a. Increment b. Minus c. Decrement d. none of the above 23. && is the ________ type of operator. a. arithmetic b. Logical c. relational d. none of the above 24. || is used as logical _____ operator. a. AND b. NOT c. OR d. Any of the above 25. getch() is called as _______. a. formatted function b Unformatted function c. Bothe a and b

d. none of the above

26. What will be the last value of c after the execution of following code? void main() { int c=1,d=0; while (d<=9) { printf(\n %d %d,++d,++c); } } a. 11 b. 10 c. 12 d. 9 27. What will be the last value of x after the execution of following code? void main() { int k; float x=0; for (k=0;k<10;k++) x=x+0.1; printf(\n x=%d,x); } a. x=1 b. x=0 c. x=11 d. None of the above 28. What will be the last value of x after the execution of following code? void main() { int x=1; do while (x<=10) { x++; } while (x<=5); printf(\n x=%d,x); } a. x=11 b. x=6 c. x=2

d. None of the above 29. What will be final values of x and y? void main() { Int x=1,y=1; do while (x<=8) { X++;y++; } while (y<=5); printf(x=%d y= %d,x.y); } a. x=9 y=9 b. x=9 y=6 c. x=6 y=6 d. None of the above 30. How many while statements are possible in the do-while loop? a. 1 b.2 c. 3 d. None of the above 31. The switch case statement is used to a. switch between functions in program b. switch from one variable to another variable c . Choose one option from multiple possibilities which may arise due to different values of a single variable d. All of the above

32. The default statement in switch-case in executed when a. All the case statements are false b. One of the case is true c . One of the case is false d. One or more case is true

33. Each case statement is switch is separated by a. exit() b. goto c. break d. continue 34. The key word else can be used with a. switch statement b. if statement c. do while statement d. for loop 35. What will be the output of the following program? void main() { char x=E switch (x) { case H : printf(%c,H); case E : printf(%c,E); case L : printf(%c,L); case l : printf(%c,L); case o : printf(%c,o); } } a. HELLO b. ELLO c. E d. None of the above

36. The switch can only test for ------ equality a. Non equality b. Equality c. Both a and b are true d. Both a and b are false

37. In switch case, character values are automatically converted to

a. Boolean values b String values c Integer values d. Float values

38. What will be output of the following c program? #include<stdio.h> int main() { int goto=5; printf("%d",goto); return 0; } a. 5 b.** c. Compilation error d. None of these 39. What will be output of the following program? #include<stdio.h> int main() { int i=5,j; j=++i+++i+++i; printf("%d %d",i,j); return 0; } a.7 21

b. 8 21 c. 7 24 d.8 24 40. What will be output of following c code? #include<stdio.h> int main() { int i=2,j=2; while(i+1?--i:j++) printf("%d",i); return 0; } a. 1 b.2 c.3 d.4 41. Which of the following is not a valid identifier in c? a.$Currencyvalue b. Part_no c. Able2 d.None of the above 42. What is the value of z? void main() { int x=5; float y=9.0; float z; z=y/x; }

a.1 b.1.8 c.2 d. None of the above 43. Which of the following statements evaluates min, the minimum of a and b a. Min=(a<b)?a:b b. Min=(a>b)?b:a c. Both are correct d. Neither is correct 44. What is the output of the following program: main() {

int i=0; switch(i++) { case 0: printf(Merry); break; case 1: printf(Christmas); break; case 2: printf(to); break; default: printf(You);

} } a. Merry b. Merry Christmas to you c. Christmas d. The program will not compile 45. What is the output of following program

main() { int i=0; while(++i<4) printf(Hello!); } a. Hello! Hello! Hello! b. Hello! Hello! Hello! Hello! c. Hello! Hello! Hello! Hello! Hello! d. None of the above; program has an reeor 46. What is the output of following program main() { int i=0; do printf(Hello!); while(i++<4); } a. Hello! Hello! Hello! b. Hello! Hello! Hello! Hello! c. Hello! Hello! Hello! Hello! Hello! d. None of the above; program has an error 47. What is the output of following program main() { int i; for(i=0,i<4,i++) printf(Hello!); } a. Hello! Hello! Hello! b. Hello! Hello! Hello! Hello! c. Hello! Hello! Hello! Hello! Hello! d. None of the above; program has an error

48. What is the output of following code main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf(%d%d%d%d%d,i,j,k,l,m); } a. -1 -1 0 2 0 b. -1 -1 0 2 1 c. 0 0 1 3 1 d.1 1 1 1 1 49. What is the output of following code main() { int c=- -2; printf(c=%d,c); } a. C=-2 b. C=2 c. Compiler error d. None of the above 50. What is the output of following code main() { printf(\nab); printf(\bsi); printf(\rha); } a. absiha b. abbsirha c. hai d. none of the above

51. c language is developed by a. ken Thompson b. Dennis Ritchie c. Peter Narton d. Martin Richards 52. C program are converted into machine language with the help of a. An editor b. A compiler c. An operating system d. None of the above 53. An expression contains relational operators, assignment operators and arithmetic operators. In the absence of parentheses, they will be evaluated in which of the following order: a. Assignment, relational, arithmetic b. relational, arithmetic, Assignment c. arithmetic, Assignment, relational d. arithmetic, relational, assignment 54. What is the output of the following code? #include<stdio.h> void main() { char letter =`Z`; printf("\n%c",letter); } a. Z b. 90 c. Error d. Garbage Value

55. What will be output if you will compile and execute the following c code? #include<stdio.h> int main() { int a=10; printf("%d %d %d",a,a++,++a); return 0; } a. 12 11 11 b.12 10 10 c.11 11 12 d. 10 10 12 ------------------------------------------------------------------------------------------------------------------------------56. What will be output if you will compile and execute the following c code? #include<stdio.h> int main() { int x; for(x=1;x<=5;x++); printf(%d,x); return 0; } (A) 4 (B) 5 (C) 6 (D) Compiler error 57. The do-while statement first execute the loop body & then evaluate the loop control expression. (A) True (B) False 58. Which of the following special symbol allowed in a variable name?

A. C.

* (asterisk) - (hyphen)

B. D.

| (pipeline) _ (underscore)

59. Which of the following is not logical operator? A. C. & || B. D. && !

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

61. Which of the following cannot be checked in a switch-case statement? A. C. Character Float B. D. Integer Enum

62. What will be the output of the program? #include<stdio.h> int main() { int i=0; for(; i<=5; i++) printf("%d,", i); return 0;

} A. C. 0, 1, 2, 3, 4, 5 1, 2, 3, 4 B. D. 5 6

6. What will be the output of the program? #include<stdio.h> int main() { unsigned int i = 65535; /* Assume 2 byte integer*/ while(i++ != 0) printf("%d",++i); printf("\n"); return 0; } A. B. C. D. Infinite loop 0 1 2 ... 65535 0 1 2 ... 32767 - 32766 -32765 -1 0 No output

63. What will be the output of the program? #include<stdio.h> int main() { int x = 3; float y = 3.0;

if(x == y) printf("x and y are equal"); else printf("x and y are not equal"); return 0; } A. C. x and y are equal Unpredictable B. D. x and y are not equal No output

64. What will be the output of the program? #include<stdio.h> int main() { float a = 0.7; if(0.7 > a) printf("Hi\n"); else printf("Hello\n"); return 0; } A. C. Hi Hi Hello B. D. Hello None of above

65. What will be the output of the program?

#include<stdio.h> int main() { int a=0, b=1, c=3; *((a) ? &b : &a) = a ? b : c; printf("%d, %d, %d\n", a, b, c); return 0; } A. C. 0, 1, 3 3, 1, 3 B. D. 1, 2, 3 1, 3, 1

66. Which of the following is the correct order of evaluation for the below expression? z=x+y*z/4%2-1 A. C. */%+-= /*%-+= B. D. =*/%+*%/-+=

67. Which of the following is the correct usage of conditional operators used in C? A. C. a>b ? c=30 : c=40; max = a>b ? a>c?a:c:b>c?b:c B. D. a>b ? c=30; return (a>b)?(a:b)

68. Which of the following are unary operators in C? 1. ! 2. sizeof

3. ~ 4. && A. C. 1, 2 2, 4 B. D. 1, 3 1, 2, 3

69. The C language consists of ____ number of keywords. A. 32 C. 24 A. %If C. %Iu A. auto C. int A. && C. % 73. What is sizeof In C? A. Operator C. Both (A) and (B) A. typedef C. near Line 1: Line 2: Line 3: Line 4: A. Line 1 C. Line 3 B. Reserve Word D. Function B. const D. complex void main ( ) { print(\n Hello World) } B. Line 2 D. Line 4 B. 40 D. 56 B. %Id D. %f B. register D. function B. || D. size of

70. Which format specifier is used to print the values of double type variable

71. Which of the following is not s keyword of C ?

72. Which of the following operator has right to left associativity?

74. Which is not keyword in C ?

75. Find out on which line no . you will get an error ?

76. What will be the output of the following program ? void main ( ) { int x=10,y=20; printf (\n %d,x,y); } A. 10 C. 10 20 77. A declaration float a,b; A. 1 bytes C. 8byte B. 20 D. None of these accupies ______of memory ? B. 4bytes D. 16 bytes void main() { int x=40;y=30;z=80; if(x<y<z) printf(\n Hello world); else printf(\nGood by); A. Hello world C. Compile time error A. , C. @ A. 1970 C. 1976 81. C is a ___ language A. High Level C. Middle Level A. DOS C. Unix A. 0 to 256 C. -65536 to +65536 B. Low Level D. Machine Level B. Windows D. All of these B. -32768 to +32767 D. No Specific range B. Good by D. None of these B. $ D. None of these B. 1972 D. 1980

78. What is the output of the following program ?

79. which of the following is an operator in C?

80. C was developed in the year ___

82. C language is available for which of the following Operating Systems?

83. What is the valid range of numbers for int type of data?

84. Which escape character can be used to begin a new line in C? A. \a C. \m A. 1 byte C. 4 bytes A. Assignment C. Logical A. faster C. evaluated first 88. Header files in C contain A. Compiler commands C. Header information of C programs B. Library functions D. Operators for files B. \b D. \n B. 2 bytes D. 8 bytes B. Increment D. Rational B. takes less memory D. takes no Arguments

85. What will be the maximum size of a float variable?

86. The operator && is an example for ___ operator.

87. Operators have precedence. Precedence determines which Operator is

89. What will be the output of following program ? #include<stdio.h> int main( ) { int a=300,b,c; if(a>=400) b=300; c=200; printf("%d,%d\n",b,c); return 0; } A. B. C. D. Garbage value, Garbage Value 300,200 200,300 Garbage value,200

90. Find the output. void main() {

int i=1,j=2,k=3; if(i==1) if(j==2) if(k==3) { printf("ok"); break; } else printf("continue"); printf("bye"); } A. B. C. D. Ok Okbye Misplaced break None of these

91. Statements of C program ends with A. comma B. semicolon C. colon D. None of these 92. All of the following are examples of computer input units EXCEPT:

A. B. C. D.

Scanner Speaker Bar code reader Keyboard

93.. What does the diamond flowchart symbol represent?

A. input/output B. terminal C. decision D. connector 94. ---- Symbol is used to represent loop A. Diamond B. Hexagon

C. Rectangle D. Parallelogram 95 . An algorithm is defined as A. a mathematical formula that solves a problem. B. a tempo for classical music played in a coda. C. a logical sequence of a steps that solve a problem. D. a tool that designs computer programs and draws the user interface. 96. Documentation section is used to write ---A. B. C. D. User defined functions Library files Information about program main function

97. ---- is the extension for header file A. B. C. D. .header .h .txt .c

98. ---- is the extension for C program A. B. C. D. A. B. C. D. .header .h .txt .c Single quote Double quote Curly braces Round braces

99. Character constant is declared in ---

100. Which of the following is not a datatype A. int B. float

C. string D. char 101. String constant is declared in --A. B. C. D. Single quote Double quote Curly braces Round braces

102. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int a=10; printf("%d\t %d\t %d",a,a++,++a); return 0; } a) 12 11 b) 12 10 c) 11 11 d) 10 10 11 10 12 12

103. To read a single character from keyboard ----- function is used. A. B. C. D. putchar() getchar() scanf() printf()

104. putchar() function is used for ---- a character on a screen. A. B. C. D. Writing reading execute none of above

105. . Which of the following statements are correct about the below program?

#include<stdio.h> int main() { int i = 10, j = 20; if(i = 5) && if(j = 10) printf("Have a nice day"); return 0; } A. B. C. D. Output: Have a nice day No output Error: Expression syntax Error: Undeclared identifier if

106. What will be output if you will compile and execute the following c code? #include<stdio.h> #define x 5+2 int main() { int i; i=x*x*x; printf("%d",i); return 0; } (A) 343 (B) 27 (C) 133 (D) Compiler error

(E) None of above 107. What will be output if you will compile and execute the following c code? #include<stdio.h> int main() { int a=2; if(a==2) { a=~a+2<<1; printf("%d",a); } else{ break; } return 0; } (A) It will print nothing. (B) -3 (C) -2 (D) 1 (E) Compiler error 108. Which of the following are invalid variable names (A) AVERAGE (B) Interest paid (C) dist in km (D)Name 109. What would be the output of the followingmain() { Int i=2, j=3,k,l; float a, b;

k= i/j*j; i=j/i*I; a=i/j*j; b=j/i*I; printf(%d,%d,%f,%f,k,l,a,b); } (A) (B) (C) (D) 0 ,2 ,0.00, 2.00 2,0, 0.00, 2.00 0,0,2.00, 2.00 2,2, 0.00,0.00

110. If a is an integer variable, a=5/2; will return a value (A) 2.5 (B)3 (C ) 2 (d) 0 111. the expression a= 7/22*(3.14+2)*3/5; evaluates to (A) 8.28 (B) 6.28 ( c) 3.14 (D) 0 112. The expression x=4+2% -8 evaluates to (A) -6 (B) 6 (C )4 (D)none of above 113. In C Conditonal operator is also called as (A) relational operator (B) ternary operator (C)logical operator (D) arithmetic operator

114. The --------- statement is used to skip a part of the statement in a loop (A) continue (B) break (C )exit (D)switch 115. what will be the output of the following main() { Int i=4,z=12; If(i=5 || z>50) printf(\n Dean of students affairs); else printf(\n Dosa); } (A) (B) (C) (D) Dosa Dean of students affairs Dosa Dean of students affairs None of above

116. How many times the following loop is executed main() { int i; i=0; while( i<=255) { printf(\n %d,i); } getch(); } (A) (B) (C) (D) 254 255 256 257

117. point out error if any in following 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 at least a semicolon in while (C )the while loop should be replaced by for loop (D)no error 118. what will be the output of following program main() { int k, j=2; switch(k=j+1) { Case 0 : printf(\n tailor); Case 1 : printf(\n tutor); Case 2: printf(\n tramp); default: printf(\n pure simple Egghead); } } (A) (B) (C) (D) pure simple Egghead tutor tramp tailor

119. The default case is required in switch statement (A) true (B)false 120. A switch statement can always be replaced by a series of if else statements (A)true (B)false

You might also like