C Language | VIVA / MCQ with Answer

C language


1. The execution of a C program starts from _____.

A. function

B. Header file

C.main()

D. Processor

 ANSWER: C

2. The C supports _____ basic data types

A. 8

B. 2

C. 10

D. 4

 ANSWER: D

3. The C program is converted to machine language

using________. 

A. An assembler.

B. A compiler.

C. An interpreter.

D. An operating system.

 ANSWER: B

4. The C was developed in the year___________. 

A. 1972.

B. 1960.

C. 1975.

D. 1971.

 ANSWER: B

5. C language has been developed at_________. 

A. AT & T Bell labs, USA.

B. IBM, USA

C. Borland International, USA

D. Sun Microsystems ANSWER: A

6. The C language is an offspring of _________. 

A. B language.

B. ALGOL language.

C. BASIC language.

D. ARITHMETIC language

 ANSWER: A

7. The programs should be written only in________. 

A. lower case.

B. upper case.

C. title case.

D. sentence case.

 ANSWER: A

8. The role of a compiler is to translate source program statements to_________. 

A. object codes.

B. octal codes.

C. decimal codes.

D. binary codes.

 ANSWER: A

9. The extension for C program files by default is_________.

 A. .c

B. .d

C. .obj

D. .exe

 ANSWER: A

10. An escape sequence begins with _____________.

A.

B. /.

C. ?.

D. #.

 ANSWER: A

11. The C language is closely associated with _________.

A. MS-DOS.

B. Linux.

C. Unix.

D. MS-Windows. ANSWER: C

12. The C program is highly case sensitive

A. false

B. true

C. both (A) and (B)

D. None of the above

 ANSWER: B

13. Each instruction in C program is terminated by__________.

A. dot (.).

B. Comma (,).

C. Semi-colon (;) 

D. Curly brace ({}).

 ANSWER: C

14. Which of the following declaration is not supported by C?

A. String str;.

B. char *str;.

C. float str = 3e2;.

D.Both String str; & float str = 3e2;.

 ANSWER: A

15. ANSI committee was setup in the summer of___________. 

A. 1983.

B. 1985

C. 1990.

D. 1976.

 ANSWER: D

16. A declaration float a, b; occupies ___ of memory. 

A. 1

Byte.

B. 4 Bytes.

C. 8 Bytes.

D. 16 Bytes.

 ANSWER: C

17. Identify the wrong statement. 

A. Putchar(65).

B. putchar('x').

C. putchar("x").

D. putchar(' ').

 ANSWER: C

18. An interpreter reads the source code of a program__________. 

A. One line at a time.

B. Two lines at a time.

C. complete program in one stroke.

D. complete program in two strokes.

 ANSWER: A

19. A compiler compiles the source code________________.

A. complete program in one stroke.

B. One line at a time.

C. Two lines at a time.

D. complete programs in two strokes.

 ANSWER: A

20. A character variable can store only___________. 

A. 1 character.

B. 20 characters.

C. 254 characters.

D. 265 characters.

 ANSWER: A

21. C variable cannot start with_________. 

A. a number.

B. an alphabet.

C. a character.

D. a string.

 ANSWER: A

22. A short integer variable occupies memory_________.

A. 2 bytes.

B. 4 bytes.

C. 1 byte.

D. 8 bytes.

 ANSWER: A

23. According to __________ C keywords are reserved words.

A. a compiler.

B. an interpreter.

C. header file.

D. an interpreter and header file.

 ANSWER: A

24. The declaration of C variable can be done________. 

A. anywhere in the program.

B. in declaration part.

C. in executable part.

D. At the end of the program.

 ANSWER: B

25. In C one statement can declare_________. 

A. only one variable.

B. Two variables.

C. Ten variables.

D. any number of variables.

 ANSWER: D

26. The word char is a_______. 

A. keyword.

B. password.

C. header file.

D. statement.

 ANSWER: A

27. The variables are initialized using_________. 

A. greater than(>).

B. equal to (=).

C. twice equal to(==).

D. an increment operator(++).

 ANSWER: B

28. An unsigned integer variable contains values________.

A. Greater or equal to zero.

B. less than zero.

C. only zeros.

D. (1) & (2) both.

 ANSWER: A

29. The keyword const keeps the value of a variable_________. 

A. constant.

B. Mutable.

C. variant.

D. different

 ANSWER: A

30. Identifiers are_________. 

A. User-defined names.

B. reserved keywords.

C. C statements.

D. Tokens.

 ANSWER: A

31. In C every variable has_______. 

A. a type.

B. a name. 

C. a value.

D. a size.

 ANSWER: A

32. The range of character data type is_________. 

A. -128 to 127.

B. 0 to 255.

C. 0 to 32767.

D. 126 to 275.

 ANSWER: A

33. The keyword volatile keeps the value of variable__________. 

A. constant.

B. mutable 

C. variant 

D. different.

 ANSWER: A

34. Which is the incorrect variable name__________.

A. Else.

B. name.

C. age.

D. char.

 ANSWER: A

35. How many keywords are there in ANSI C?

A. 32.

B. 33.

C. 42.

D. 15.

 ANSWER: A

36. How many variables can be initialized at a time? 

A. one.

B. two.

C. Five.

D. any number of variables

 ANSWER: A

37. Which of the following statements is valid?

A. 5+5=a;

B. ss=12.25;

C. st=m * b;

D. is = A+ 10;

 ANSWER: A

38. ___________ refers to the accuracy of the calculations.

A. Integrity.

B. Clarity.

C. Simplicity.

D. Modularity.

 ANSWER: A

39. The variable name can be started with__________. 

A. underscore symbol (_).

B. asterisk symbol(*).

C. ampersand symbol(&)

D. minus symbol(-).

 ANSWER: A

40. What is the value of sizeof(char)? 

A. 1.

B. 0.

C. -1.

D. -2.

 ANSWER: A

41. ________ decides which operator is to be used first. 

A. Hierarchy.

B. Priority.

C. ladder.

D. Precedence.

 ANSWER: D

42. The & operator displays________. 

A. address of the variable.

B. value of the variable. 

C. result of the variable

D. both (a) & (b).

 ANSWER: A

43. Addition of two numbers is performed using _________.

A. Arithmetic operators.

B. logical operator.

C. unary operator.

D. comma operator.

 ANSWER: A

44. What is the value of 10%8?

A. 8.

B. 2.

C. 1.

D. 0.

 ANSWER: B

45. What is the result of the expression (10/3)*3+5%3? 

A. 11.

B. 10.

C. 8.

D. 1.

 ANSWER: A

46. ​​What is the result of the expression (23*2) % (int) 5.5?

A. 2.

B. 1.

C. 3.

D. 0.

 ANSWER: B

47. What is the result of 5/2? 

A. 4.

B. 8.

C. 2.

D. 5.

 ANSWER: C

48. What is the result of 5&&2?

A. 0.

B. 1.

C. 2.

D. 5.

 ANSWER: B

49. Which function is appropriate for accepting a string? 

A. gets().

B. getch().

C. getche().

D. scanf().

 ANSWER: A

50. What is the ASCII range for 0 to 9 digits? 

A. 48 to 57.

B. 65 to 90.

C. 97 to 122.

D. 86 to 93.

 ANSWER: C

51. What is the ASCII range for A to Z letters? 

A. 65 to 90.

B. 48 to 57.

C. 97 to 122

D. 86 to 98.

 ANSWER: A

52. The escape sequence \t is a_________. 

A. tab.

B. next line.

C. backspace.

D. skip the line.

 ANSWER: A

53. Which is the correct statement for finding the cube of 2?

A. pow(2,3);.

B. pow(3,2);.

C. pow(3);.

D. pow(2);.

 ANSWER: A

54. The abs() function displays________. 

A. absolute value.

B. negative value.

C. zero value.

D. positive value

 ANSWER: A

55. The switch statement is used to________. 

A. switch between functions in a program.

B. Switch from one variable to another variable.

C. Choose from multiple possibilities which may arise due to different values ​​of a single variable.

D. use switching variables.

 ANSWER: C

56. The default statement is executed in switch case when________. 

A. All the case statements are false.

B. One of the cases is true.

C. One of the cases is false

D. all the case statements are true.

 ANSWER: A

57. Each case statement in switch () is separated by______.

A. break.

B. continue.

C. exit().

D. goto.

 ANSWER: A

58. The keyword else can be used with________. 

A. if statement.

B. switch() statement.

C. do while statement.

D. if..else statement

 ANSWER: A

59. How many while statements are possible in do..while loop? 

A. 2

B. 1

C. 4

D. 3

 ANSWER: B

60. An array is a collection of_________. 

A. different data types.

B. same data types.

C. different data types.

D. only one data type.

 ANSWER: B

61. ++ is ____ operator

A. a binary

B. a unary

C. an assignment 

D. a logical

 ANSWER: B

62. A character array always ends with________. 

A. Null (\0) character.

B. question mark (?).

C. full stop(.).

D. exclamation mark(!).

 ANSWER: A

63. If you delete array without stating the elements it will be set to________. 

A. a null value.

B. zero.

C. garbage value

D. no value.

 ANSWER: A

64. Arrays cannot be initialized if they are________. 

A. automatically.

B. external.

C. static.

D. dynamic.

 ANSWER: A

65. All the elements in the array must be________. 

A. initialized.

B. defined.

C. initialized, defined.

D. created.

 ANSWER: A

66. The string always ends with__________. 

A. \0 character.

B. \character.

C. 0\ character.

D. 0 character.

 ANSWER: A

67. The fastest way to exchange two rows in a two dimensional array is________. 

A. exchange the addresses of each element in the two rows.

B. exchange the elements of the two rows.

C. store the addresses of the rows in an array of pointers and exchange the pointers.

D. exchange both addresses and pointers in each row.

 ANSWER: C

68. Which header file is essential for using strcmp() function?

A. string.h;

B. strings.h;

C. text.h;

D. strcmp.h

 ANSWER: A

69. Arrays are passed as arguments to a function by_________. 

A. value.

B. reference.

C. value, reference.

D. recursion

 ANSWER: B

70. It is necessary to declare the type of a function in the calling program if _______. 

A. The function returns a non-integer value.

B. the function returns an integer.

C. The function is not defined in the same file.

D. The function is defined in the same file.

 ANSWER: A

71. Recursion is a process in which a function calls _________.

A. itself.

B. another function.

C. main( ) function.

D. sub program.

 ANSWER: A

72. By default the function returns_______. 

A. integer value.

B. float value.

C. char value.

D. double.

 ANSWER: A

73. The meaning of keyword void before the function name means________. 

A. function should not return any value.

B. function should return a value.

C. no arguments are passed.

D. some arguments are passed

 ANSWER: A

74. The function name itself is_________. 

A. an address.

B. value.

C. definition. 

D. statement.

 ANSWER: A

75. A global pointer can access variable of________. 

A. all user-defined functions.

B. only main() function.

C. Only library functions.

D. external functions.

 ANSWER: D

76. Which among the following is an unconditional control structure?

A. do-while.

B. if-else.

C. goto.

D. for.

 ANSWER: C

77. A static variable is one that________.

A. retains its value throughout the life of the program.

B. cannot be initialized.

C. is initialized once at the commencement of the execution and cannot be changed at the run time.

D. is same as an automatic variable but is placed at the head of the program.

 ANSWER: C

78. An external variable is one_______.

A. which is globally accessible by all functions.

B. which is declared outside the body of any function.

C. which resides in the memory till the end of the program.

D. which is locally accessible by all functions.

 ANSWER: A

79. If a storage class is not mentioned in the declaration then default storage class is_________. 

A. automatic.

B. static.

C. external.

D. register.

 ANSWER: A

80. If the CPU fails to keep the variable in CPU registers, in that case the variables are assumed_______.

A. automatic.

B. static.

C. external.

D. register.

 ANSWER: D

81. Identify the most appropriate sentence to describe the unions_______.

A. Unions contain members of different data types which share the same storage area memory.

B. Unions are like structures.

C. Unions are less frequently used in the program.

D. Unions are used for set operations.

 ANSWER: A

82. The member variable of structure is accessed by using______. 

A. dot (.) operator.

B. arrow (->) operator.

C. asterisk * operator.

D. ampersand & operator.

 ANSWER: A

83. The structure combines variables of_______. 

A. similar data types.

B. dissimilar data types.

C. unsigned data types.

D. signed data types.

 ANSWER: B

84. The typedef statement is used for________. 

A. declaring user-defined data types.

B. Declaring variant variables.

C. For typecasting of variables.

D. For typing static variables.

 ANSWER: A

85. The number of bytes required for enumerated data type in memories are________. 

A. 1 bytes.

B. 4 bytes.

C. 2 bytes. 

D. 3 bytes

 ANSWER: C

86. Which data type is most suitable for storing a number 65000 in a 32-bit system? 

A. short.

B. int.

C. long.

D. double.

 ANSWER: A

87. Which of the following is not a correct variable type? 

A. float.

B. real.

C. int.

D. 0x16.

 ANSWER: B

88. The number of digits present after decimal in float is________. 

A. 4.

B. 1.

C. 16.

D. 6.

 ANSWER: D

89. In a 32-bit compiler, which 2 types have same size? 

A. char and int.

B. int and float.

C. short and int.

D. float and double.

 ANSWER: B

90. The union holds_______. 

A. One object at a time.

B. multiple objects.

C. different objects.

D. two objects.

 ANSWER: A

91. Bit fields are used only with________. 

A. int data type.

B. float data type.

C. char data type.

D. unsigned int data type.

 ANSWER: D

92. The fscanf () statement reads data from________.

A. file.

B. keyboard.

C. put.

D. get.

 ANSWER: A

93. When fopen () fails to open a file it returns______. 

A. NULL.

B. -1.

C. 0.

D. -1.

 ANSWER: A

94. A file opened in w+ mode can be________.  

A. read/write.

B. read only.

C. write only.

D. only close.

 ANSWER: A

95. Command line arguments are used to accept arguments from________. 

A. command prompt of operating system.

B. through scanf( ) statement.

C. both (a) and (b).

D. Through the printf() statement

 ANSWER: A

96. The redirection operator > transfers any output to________. 

A. text file.

B. console.

C. binary file.

D. number file.

 ANSWER: B

97. This function is used to detect the end of file________.

A. feof( ).

B. ferror( ).

C. fputs( ).

D. fgetch( ).

 ANSWER: A

98. The EOF is equivalent to_______.

A. -1.

B. 0.

C. 1.

D. {}.

 ANSWER: B

99. The scanf() statement is an_______.

A. input.

B. output.

C. pointer.

D. file.

 ANSWER: A

100. what is file?

A. collection of records.

B. collection of arguments.

C. group of arguments

D. all.

 ANSWER: A

101. All standard C library <math.h> functions return what data

type? A. Decimal.

B. float.

C. double.

D. int.

 ANSWER: C

102. When a function is called recursively all automatically

variables are ___________. A. stored in stack.

B. stored in queue.

C. stored in array.

D. stored in linked list.

 ANSWER: A

103. What is the output of the following code? main() { printf(%d\n,sum(5)); } int sum(int n) { if (n<1) return n; else return(n+sum(n-1)); 

A. 10.

B. 16.

C. 14.

D. 15.

 ANSWER: D

104. Pointers are supported in________. 

A. FORTRAN.

B. PASCAL.

C. C

D. FORTRAN, C, PASCAL. 

ANSWER: D

105. Pointer variable may be assigned_______.

A. An address value represented in hexadecimal.

B. an address value represented in octal.

C. the address of another variable.

D. an address value represented in binary.

 ANSWER: C

106. The operators exclusively used in connection with pointers are________. 

A. *

B. &

C.

D. a and b

 ANSWER: D

107. Identify the wrong declaration statement________. 

A. int *p, a=10.

B. int a=10,*p=&a.

C. int *p=&a, =10.

D. options 1 and 2.

 ANSWER: C

108. The operator % can be applied only to __________. 

A. float values.

B. double values.

C. character values.

D. integer values.

 ANSWER: D

109. The address of operator returns________. 

A. the address of its operand.

B. 1 value.

C. Both options a and b.

D. r value.

 ANSWER: A

110. Structural programming approach makes use of _________. 

A. modules.

B. control structures.

C. User defined data types.

D. All of the above.

 ANSWER: D

111. The number of arguments used in malloc ( ) is_______.

A. 0.

B. 1.

C. 2.

D. 3.

 ANSWER: B

112. Loss in precision occurs for typecasting from____________. 

A. float to double.

B. char to short.

C. float to int.

D. long to float.

 ANSWER: C

113. The pointers can be used to achieve_____. 

A. call by function.

B. call by reference.

C. call by name.

D. call by procedure.

 ANSWER: B

114. Which among the following is odd one out?

A. printf.

B. fprintf.

C. Putchar.

D. scanf .

 ANSWER: D

115. Given int *p1,**p2,***p3,v=25;How to obtain the value of v using pointer variable? 

A. *p1.

B. **p2.

C. ***p3.

D. all the above.

 ANSWER: D

116. Identify the correct statement for the given expression as________. Float fnum [10], *fptr = fnum 

A. fnum is pointer variable.

B. fnum is a fixed address and not a variable.

C. fnum is an array variable.

D. fnum is an address that can be modified.

 ANSWER: B

117. Given int a[5]; how to declare array in the function definition if the function call is sort(a)______. 

A. sort(int *a).

B.sort(int a[5]).

C. sort(int *a),sort(int a[5]).

D.sort(int a).

 ANSWER: C

118. The value of EOF is_____.

A. -1

B. 0.

C. 1.

D. 10.

 ANSWER: A

119. The declaration float *a[5];is_______. 

A. an ordinary array.

B. a pointer to an array.

C. an array of pointers.

D. pointer to an array.

 ANSWER: C

120. The arguments argc in main( ) counts_______.

A. The number of command line strings including the execution command.

B. The number of command line strings excluding the execution command.

C. the number of lines in a program.

D. the number of characters in a program.

 ANSWER: A

121. In the declaration double (*pf)( ); as _________. 

A. pf is a pointer to a function.

B. pf is a function returning pointer.

C. pf is a pointer to array.

D. pf is an array of pointers.

 ANSWER: A

122. The operation that can be performed on pointers are______.

A. Addition and subtraction of a pointer and an integer.

B. Assignment of pointer using pointer expression.

C. assignment of the value 0 to a pointer.

D. all the above.

 ANSWER: D

123. When applied to a variable, what does the unary & operator yield? 

A. the variable value.

B. the variable address.

C. the variable format.

D. the variable right value.

 ANSWER: B

124. Which of the following is the most accurate statement about runtime memory? 

A. memory is allocated by using malloc ( ).

B. Memory is freed by a garbage collector.

C. allocated memory can be freed by calling free ( ).

D. memory is allocated by using malloc ( ), allocated memory can be freed by calling free().

 ANSWER: D

125. The storage class allowed for parameters is _________.

A. auto storage class.

B. static storage class.

C. external storage class.

D. register storage class.

 ANSWER: C

126. The function strcpy(s1,s2) in string.h __________. 

A. copies s1 to s2.

B. Copies s2 to s1.

C. appends s1 to the end of s2.

D. appends s2 to the end of s1.

 ANSWER: B

127. Recursive call results when ________. 

A. a function calls itself.

B. a function1 calls another function, which in turn calls the function1

C. both 1 & 2.

D. A function calls another function.

 ANSWER: C

128. Which statement correctly defines a character string with a length of 4 plus 1 for the terminating NULL?

A. char string[ ];.

B. char* string[ ];.

C. char * string[5];.

D. char string[5];.

 ANSWER: D

129. Which are valid?

A. Pointers can be added.

B. Pointers can be subtracted.

C. Integers can be added to pointers

D. Both a and b are correct.

 ANSWER: A

130. The pointers can be used to achieve _________. 

A. call by function.

B. call by reference.

C. call by name.

D. call by procedure.

 ANSWER: B

131. Structure is a_____. 

A. scalar data type.

B. derived data type.

C. both a and b.

D. primitive data types.

 ANSWER: B

132. Structure is a data type in which______.

A. Each element must have the same data type.

B. Each element must have pointer type only.

C. Each element may have different data type.

D. no element is defined.

 ANSWER: C

133. C provides a facility for user defined data type using______. 

A. pointer.

B. function.

C. structure.

D. array.

 ANSWER: B

134. Structure declaration _______. 

A. describes the prototype.

B. creates structure variable.

C. defines the structure function.

D. not necessary.

 ANSWER: A

135. A structure_________.

A. can be read as a single entity.

B. cannot be read as a single entity.

C. can be displayed as a single entity.

D. has a member variable that cannot be individually read

 ANSWER: B

136. A structure has________. 

A. pointers as its members.

B. scalar data type as its members.

C. structure as its member.

D. all the above.

 ANSWER: C

137. In a structure definition________.

A. Initialization of structure members are possible.

B. Initialization of array of structures are possible.

C. both a and b.

D. Initialization of array of structures are not possible.

 ANSWER: C

138. The function putchar() uses ___________ . 

A. no argument.

B. One argument that is a character variable.

C. one argument that is the ASCII value of a character.

D. one argument, that is a string.

 ANSWER: A

139. The version C is also referred to as __________. 

A. C10.

B. C70.

C. C89.

D. C90.

 ANSWER: C

140. C program was developed at __________ laboratories.

A. USA.

B. Sun.

C. Bell.

D. C++.

 ANSWER: C

141. AC program can be viewed as a group of building blocks called __________. 

A. groups.

B. functions.

C. statements.

D. structures.

 ANSWER: B

142. All statements in the declaration and executable parts end with a __________. 

A. comma.

B. bracket.

C. parenthesis

D. semicolon.

 ANSWER: D

143. The smallest individual units in a C program are called __________. 

A. characters.

B. symbols.

C. Tokens.

D. identifiers.

 ANSWER: C

144. All keywords must be written in ___________. 

A. upper case.

B. lower case.

C. within codes.

D. separately.

 ANSWER: B

145. ANSI C supports __________ classes of data types

A. one.

B. two.

C. three.

D. four.

 ANSWER: C

146. A double data type has __________ bytes. 

A. two.

B. four.

C. six.

D. eight.

 ANSWER: D

147. Declaration of __________ must be done before they are used in the program. 

A. variables.

B. constants.

C. loops.

D. branches.

 ANSWER: A

148. The enumerated data type is a __________ data type. 

A. derived data type.

B. User-defined data types.

C. primary data type.

D. fundamental data type.

 ANSWER: B

149. The variable which has been declared before the main is called __________ variable. 

A. local.

B. global.

C. static.

D. auto.

 ANSWER: B

150. Expressions are evaluated using a __________ operator

A. conditional operators.

B. assignment operators.

C. bitwise operators.

D. special operators.

 ANSWER: B 

151. Division of labor, authority hierarchy, formal selection, formal rules and regulations, impersonality, and career orientation are all features of

A. Weber's ideal type bureaucracy

B. General administrative theory

C. Fayol's principles of management

D. Taylor's principles of management

Answer: A

 

152. In what order do managers typically perform the managerial functions

A. organizing, planning, controlling, leading

B. organizing, leading, planning, controlling

C. planning, organizing, leading, controlling

D. planning, organizing, controlling, leading

Answer: D

 

153. Who of the following is the industrial philanthropist

A. Frederick Taylor

B. Seebohm Rowntree

C. Henry Ford

D. Max Weber

Answer: B

 

154. What are the three interpersonal roles of managers

A. Figurehead, leader and liaison

B. Spokesperson, leader, coordinator

C. Director, coordinator, disseminator

D. Communicator, organizer, spokesperson

Answer: B

 

155. At what level of an organization does a corporate manager operate

A. Functional

B. Operational

C. Middle level

D. Top level

Answer: C

 

156.What is the guiding principle behind New Public Management

A. Profit maximization

B. Introducing private sector business principles into the public sector

C. Replacing public management with private sector management

D. Restructuring public organizations

Answer: B

 

157. Which one is not a recognized key skill of management

A. Conceptual skills

B. Human skills

C. Technical skills

D. Writing skills

Answer: D

 

158. Which of these is not part of the recognized challenges for modern managers

A. Micro-managing the workforce

B. Managing communications

C. Managing change

D. Managing the learning organization

Answer: D

Post a Comment

0 Comments