Professional Documents
Culture Documents
MCQ Unit 1
MCQ Unit 1
MCQ Unit 1
Basics of C programming
3 The library functions are made available to 9 C program are converted into the machine
program, by using . language with the help of?
A. #include<libraryname.h> A. An editor
B. #define<libraryname.h> B. Compiler
C. %define<libraryname.h> C. An operating system
D. %include<libraryname.h> D. None of the above
5 At what stage the contents of header file 11 The prototype of the function in the header
stdio.h get included in the program? file is-
A. During execution A. Stdio.H
B. During compilation B. stdlib.h
C. Before compilation C. conio.h
D. After compilation D. io.h
C Operators
1 The equality operator is represented by 7 Which operator has lowest priority?
A. : = A. Assignment
B. /= B. Division
C. = = C. Comma
D. = D. Conditional operator
2 The C language consists of ____number of 8 Which operator gives true only when both the
keyword operand are true.
A. 32 A. !=
B. 40 B. &&
C. 24 C. !
D. 56 D. ||
3 What ill e the alue u after e e utio 9 In mathematics & computer programming,
of following code? int num = 10; num / = which is the correct order of mathematical
num; operators?
5 If a=3, b=0 & c=-4, what is the value of the 11 The symbol # in #defined statement must be
expression a&&b||c commence from
6 If A=20 and B=10; then the operation A = A*B 12 If A=10 and B=5; then the operation A *= B,
+ B, result is _____. result is _____.
A. 10 A. 1
B. 2 B. 15
C. 400 C. 5
D. 210 D. 50
13 which of the following is used to test the 18 Determine which of the following is not
condition allowed in C.
A. A relational operator A. \t
B. A logical operator B. \n
C. A numerical Variable C. \b
D. A numerical constant D. \p
14 If A is an integer variable, A=5/2 will return 19 which is the correct order of the following
value? expression Z=x + y * Z / 4 % 2 - 1
A. 2.5 A. / * % - + =
B. 5 B. .=* / % + -
C. 0 C. * / % + - =
D. 2 D. % * / - + =
15 what are the value of x and y after execution 20 what are the value of x and y after execution
of the following statement of the following
int x, statement
y;
int x, y; x = 2;
x = 2; y = (++x)*10;
y = (x++)*10;
A. x = 2, y = 20
A. x = 2, y = 20 B. x = 3, y = 20
B. x = 3, y = 20 C. x = 3, y = 30
C. x = 3, y = 30 D. None of the above
D. None of the above
Variable Declaration
1 A variable declaration is the assignment of 7 Which of the following is true for variable
A. properties to a variable name in C programming?
Data type
1 The for at ide tifier % i is also used for 10 Which control string is used to represent long
data type? float data type?
A. char A. %d
B. int B. %lf
C. float C. %e
D. double D. %lu
2 The size of an data type are 11 An unsigned integer variable contains values.
4 Which data type is most suitable for storing a 13 Which is correct with respect to size of the
number 65000 in a 32-bit system? data types?
A. signed short A. char > int > float
B. unsigned short B. int > char > float
C. long C. char < int < double
D. int D. double > char > int
5 The format specifier '%i" is an another format 14 The default return data type in function
specifier used for which data type? definition is?
A. int A. void
B. float B. int
C. long float C. float
D. none of these D. char
1 How many times the following program 6 Which scanf( ) statement will you use?
ould pri t a
printf(“abc”); float a; double b;
3 What is the output of the program? 8 What are the value of x and y after execution
of the following statement
int i=2; int x,y; x=2; y=(x++)*10;
printf(“%d”, i+=1); printf(“X=%d y=%d”,x,y);
A. 3 A. X=2, y=20
B. 2 B. X=3, y=20
C. 0 C. X=3, y=30
D. -1 D. No value
4 What is the output of the program? 9 Which of the following function needs
x = 5; inclution of conio.h in the header file
y = x++;
printf(“%d %d”, x, y);
A. printf()
A. 5 6 B. scanf()
B. 5 5 C. getch()
C. 6 5 D. all of the above
D. 6 6
5 What will be the output of the program? 10 What is the output of the program?
#include<stdio.h> #include<stdio.h>
void main() void main()
{ {
int a; int a; a=20;
printf(5+"Good Morningn"); printf("%d", a);
} }
A. Good Morning A. 20
B. 5+"Good Morningn B. a
C. 5+"Good C. %d
D. None of these D. none
Control Statements
1 What will be the output of program? 5 Find out error in the program?
X=1,Y=1,n=0; #include<stdio.h>
if (n>0) void main( )
{ {
X = X+1; if(2 > x)
Y = Y-1; printf(“ABC”);
} printf(“CBA”);
Printf(“%d and %d”,x,y); }
A. 1 and 1 A. No error
B. 1 and 0 B. Data type is not declare
C. 2 and 1 C. Something is missing
D. 2 and 0 D. No output
2 control statement that allowed us to make a 6 What will be the output of program?
decision from number of choice is called?
#include<stdio.h>
A. if- else void main( )
B. for {
C. arrary int X=32,Y=66;
D. do-while if(X<Y)
printf(“%d”, X);
3 What will be the output of the program? }
void main( ) A. 32
{ B. 66
int x = 3; float y = 3.0; C. x
if(x = = y) D. y
printf("x equal y"); else
printf("x not equal to y"); 7 What will be the output of the program?
} void main( )
A. x equal y {
B. x and y are not equal float x = 7.3;
C. Unpredictable if(7.3 > x)
D. No output printf("Hi");
else printf("Hello");
4 Which of the flowing statement are correct
}
about if-else statement?
I. Nested if-else statements are allowed. A. Hi
II. Every if must have an else with it. B. Hello
A. Only I is correct C. Hi Hello
B. Only I is correct D. No output
C. Both I & II is correct
D. Both I & II is correct
Arrary
1 An array is also called as 7 int a[5] = {1,2,3} What is the value of a[4]?
A. Vector A. 0
B. Pointer B. 2
C. Variable C. 3
D. Cannot say D. Garbage Value
2 What is right way to Initialize array? 8 Which of the following correctly accesses the
seventh element stored in arr, an array with
A. int num[6] = { 2, 4, 12, 5, 45, 5 };
100 elements?
B. int n{} = { 2, 4, 12, 5, 45, 5 };
C. int n{6} = { 2, 4, 12 }; A. arr[6]
D. int n(6) = { 2, 4, 12, 5, 45, 5 }; B. arr[7]
C. arr{6}
3 If m and n are predefined constant in c, which D. None of these
of the following is not valied statement
9 what is the output of the following code.
A. int num[m] int a[7] = {1, 2, 3, 4, 5, 6, 7}
B. int num[n+2] printf(“%d”, a[4]- a[0]);
C. int num[m+n] A. 3
D. None of the above B. 2
C. 1
4 Let x be an array. Which of the following D. 0
operations are illegal?
I. ++x II. X[2]+1 10 what is the output of the following code.
III. x++ I V. x*2 int a[2][3]={ 1, 2, 3, 4 ,5, 6}
A. I and II printf %d ,& a[ ][ ] ;
B. I, II and III A. 1 2 3 4 5 6
C. II and III B. 6
D. I, III and IV C. 2
D. 9
5 Array passed as an argument to a function is
interpreted
A. Address as array.
of the 11 What will be the output of the program ?
B. Values of the first elements of the array. int a[5] = {5, 1, 15, 20, 25};
C. Address of the first element of the array. int i, j;
D. Number of element of the array. i = ++a[1];
j = a[1]++;
6 An array elements are always stored in printf("%d, %d", i, j);
A. Sequential A. 3, 2
B. Random B. 2, 3
C. Sequential and Random C. 2, 1
D. None of the above D. 1, 2
Function
1 The name of all functions end with a 6 The argument in function definition is
2 Which of the following is a correct format for 7 Which of the following is a correct format for
definition of function? declaration of function?
A. return-type function-name(argument type); A. return_type function_name(argument type);
B. return-type fun-name(argument type) { } B. return_type function_name(argument type) {}
C. return-type (argument type)function-name; C. return_type function_name(argument type);
D. Both (a) and (b) D. Both (a) and (b)
4 The default parameter passing mechanism is 9 How many arguments function can recives
A. call by value A. 0
B. call by reference B. 1
C. call by value result C. 2
D. None of these. D. many
5 When we mention the prototype of a 10 What is the default return type if it is not
function? specified in function definition?
A. Defining A. void
B. Declaring B. int
C. Prototyping C. double
D. Calling D. short int
Loop Statements
1 Differe e et ee hile a d do- hile 6 In for loop, for (exp1; exp2; exp3). What is
loop? mean by exp1, exp2, exp3?
2 What will be the output of the program? 7 What is mean by exp1, exp2, exp3 in while
int i=0; loop?
exp1;
for(i=1; i<5; i++) while(exp2)
{ {
printf("\t%d", i); statements; exp3;
} }
A. 1 2 3 4 A. Initialization; Incre/decrement; Condition;
B. 0 1 2 3 4 5 B. Incre/decrement; Initialization; Condition;
C. 1 2 3 4 5 C. Initialization; Condition; Incre/decrement
D. None of the above D. None of the above
3 How long the following loop runs? 8 How long the following loop runs?
for(x=1;x=3;x++) for(x=10;x<10;x--)
A. 3 times A. 3 times
B. 2 times B. 2 times
C. 1 times C. 1 times
D. 0 times D. 9 times
4 Which of the following is not an entry 9 Which the loop statements within the loop
controlled loop? are executed at least once?
A. While loop A. do-while
B. For loop B. while
C. Do-while loop C. for
D. All of the above D. goto
5 The minimum number of times the do-while 10 Which the loop statements within the loop
loop executed is? are executed at least zero?
A. 0 A. do-while
B. 1 B. while
C. 2 C. for
D. Cannot be predicted D. goto