MCQ 100
MCQ 100
com/groups/858042971559671
Programming
1. Who developed C language? 10. The default parameter passing mechanism is
a) Dennis Ritchie a) Call by values
b) Alan Kay b) Call by reference
c) Robert Lue c) Call by value result
d) James Gasoline d) None of these
3. By the process of linking, the resulting code is called 12. What is the size of c union?
as ____ a) C union is always 128 bytes
a) Executable code b) Size of the union is the total bytes of all elements of
b) Optional Code structure.
c) Link Code c) Size of the union is the size of largest element
d) None d) None of the above
5. How many values can be returned from a function? like malloc() and calloc()?
a) 1 a) memory.h
b) 2 b) stdlib.h
c) 3 c) dos.h
d) 4 d) string.h
7. The keyword used to transfer control from a function 16. A mode which is used to open an existing file for both
a) switch a) W
b) goto b) W+
c) go back c) A+
d) return d) R+
8. Global variables are 17. Select a function which is used to write a string to a
a) Internal file
b) External a) pits()
c) Both internal and external b) putc()
d) None of the above c) fputs()
d) fgets(
9. Which of the following is a storage specifier?
a) enum
b) union
c) auto
d) volatile
18. Select a function which is used to read a single 27. In the call by reference we pass ………….?
character from a file at a time? a) Value of the variable
a) fscanf() b) Address of variable
b) getch() c) Both value and address
c) fgetc() d) None of these
d) fgets()
28. A pointer variable can store …………….
19. Select a function which is used as a formatted output a) Constant value
file function b) Value of anther variable.
c) Address of another variable
a) printf() d) None of these.
b) fprintf()
c) puts() 29. Which of the following is input function?
d) fputs()
a) gets();
b) getch();
20. The data type of file pointer is c) getchar();
d) All of the above
a) int
b) double 30. Which is not the output function?
c) void
d) FILE a) puts();
b) puchar();
21. If there is an error while opening a file, fopen will c) putch();
d) None of the above
return
a) nothing 31. Array index is always starting from?
b) EOF a) 0
c) NULL b) 1
d) Depend on compiler c) 2
d) 3
22. getc() returns End of file when
a) getc() fails to read the character 32. Which is not the c keyword?
b) end of file is reached a) typedef
c) both a and b b) extern
d) none of the above c) register
d) local
23. Specify the two library functions that dynamically
allocates memory. 33. Uninitialized variable may have?
a) malloc() and memalloc() a) Garbage value.
b) mlloc() and memalloc() b) Cannot be zero
c) malloc() and calloc() c) Both
d) memalloc() and faralloc() d) None of these.
24. Which is not the selective control flow statement? 34. C has ………. keywords:
a) while a) 30
b) if b) 31
c) Switch-case c) 32
d) if-else d) 33
25. strcmp() function is used for ……………. 35. What is the only language that a computer
a) Copy two strings understands directly?
b) Compare two strings. a) English
c) Concatenation of two strings b) BASIC
d) None of these c) machine language
d) Assembly Language
26. Which function is related to dynamic memory
allocation?
a) malloc()
b) calloc()
c) realloc()
d) All of above.
36. Functions used in programs that are defined by 45. Which of the following input function cannot be used
programmers are called? to input multiword string in a single function call?
a) program layout a) getche()
b) program procedure b) gets()
c) built-in functions c) scanf()
d) user-defined function d) None of above
38. Variable which uses same name in whole program 47. C language was invented in which laboratories?
and in its all routines thus best classified as a) Uniliver Labs
a) middle variable b) IBM Labs
b) default variable c) AT&T Bell Labs
c) local variable d) Verizon Labs
d) global variable
48. C language was invented to develop which Operating
39. If the function returns no value then it is called ____ System?
a) Data type function a) Android
b) Calling function b) Linux
c) Main function c) Ubuntu
d) Void function d) Unix
40. Technique of using fixed words for machine code 49. Operator % in C Language is called?
functions is classified as a) Percentage Operator
a) mnemonics b) Quotient Operator
b) mechanics c) Modulus
c) compiler d) Division
d) translator
41. 'object program' is also called? 50. Which of the following are tokens in C?
42. Data structure in which all elements have similar 51. What is the valid range of numbers for int type of
43. Translation of assembly language into machine code 52. Character constants should be enclosed between ___
44. Which character is used to indicate the end of the a) Single quotes
b) Double quotes
string? c) Both a and b
a) Any alphabet d) None of these
b) A
c) Null
d) None of these
54. The operator && is an example for ___ operator. d) restarts iterations from the beginning of the loop
a) Assignment
b) Increment 61. Which of the following is a keyword used for a
c) Logical storage class?
d) Rational a) printf
b) external
55. The operator & is used for c) auto
a) Bitwise AND d) scanf
b) Bitwise OR
c) Logical AND 62. The _______ chars have values from -128 to 127.
d) Logical OR a) signed
b) unsigned
56. Which of the following is a ternary operator? c) long
a) ?: d) none
b) *
c) sizeof 63. C supports the ______ statement to branch
d) ^ unconditionally from one point to another in the
59. Which among the following is an unconditional 65. All syntax errors are known as _____________
control structure? errors.
a) do-while a) Run-time
b) if-else b) Exception
c) goto c) Logical
d) for d) Compile-time
70. Which of the following is an example of compounded 78. Choose the correct statement about c structure
assignment statement? elements
a) a=5 a) Structure elements are stored on random free memory
b) a+=5 locations
c) a=b=c b) Structure elements are stored on register memory
d) a=b location
c) Structure elements are stored in contiguous memory
71. An array element is accessed using locations.
a) member name d) None of the above.
b) an index number
c) dot operator 79. What is actually passed if you pass a structure
d) a first in first out approach variable to a function?
a) Copy of structure variable
72. Choose correct statement about Functions in c b) Reference of structure variable
language c) Starting address of structure variable
a) A function is a group of statement which can be reused d) Ending address of structure variable
any number of times.
b) Every function has a return value 80. User defined data type can be derived by
c) Every function may not return a value. a) struct
d) All of the above b) enum
c) typedef
73. Choose correct statement about Functions in c d) All of the above
language
81. What is the main difference between structure and
a) A function name cannot be same as a predefined c
keyword. union?
b) A function name can start with an underscore. a) There is no difference
c) Default return type of any function is an integer. b) Union takes less memory
d) All of the above c) Union is faster
d) Structure is faster
74. Choose the correct statement about c language pass
by value. 82. The reason for using pointers in c program is
a) Pass by value copies the variable value in one more a) Pointers allow different functions to share and modify
memory location their local variable
b) Pass by value does not use pointers b) To pass large structures so that complete copy of the
c) Pass by value protect your source variable from changes structure can be avoided
in outside functions. c) Pointers enable complex linked data structures
d) All of the above d) All of the above
75. Which of the following cannot be static in C? 83. How will you free the allocated space?
a) Variable a) remove(variable-name)
b) Functions b) free(variable-name)
c) Structures c) delete(variable-name)
d) None of the above d) dealloc(variable-name)
76. Choose the correct statement about c structures. 84. What is the need of closing a file in c language?
a) Structure elements can be initialized at the time of a) fclose(fp) close a file to release the memory used in
declaration. opening a file.
b) Structure elements cannot be initialized at the time of b) closing a file clears buffer contents from RAM or
declaration. memory
c) Only integer members of the structure can be initialized c) unclosed files occupy memory and PC hangs when on
at the time of declaration low memory
d) None of the above d) all of the above
77. What is the size of c structure? 85. Which is the incorrect statement?
86. Which statement is wrong? 93. Why do variable names beginning with the
a) A function may have arguments. underscore is not encouraged?
b) A function may return value. a) It is not standardized
c) A function can be invoked many times in a single b) To avoid conflicts since assemblers and loaders use such
program. names
d) Function cannot be reused. c) To avoid conflicts since library routines use such names
d) To avoid conflicts with environment variables of an
87. Which is the incorrect statement? operating system
a) Variable name can contain underscore.
b) Variable name may start from digit. 94. Why is a macro used in place of a function?
c) Variable name may not have white space character. a) It reduces execution time.
d) Keyword can not be a variable name. b) It reduces code size.
c) It increases execution time.
88. Operators have precedence. Precedence determines d) It increases code size.
which operator is…………
a) faster 95. Which one of the following is a loop construct that
b) takes less memory will always be executed once at least?
c) evaluated first a) for
d) takes no arguments b) while
c) switch
89. p++ executes faster than p+1 because d) do while
a) p uses registers
b) p++ is a single instruction 96. The ………….. is an alternative for simple if-else
c) ++ is faster than + statement?
d) None of these
a) Conditional operator
b) Bitwise operator
90. What is the answer of: 7%3 c) Logical operator
d) None
a) 2.5
b) 1 97. A compiler compiles the source
c) 2
d) 3 code________________.
a) complete program in one stroke.
91. Which keyword is used to prevent any changes in the b) one line at a time.
variable within a C program? c) two lines at a time.
d) complete programs in two strokes.
a) immutable
b) mutable 98. ________ decides which operator is to be used first.
c) const
d) volatile a) Hierarchy.
b) Priority.
92. What is #include <stdio.h> c) ladder.
d) Precedence.
a) Preprocessor directive
b) Inclusion directive 99. If the size of the array is less than the number of
c) File inclusion directive
d) None of the mentioned initializers then ……….
a) Extra values are being ignored
b) Generates an error message
c) Size of Array is increased
d) Size is neglected when values are given