Home

C Programming MCQ Solved Paper for IBPS PO

Thursday 9th of March 2023

Sharing is caring

1. What's wrong? for (int k = 2, k <=12, k++)
A. the increment should always be ++k
B. the variable must always be the letter i when using a for loop
C. there should be a semicolon at the end of the statement
D. the commas should be semicolons
Answer : B
2. char *s[10] defines an array of ------------------------
A. pointers to strings
B. string to pointer
C. both
D.
Answer : A
3. The output of the following code is:
void main() 
{
static int a = 1, b, c;
if (a>=2) b=2; c=3;
printf("%d\t%d", b,c);
}

A. 2 3
B. 0 3
C. 0 0
D. 2 0
Answer : B
4. The main() function can call itself recursively.
A. True
B. False
C.
D.
Answer : A
5. An array declared as A[100][100] can hold a maximum of 100 elements.
A. True
B. False
C.
D.
Answer : B
6. When a user defined function is defined in program, then it has to be called at least once from the main().
A. True
B. False
C.
D.
Answer : B
7. The value of an enumerated datatype can be read using scanf() function.
A. True
B. False
C.
D.
Answer : B
8. What is the right way to access value of structure variable book{ price, page }?
A. printf("%d%d", book.price, book.page);
B. printf("%d%d", price.book, page.book);
C. printf("%d%d"< price::book< page::book);
D. printf("%d%d", price?>book, page?>book);
Answer : A
9. Identify the wrong statement
A. putchar(65)
B. putchar('x')
C. putchar("x")
D. putchar('
')
Answer : C
10. Which of the following is invalid?
A. ''
B. " "
C. 'a'
D. abc'
Answer : D
11. Which options shows the correct hierarchy of arithmetic operators
A. **, * or /, + or -
B. **, *, /, +, -
C. **< /< *< +<-
D. / or *, - or +
Answer : D
12. struct stud
{
int roll;
char name[20];
float marks;
} *p;
What will be the byte size of p?

A. 24
B. 2
C. 26
D. None
Answer : B
13. The size of signed integer is ------ bytes.
A. 4
B. 2
C. 8
D. 10
Answer : B
14. The same variable names of automatic type can be used in different functions without any conflict.
A. True
B. False
C.
D.
Answer : A
15. The main() function can be called from any other function.
A. True
B. False
C.
D.
Answer : A
16. A pointer is an indication of the variable to be accessed next.
A. True
B. False
C.
D.
Answer : B
17. The output of the following code is:
void main() 
{
int a = 0;
while (a<=50) for(;;) if(++a % 50==0) break;
printf("a = %d", a);
}

A. a = 100
B. a = 50
C. compilation error
D. runtime error
Answer : A
18. fprintf()function can be used to write into console.
A. True
B. False
C.
D.
Answer : B
19. enum helps to create user defined datatype.
A. True
B. False
C.
D.
Answer : A
20. strcat() function ----------------------- two strings.
A. delete
B. concatenate
C. compare
D. none of the above
Answer : B
21.

What will be output if you will compile and execute the following c code?


#include 
#define x 5+2
int main(){
int i;
i=x*x*x;
printf("%d",i);
return 0;
}



A. 27
B. 343
C. 233
D. Compiler Error
Answer : A
22. The expression 'int j = 6 + 3 % -9;' evaluates to -1.
A. True
B. False
C.
D.
Answer : B
23. p++ executes faster than p + 1.
A. True
B. False
C.
D.
Answer : A
24. No commas or blanks are allowed within an integer or a real constant.
A. True
B. False
C.
D.
Answer : A
25. What is C Tokens?
A. The smallest individual units of c program
B. The basic element recognized by the compiler
C. The largest individual units of program
D. A & B Both
Answer : D
26. Which of the following is an example of compounded assignment statement?
A. a = 5
B. a += 5
C. a = b = c
D. a = b
Answer : C
27. What will be output if you will compile and execute the following c code?
#include 
int main()
{
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
return 0;
}

A. Less than
B. Equal
C.

Greater than


D. None of above
Answer : A
28. Union is used to hold different data at different time.
A. True
B. False
C.
D.
Answer : A
29. If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?
A. const X* const
B. X* const
C. X*
D. X&
Answer : D
30. In the expression - 'x + y + 3z =20'
A. x + y' is a keyword
B. 3 and 20 are constants
C. 3z is a constant
D. y is a variable and z is a constant
Answer : B
31. There are total ------ numbers of operators in 'C'.
A. 35
B. 45
C. 55
D. 40
Answer : B
32. The output of the following code is:
#define sqr(x= x*x) 
main()
{
int a = 10, b = 5;
printf("%d, %d", sqr(a+b),sqr(++a));
}

A. 77, 121
B. 225, 121
C. 77< 144
D. Compilation error
Answer : D
33. The expression (i + j)++ is illegal.
A. True
B. False
C.
D.
Answer : A
34. A continue statement causes execution to skip to
A. the return 0; statement
B. the first statement after the loop
C. the statement following the continue statement
D. the next iteration of the loop
Answer : C
35. Which of the following is not a preprocessor directive
A. #if
B. #elseif
C. #undef
D. #pragma
Answer : B
36. The expression "b = 3 ^ 2;" will evaluate b = 9.
A. True
B. False
C.
D.
Answer : B
37. continue statement is used
A. to go to the next iteration in a loop
B. come out of a loop
C. exit and return to the main function
D. restarts iterations from beginning of loop
Answer : D
38. /* The C language.
/* is a procedural language .*/*/
The above statement is valid.

A. True
B. False
C.
D.
Answer : B
39. Which of the following correctly describes C++ language?
A. Statically typed language
B. Dynamically typed language
C. Both Statically and dynamically typed language
D. Type-less language
Answer : D
40. Which escape character can be used to beep from speaker in C?
A. \a
B. \b
C. \m
D.
Answer : A
41. What does STL stand for?
A. Simple Template Library
B. Standard Template Library
C. Static Type Library
D. Single Type-based Library
Answer : A
42. Expression 4**3 evaluates to 64.
A. True
B. False
C.
D.
Answer : B
43. The output of the following code is:
main() 
{
void msg()
{
printf("HELLO WORLD");
}
}

A. HELLO WORLD
B. Error
C. None of the above
D. Null
Answer : B
44. = and = = have the same operation.
A. True
B. False
C.
D.
Answer : B
45. printf() is not a library function.
A. True
B. False
C.
D.
Answer : B
46. Which of the following is not a standard exception built in C++.
A. std::bad_creat
B. std::bad_alloc
C. std::bad_cast
D. std::bad_typeid
Answer : A
47. C programming language was developed by
A. Dennis Ritchie
B. Ken Thompson
C. Bill Gates
D. Peter Norton
Answer : A
48. Right shifting an operand 1bit is equivalent to multiplying it by 2.
A. True
B. False
C.
D.
Answer : B
49. All macro substitutions in a program are done before compilation of the program.
A. True
B. False
C.
D.
Answer : A
50. The output of the following code is:
void main()
{
int a = 20;
printf("%d\t%d
", ++a, a);
}

A. 21 21
B. 20 21
C. 21 20
D. 20 20
Answer : C

Sharing is caring