1. Who
invented C Programming Language ?
a) James Gosling
b)
Dennis
Ritche
c)
Rasmus
Lerdorf
d) Bjarne Stroustrup
2. C was developed
in __________.
a) 1970
b)
1972
c)
1974
d) 1976
3. C language is a ________.
a)
Procedural oriented
programming language
b)
General purpose
programming language
c)
Structured programming
d) All of the above
4. Which
of the following is not a valid C variable name?
a) int number;
b) float rate
c)
int
variable_count
d)
Int
$main
5. A data type is a
_______ set of values along with a set of rules for allowed operations.
a) Infinite
b) Finite
c)
Fixed
d) Variable
6. A variable is a
_________ which is able to hold a representation that denotes a value.
a)
Container
b) Box
c)
Pack
d) Carton
7. The
C preprocessors are specified with ______ symbol.
a)
#
b) $
c)
“ ”
d) &
8. The
scanf() is a predefined function in _________ header file.
a) stdlib.h
b) ctype.h
c)
stdio.h
d) stdarg.h
9. Header
files_____
a)
Contain function
declarations
b)
Can be included
to a program
c)
End with .h
extension
d) All of these
10. Can programmers
create their own header files?
a) Yes
b)
No
11. What is the extension of C source file?
a) .txt
b) .CS
c)
.CPP
d) .C
12. Which
of these can be used for a variable name in C?
a) Identifier & keyword
b)
Identifier
c)
Keyword
d) None of these
13. Find a correct C
keyword
a) Float
b) Int
c)
Long
d)
Double
14. Which is not a
valid keyword in C?
a) For
b) While
c)
do-while
d) Switch
15. All keywords in
C are in _______
a)
LoweCase
letters
b) UpperCase letters
c)
camelCase
letters
d) none of the mentioned
16. How many
keywords are there in C language?
a)
32
b) 33
c)
64
d) 18
17. What is the
correct syntax to declare a variable in C?
a) data_type variable_name;
b)
data_type as variable_name;
c)
variable_name data_type;
d)
variable_name as
data_type;
18. Which of the
following special symbol allowed in a variable name?
a) * (asterisk)
b) | (pipeline)
c)
– (hyphen)
d)
_ (underscore)
19. Which of the
following functions must be included in all C programs?
a) start()
b) system()
c)
main()
d) program()
20. In C, an
uninitialized variable may have
a) null value
b) nul string
c)
garbage
value
d) zero value
21. Which character
must be used to end a C statement?
a) . (dot)
b)
; (semicolon)
c)
: (colon)
d) ‘
(single-quote)
22. Which symbol
must be used to signal the beginning and ending of code blocks or compound
statements?
a)
{ }
b) à and ß
c)
BEGIN and END
d) ( and )
23. Which of the
following is a correct syntax for inserting comments in C program?
a) */ comments */
b) ** comments **
c)
/* comments
*/
d) { comments }
24. Which escape
sequence take the control to next horizontal tabulation position?
a) ‘\n’
b)
‘\t’
c)
‘\0’
d) ‘\v’
25. In C programming, which one of the following is string termination character?
a) ‘\0’
b) ‘\n’
c) ‘\b’
d) ‘\t’
26. The directives
for preprocessors begin with
a) &
b) //
c)
#
d) <
27. Which operator
gives remainder after division?
a) / (divide)
b)
% (modulo)
c)
^
d) ~
28. Which of the
following is not the primary constant in C language?
a) Integer
b) Float
c)
Union
d) Character
29. Which are the
fundamental data types in C?
a) char
b) int
c)
float
d)
All of the
above
30. How many byte(s)
does a char type take in C?
a) 1
b)
2
c)
3
d)
4
31. What is the name
of “&” operator in C?
a) Ampersand
b) And
c)
Address of
d) None of the above
32. Program
execution always starts with
a)
Main
b) Variable
c)
Include
d) Case
33. Which C keyword
is used to extend the visibility of variables?
a) extend
b) extends
c)
extern
d) auto
34. The range of
values in integer data type is
a)
-32768 to
32767
b) -128 to 127
c)
-128 to 256
d) None of the above
35. Which is correct
with respect to the size of the data types in C?
a) char>int>float
b)
char<int<float
c)
int<char<float
d) int<flaot<char
36. For which type,
the format specifier “%i” is used?
a)
int
b) char
c)
float
d) double
37. Which is the
correct format specifier for double type value in C?
a)
%d
b)
%f
c) %lf
d)
%LF
38. What value is
returned to the operating system upon the successful completion of a C program?
a) -1
b) 1
c)
0
d) -2
39. Which one of the
following is the correct operator to compare two variables?
a) :=
b) =
c)
Equal
d)
==
40. Which one of the
following is the operator for logical and?
a) &
b)
&&
c)
|
d) |&
41. Which of the
following is not a bitwise operator?
a)
&&
b) <<
c)
~
d) ^
42. Which of the
following symbol is used for AND operator?
a) ||
b) &
c)
&&
d) $$
43. Which of the
following is not logical operator?
a) &
b)
&&
c)
||
d)
!
44. The _____
operator is true only when both the operands are true.
a) bitwise or
b) bitwise and
c)
logical and
d) Boolean
45. In C
programming, ‘++’ is _________ operator.
a)
Increment
b) decrement
c)
Assigning
d) overloading
46. Increment (++)
and decrement (--) are the ________ operators in C.
a)
Unary
b) Binary
c)
Ternary
d) None of the above
47. Which operator
is used to find the remainder of two numbers in C?
a) /
b) \
c)
%
d) //
48. Which of the
following is not an arithmetic expression?
a)
x=10
b)
x /=10
c)
x %=10
d) x !=10
49. Which of the
following are valid decision-making statements in C?
a) if
b) switch
c)
nested if
d)
All of these
50. Decision making
in the C programming language is _____
a) Repeating the same statement multiple times
b)
Executing a
set of statements based on some condition
c)
Providing a name
of the block of code
d) All of these
51. What is the
correct syntax of if statement in C program?
a) If(condition) { }
b) If(condition):
c)
If{[condition]}
d) None of these
52. The if statement
is a conditional statement
a)
True
b) False
53. When the
condition of if statement is false, the flow of code will _____.
a)
Go into the if
block
b)
Exit the program
c) Continue the code after skipping the if block
d)
None of these
54. Which statement
is required to execute a block of code when the condition is false?
a)
for
b)
if
c) else
d)
All of these
55. The if-else
if-else statement in C programming is used
a)
Create
multiple conditional statements
b) Return values
c)
Loop in if-else
block
d) All of these
56. Multiple values
of the same variable can be tested using____
a) switch
b)
for
c)
Function
d)
All of these
57. Without a break
statement in switch what will happen?
a) All cases will work properly
b)
Cases will
fall through after matching the first check
c)
Switch will
throw error
d) All of these
58. When all cases
are unmatched which case is matched in a switch statement?
a)
Default case
b) First case
c)
No case
d) None of these
59. Loops in C
programming are used to ____.
a) Execute a statement based on a condition
b)
Execute a
block of code repeatedly
c)
Create a
variable
d) None of these
60. Which of the
following is not a jump statement?
a) break
b) Continue
c)
Escape
d) Goto
61. What is an
example of iteration in C?
a) for
b) while
c) do-while
d)
All of the
mentioned
62. Which loop
executes the block a specific number of times?
a)
while loop
b) for loop
c)
d0…while loop
d)
all of these
63. Which of the
following parts of the for loop can be eliminated in C?
a)
initialization
b)
condition
c)
increment
d) All of these
64. When all parts
of the for loop are eliminated, what will happen?
a)
For loop will
not work
b) Infinite for loop
c)
Error
d)
None of these
65. Which of the
following is an exit controlled loop?
a) While
b) For
c)
do-while
d) None of the above
66. Which one of the
following is a loop construct that will always be executed once?
a) for
b) while
c)
switch
d)
do-while
67. When the
condition of the do-while loop is false, how many times will it execute the
code?
a)
0
b) 1
c)
Infinite
d)
All of these
68. Can a loop be
nested in C programming?
a) Yes
b)
No
69. What will happen
if the loop condition will never become false?
a) Program will throw an error
b)
Program will
loop infinitely
c)
Loop will not
run
d) None of these
70. Which of the
following creates infinite loop:
a)
for (;;)
b) then (;;)
c)
when (;;)
d) if (;;)
71. Which of the
following is valid syntax for creating a while loop?
a)
While{
b) While(condition){
c)
While{
d)
All of these
72. What will you
use if you are not intended to get a return value?
a) static
b) const
c)
volatile
d)
void
73. How will you
print \n on the screen?
a)
printf(“\n”);
b)
echo “\ \n”;
c)
printf(‘\n’);
d) printf(“\ \n”);
74. Which of the
following cannot be checked in a switch-case statement?
a)
Character
b)
Integer
c) Float
d)
Enum
75. What is Array?
a) Collection
of different type of elements
b)
Collection of similar type of elements
c)
None of the
above
d) Both A and C
76. In C programming, array
index always starts from
a)
0
b) 1
c)
2
d) 3
77. You can access elements
of an array by __
a) values
b)
indices
c)
memory addresses
d) All of the above
78. Which is the correct
syntax to declare an array in C?
a) data_type array_name[array_size];
b) data_type array_name{array_size};
c) data_type array_name[];
d) all of the above
79. Which of the following
correctly declares an array?
a)
int
array[10]
b) Int array
c)
Array {10}
d) array array [10]
80. How are String
represented in memory in C?
a)
An array of
characters
b) The object of some class
c)
Same as other primitive
data types
d) linkedList of characters
81. What is the disadvantage
of arrays in C?
a)
The amount
of memory to be allocated should be known beforehand
b) Elements of an array can be accessed in constant
time.
c)
Elements are stored in
contiguous memory blocks.
d) Multiple other data structures can be implemented
using arrays.
82. What is right way to initialize array?
a)
int num[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 };
83. Which of these best describes an array?
a) A data
structure that shows a hierarchical behavior
b)
Container of objects of similar types
c)
Arrays are immutable once initialized
d) Array is not a data structure
84. What is an Array in C language?
a) A group of elements of same data type.
b) An array contains more than one
element
c) Array elements are stored in
memory in continuous or contiguous locations.
d) All the above.
85. What are the Types of Arrays?
a) int, float, char, double
b) struct, enum
c) long
d) All the above
86. What is the maximum number of dimensions an array in C may have?
a) 2
b) 8
c) 16
d) Theoratically no limit. The only
practical limits are memory size and compilers
87. Which of the following is the correct way to declare a multidimensional
array in Java?
a) int arr[[]];
b) int[] arr;
c) int[][]arr;
d) int[[]] arr;
88. What does the following declaration mean?
int (*ptr)[10];
a) ptr is an array of 10 integers
b) ptr is an pointer to array
c)
ptr is a pointer to an array of 10 integers
d) ptr is array of pointers to 10 integers
89. Array elements are always stored in ________ memory locations.
a) Random
b) None of the above
c)
Sequential
d) Sequential and Random
90. Array is an example of _______ type memory allocation.
a) Compile time
b) Run time
c) Both A and B
d) None of the above
91. In the below statement, what does the "arr" indicates?
char *arr[20];
a) arr is an array of 20 characters
b) arr is an array of 20 character
pointers
c) arr is an array of function
d) arr is a pointer to an array
92. The parameter passing mechanism for an array is
a) call by reference
b) call by value
c) call by value-result
d) None of the above
93. If we 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
94. Choose correct statement about Functions in C
Language-
a) A Function is a group of c
statements which can be reused any number of times
b) Every Function has a return type
c) Every Function may not return a
value
d) All the above
95. What is
a function in C?
a) User
defined data type
b) Block of code which can be reused
c) Declaration
syntax
d) None of
these
96. Which of the below syntax is the
correct way of declaring a function?
a) return function_name()
{
b) data_type function_name(parameter) {
c) void function_name
(
d) None of
these
97. Which
keyword is used to return values from function?
a) return
b) Value
c) Switch
d) All of
these
98. In C programming, a function can return
a) Single value
b) Double
value
c) Many
values
d) None of
these
99. Functions
in C can accept multiple parameters. True or False?
a) True
b) False
100. A function which calls
itself is called a ___ function.
a)
Self
Function
b)
Auto Function
c) Recursive Function
d)
Static
Function
101. In which header file,
sqrt() and pow() functions are defined?
a)
include.h
b)
conio.h
c)
iostream.h
d) math.h
102. The sqrt() function is used
to calculate which value?
a) Square
b) Square of reverse bits
c)
Square root
d) None of these
103.
How would you round off a value from 1.66 t0 2.0?
a) ceil(1.66)
b)
floor(1.66)
c)
roundup(1.66)
d)
roundto(1.66)
104. In
which header file, strcpy(), strcat(), strlen() functions are declared ?
a)
include.h
b) string.h
c)
math.h
d)
conio.h
105. A
string is terminated by______
a) Newline(‘\n’)
b)
Null(‘\0’)
c)
Whitespace
d) None of the above
106. Which format
specifier is used to read and print the string using printf() and scanf() in C?
a) %c
b) %str
c)
%p
d)
%s
107. To use
the function tolower(), which of the following header file should include
a) string.h
b) conio.h
c)
ctype.h
d) don’t need any header file
108.
The
keyword used to transfer control from a function back to the calling function
is
a)
switch
b)
goto
c)
go
back
d) return.
109. What are the types of
functions in C Language?
a)
Library
Functions
b)
User
Defined Functions
c) Both Library and User Defined
d)
None
of the above
110. Choose correct statements
about C Language Pass By Value.
a)
Pass
By Value copies the variable value in one more memory location
b)
Pass
By Value does not use Pointers
c)
Pass
By Value protects your source or original variables from changes in outside
functions or called functions
d)
All the above
111. What is the limit for
number of functions in a C Program?
a)
16
b)
31
c)
32
d) No Limit
112. Every C Program should
contain which function?
a)
printf()
b)
show()
c)
scanf()
d) main()
113. A recursive function in C ____
a)
Call itself
again and again
b) Loop over a parameter
c)
Return
multiple values
d) None of these
114. A C program contains______
a)
At least one
function
b) No function
c)
No value
from command line
d) All of these
115. The string function,
strcmp() is used for
a) Comparing string
b)
Copying
string
c)
Pattern
matching
d)
Concatenating
strings
116. Which function is used to
concatenate two strings in C?
a)
concat()
b)
cat()
c)
stringcat()
d) strcat()
117. Which function is used to
compare two strings in C?
a) strcmp()
b)
strcmpi()
c)
compare()
d)
cmpi()
118. Which function is used to
compare two strings with ignoring case in C?
a)
strcmp()
b) strcmpi()
c)
compare()
d)
cmpi()
119. If the two
strings are identical , then strcmp()
function returns
a) -1
b) 1
c)
0
d) Yes
120. What is the minimum number
of functions to be present in a C Program?
a)
1
b)
2
c)
3
d)
4
121. What characters are allowed
in a C function name identifier?
a)
Alphabets,
Numbers, %, $, _
b)
Alphabets,
Numbers, Underscore ( _ )
c)
Alphabets,
Numbers, dollar $
d)
Alphabets,
Numbers, %
122. Arguments passed to a function in C language are
called ___ arguments.
a) Formal arguments
b) Actual Arguments
c) Definite Arguments
d) Ideal Arguments
123. Arguments received by a
function in C language are called ___ arguments.
a) Definite arguments
b) Formal arguments
c) Actual arguments
d) Ideal arguments
124. Choose a corrects statement
about C language function arguments.
a) Number of arguments should
be same when sending and receiving
b) Type of each argument
should match exactly
c) Order of each argument
should be same
d) All the above
125. Choose a non Library C function below:
a) printf()
b) scanf()
c) fprintf()
d) printf4()
126. What is the default return
value of a C function if not specified explicitly?
a) -1
b) 0
c) 1
d) None of the above
127. Uses of function
a) Helps to avoid repeating a set
of statements many times
b) Enhances the logical
clarity of the program
c) Helps to avoid repeated
programming across programs
d) Makes the debugging task
easier
e) All of the above
128. The function fprintf is
used in a program:
a) When too many printf calls
have been alrady used in the program
b) In place of printf, since
printf uses more memory
c) When output i to be printed on to
a file
d) All of above
129. A recursive function can be
replaced with _____ in C language.
a) for loop
b) while loop
c)
do
while loop
d) All the above
130. The
default parameter passing mechanism is
a)
Call by value
b) Call by reference
c)
Call by
value result
d) None of the above
131. Which of
these is not a valid parameter passing method in C?
a) Call by value
b) Call by reference
c)
Call by pointer
d) All of these
132. Which of the following is the collection of
different data types?
a) structure
b) string
c) array
d) All of these
133. Which operator is used to access the member of
a structure?
a) –
b) >
c) *
d) .
134. What will be
used when terminating a structure?
a) :
b) }
c)
;
d) ;;
135. Which of these is a user-defined data type in
C?
a) int
b)
union
c)
char
d) All of these
136. “A union can contain data of different data
types”. True or False?
a)
True
b) False
137. Which keyword is used to define a union?
a) Un
b)
union
c)
Union
d) None of these
138. The size of a union is ___
a) Sum of sizes of all members
b) Predefined by the compiler
c)
Equal to size of largest data type
d) None of these
139. All members of union ____
a) Stored in consecutive memory location
b)
Share same memory location
c)
Store
at different location
d) All of these
140. The member of union can be accessed
using_______ ?
a) Dot Operator (.)
b) And Operator (&)
c) Asterisk Operator (*)
d) Right Shift Operator (>)
141. In
which case union is better than structure?
a)
Less memory is available
b) Fasrter compilation is required
c)
When
functions are included
d) None of these
142. A pointer is
a) A variable that stores address of an instruction
b) A variable that stores address of other variable
c)
A keyword used to create
variables
d) None of these
143. A pointer is a variable, which holds ______
a) Memory address
b) Files
c)
Int variable
d) Char variable
144. The operator used for dereferencing or
indirection is _______
a) *
b) &
c) Ã
d) Ã >
145. What is wild pointer?
a) Pointer which is wild in nature
b) Pointer which has no value.
c)
Pointer which is not initialized
d) None
146. ______ is a pointer that occurs
at the time when the object is de-allocated from memory without modifying the
value of the pointer.
a)
Dangling pointer
b) Wild pointer
c)
Void pointer
d) Null pointer
147. A _____ can be assigned the address of any
data type.
a) Dangling pointer
b) Wild pointer
c)
Void pointer
d) Null pointer
148. Which pointer is called general-purpose
pointer?
a) Dangling pointer
b) Wild pointer
c)
Void pointer
d) Null pointer
149. In order to fetch the address of the
variable we write preceding _________ sign before variable name.
a) Percent(%)
b) Comma(,)
c)
Ampersand(&)
d) Asterisk (*)
150. Which is an
indirection operator among the following?
a)
&
b)
*
c)
->
d) .
151. Prior
to using a pointer variable it should be
a) Declared
b) Initialized
c)
Both
declared and initialized
d) None of these
152. In C a pointer variable to
an integer can be created by the decalaration
a) int p*;
b) int *p;
c)
int +p;
d) int $p;
153. In
pointer, ______ is needed for returning the address of the variable following
it.
a)
&
b) &&
c)
~
d) *
154. How to declare a double–pointer in C?
a) int *val
b)
int **val
c)
int
&val
d) int *&val
155. In C, which function is not related to file
handling?
a) fprintf
b)
printf
c)
fclose
d) fopen
156. Which of the following function is used to
open a file in C?
a)
fopen()
b) fclose()
c)
fseek()
d) fgets()
157. Which
of the following are correct file opening modes in C?
a) r
b) rb
c)
w
d)
All of the above
158. What
is the return type of the fopen() function in C?
a)
Pointer to a File object.
b) Pointer to an integer
c)
An
integer.
d) None of the mentioned.
159. Which
character(s) is/are used to open a binary file in append mode in C?
a) a
b) b
c)
ba
d)
ab
160.
Which
character(s) is/are used to open a binary file in reading and writing mode in
C?
a) rw
b) rwb
c)
rb+
d) rwb+
161. Which function is used to close an opened
file?
a) close()
b)
fclose()
c)
file_close()
d) fileclose()
162. Which
function is used to seek the file pointer position in C?
a)
seek()
b) fseek()
c)
fileseek()
d)
fmove()
163. What is the purpose of “rb” in fopen()function used below in the code?
FILE
*fp;
fp
=
fopen(
"source.txt",
"rb");
a) Open “source.txt” in binary mode for reading
b) Open “source.txt” in binary mode for reading and writing
c) Create a new file “source.txt” for reading and writing
d) None of the above
164. What is the value of EOF in C?
a) -1
b)
0
c)
1
d)
Null
165. The command line arguments are
handled using?
a)
void()
b)
main()
c)
header
files
d)
macros
166. argc refers to the?
a)
number of arguments passed
b)
a
pointer array
c)
Both
A and B
d)
None
of the above
167. argv[] is a?
a)
a
pointer array
b)
It
points to each argument passed to the program.
c)
Both A and B
d)
None
of the above
168. What argv
means in command line argument?
a)
Array of Strings
b)
Array of
character pointers
c)
Array of
pointers
d)
pointer to a
character array
169. Which of the following syntax is correct for command-line arguments?
a)
int main(char
c,int v)
b)
int main(int
v,char c)
c)
int main(char
*arv[], int arg)
d)
int main(int
var, char *argv[])
170. What does argc
and argv indicate in command-line
arguments? (Assuming: int main(int argc, char *argv[]) )
a)
argument
control, argument variable
b)
argument
control, argument vector
c)
argument count,
argument variable
d)
argument
count, argument vector
171. What type of array is generally
generated in Command-line argument?
a)
Single
dimension array
b)
2-Dimensional
Square Array
c)
Jagged Array
d)
2-Dimensional
Rectangular Array
172. The
maximum combined length of the command-line arguments including the spaces
between adjacent arguments is:
a)
128 characters
b)
256 characters
c)
67 characters
d)
It may vary from one operating system
to another
173. What do
the 'c' and 'v' in argc and argv stands for?
a)
'c' means argument control 'v' means argument
vector
b)
'c' means argument count 'v' means argument vertex
c)
'c' means argument count 'v' means
argument vector
d)
'c' means argument configuration 'v' means argument
visibility
174. Which of
the following is TRUE about argv?
a)
It is an array of character pointers
b)
It is a pointer to an array of character pointers
c)
It is an array of strings
d)
None of above
175. The index of the last argument in
command line arguments?
a)
argc
– 2
b)
argc – 1
c)
argc
d)
argc
+ 1
176. Which one of these is equivalent to argc?
a)
Number of
Arguments
b)
Number of
Arguments – 1
c)
Number of
Arguments + 2
d)
Number of
Arguments + 1
177. Which of the
following statements are FALSE about the below code?
int
main(int ac, char *av[])
{
}
a)
The variables ac
and av are always local to main()
b)
In place of
ac and av, argc and argv should be used.
c)
av[] contains
addresses of arguments supplied at a command line
d)
ac contains
count of arguments supplied at command-line
178. The first
argument in command line arguments is
a) The number of command-line arguments the program was
invoked with;
b) A pointer to an array of character strings that
contain the arguments
c)
Both A & B
d) Nothing
179. The second
(argument vector) in command line arguments is
a) A pointer to an array of character strings that contain
the arguments,one per string
b) The number of command-line arguments the program
was invoked with
c)
both A & B
d) None of the mentioned
180. What is argv[0] in command line arguments?
a) The name of the files which are passed to the
program
b) Count of the arguments in argv[] vector
c)
The name by
which the program was invoked
d) None of the mentioned
181. Diagrammatic or
symbolic represent of an algorithm is called
a) Data flow diagram
b) Flow chart
c)
E.R diagram
d) None of the above
182. All elements of
a structure are allocated contiguous memory locations.
·
True
·
False
183. What is the
result of the following statement?
X=10;
Y=++X;
a) X=10, Y=10
b) X=10, Y=11
c)
X=11, Y=10
d)
X=11, Y=11
184.
What is the
result of the following statement?
X=Y=Z=0;
a) x=0,y=NULL, z=NULL
b)
x=0,y=0,z=0
c)
x=0,y=1,z=2
d) the statement is incorrect
185. What will be the
output of the program?
#include<stdio.h>
int
main()
{
int
y=128;
const
int x=y;
printf(“%d\n”,x);
return
0;
}
a) 128
b)
Garbage value
c)
Error
d)
0
186.
What will be the
output of the following code?
#include<stdio.h>
int
main()
{
int
a=3, b=5;
int
t=a;
a=b;
b=t;
printf(“%d
%d”,a,b);
return
0;
}
a)
3 3
b)
3 4
c)
3 5
d) 5 3
187.
What will be the
output of the following code?
int main()
{
int sum=2+4/2+6*2;
printf(“%d”,sum);
return 0;
}
a)
2
b)
15
c) 16
d)
17
188.
What will be the
output of the following code?
#include<stdio.h>
int
main()
{
int x=1,y=2;
printf(x>y? “ABC”: x==y? “DEF”: “IJK”);
return 0;
}
a)
ABC
b)
DEF
c) IJK
d)
Compile time
error
189.
What is the
output of this C code?
#include<stdio.h>
main()
{
int n=0, m=0;
if(n>0)
if(m>0)
printf(“True”);
else
printf(“False”);
}
a)
True
b)
False
c) No output will be printed
d)
Run time error
190.
#include<stdio.h>
void solve()
{
int ch=2;
switch(ch)
{
case 1:printf(“1”);
case 2:printf(“2”);
case 3:printf(“3”);
default:printf(“None”);
}
}
int main()
{
solve ();
return 0
}
a) 1 2 3 None
b)
2
c) 2 3 None
d)
None
Explanation: This is an example of Fall-Though in switch
statements in absence of break statements.
191. #include<stdio.h>
int main()
{
int X=40;
{
int X=20;
printf(“%d”,X);
}
printf(“%d\n”,X);
return 0;
}
a) 20 20
b) 20 40
c) 40 20
d) Error
192. What will be printed after
execution of the following code?
void main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
}
a) 0
b)
5
c)
6
d)
Garbage Value
0 Comments
if you have any doubts plz let me know...