Home

C Programming MCQ Solved Paper for RRB Group D

Thursday 9th of March 2023

Sharing is caring

1. static variable will not always have assigned value.
A. True
B. False
C.
D.
Answer : A
2. The output of the following code is:
main() 
{
int sub[50];
for(i=0; i<=48;i++)
{
sub[i]=i;
printf("
%d", sub[i]);
}
}

A. 0 to 48 will be displayed
B. 48
C. 49
D. Compilation Error
Answer : D
3. Which of the following is the most preferred way of throwing and handling exceptions?
A. Throw by value and catch by reference.
B. Throw by reference and catch by reference.
C. Throw by value and catch by value
D. Throw the pointer value and provide catch for teh pointer type.
Answer : B
4. printf("%d", sizeof('2')); will print 2.
A. True
B. False
C.
D.
Answer : B
5. # define PI = 8;' is the correct declaration of macros.
A. True
B. False
C.
D.
Answer : B
6. C is a ___ language
A. High Level and Procedural
B. Low Level and OOPS
C. Middle Level and Procedural
D. Machine Level and OOPS
Answer : A
7. Variables declared as register storage type gets stored in CPU registers.
A. True
B. False
C.
D.
Answer : A
8. strcat() function ----------------------- two strings.
A. delete
B. concatenate
C. compare
D. none of the above
Answer : B
9. The output of the following code is:
main() 
{
int k, num = 30;
k = (num > 5 ? (num <= 10 ? 100 : 200) : 500);
printf("
%d", num);
}

A. 200
B. 500
C. 30
D. Unpredictable
Answer : C
10. The printf() function retunes which value when an error occurs?
A. Positive value
B. Zero
C. Negative value
D. None of these
Answer : C
11. The value of an enumerated datatype can be read using scanf() function.
A. True
B. False
C.
D.
Answer : B
12. do-while loop is useful when we want the statements within the loop must be executed
A. Only once
B. At least once
C. More than Once
D. Any one of the above
Answer : B
13. The output of the following code is:
main() 
{
unsigned int a = 10;
while (a>=10)
{
int a; a-- ;
}
printf("%i", a);
}

A. Infinite loop
B. 9
C. 0
D. None
Answer : A
14. There are total ------ numbers of operators in 'C'.
A. 35
B. 45
C. 55
D. 40
Answer : B
15. Which among the following is a unconditional control structure
A. do-while
B. if-else
C. goto
D. for
Answer : C
16. char *s[10] defines an array of ------------------------
A. pointers to strings
B. string to pointer
C. both
D.
Answer : A
17. The expression "b = 3 ^ 2;" will evaluate b = 9.
A. True
B. False
C.
D.
Answer : B
18. Which escape character can be used to beep from speaker in C?
A. \a
B. \b
C. \m
D.
Answer : A
19. Which of the following is not a preprocessor directive
A. #if
B. #elseif
C. #undef
D. #pragma
Answer : B
20. Which of the following is not recommended in a header file?
A. Type definitions (typedefs)
B. Class definitions
C. Function definitions
D. Template definitions
Answer : D
21. Union is used to hold different data at different time.
A. True
B. False
C.
D.
Answer : A
22. What's wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);
A. the question mark should be an equal sign
B. the first semicolon should be a colon
C. there are too many variables in the statement
D. the conditional operator is only used with apstrings
Answer : D
23. What is right way to Initialization 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 } ;
Answer : A
24. What does STL stand for?
A. Simple Template Library
B. Standard Template Library
C. Static Type Library
D. Single Type-based Library
Answer : A
25. For 16?bit compiler allowable range for integer constants is ______ ?
A. ?3.4e38 to 3.4e38
B. ?32767 to 32768
C. ?32768 to 32767
D. ?32668 to 32667
Answer : C
26. = and = = have the same operation.
A. True
B. False
C.
D.
Answer : B
27. The main() function can call itself recursively.
A. True
B. False
C.
D.
Answer : A
28. 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
29. Single operations involving entire arrays are permitted in C.
A. True
B. False
C.
D.
Answer : A
30. Character data types cannot be declared as unsigned.
A. True
B. False
C.
D.
Answer : B
31. The default initial value of automatic storage class is 0.
A. True
B. False
C.
D.
Answer : B
32. What will be output if you will compile and execute the following c code?
#include 
int main(){
int i=320;
char *ptr=(char *)&i;
printf("%d",*ptr);
return 0;
}

A. 1
B. 64
C. 320
D. Compiler Error
Answer : B
33. enum helps to create user defined datatype.
A. True
B. False
C.
D.
Answer : A
34. 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
35.

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
36. 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
37. The function fopen() on failure returns---------------------.
A. 0
B. NULL
C. 1
D. none of the above
Answer : B
38. Which options shows the correct hierarchy of arithmetic operators
A. **, * or /, + or -
B. **, *, /, +, -
C. **< /< *< +<-
D. / or *, - or +
Answer : D
39. What's wrong? while( (i < 10) && (i > 24))
A. the logical operator && cannot be used in a test condition
B. the while loop is an exit-condition loop
C. the test condition is always true
D. the test condition is always false
Answer : D
40. 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
41. Which of the following language is predecessor to C Programming Language?
A. A
B. B
C. BCPL
D. C++
Answer : B
42. What is the difference between overloaded functions and overridden functions?
A. Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding
B. Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called a overloaded fucntion.
C. Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding
D. Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden fucnion.
Answer : B
43. The-------------------- statement helps immediate exit from any part of the loop
A. break
B. continue
C. exit
D. All of the above
Answer : A
44. An array elements are always stored in _________ memory locations.
A. Sequential
B. Random
C. Sequential and Random
D. None of the above
Answer : A
45. fprintf()function can be used to write into console.
A. True
B. False
C.
D.
Answer : B
46. C programs are converted into machine language with the help of
A. An Editor
B. A compiler
C. An operating system
D. None of the above
Answer : B
47. 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
48. The output of the following code is:
main() 
{
int a = 5, b = 6;
(a == b? printf("%d", a));
}

A. 0
B. 5
C. Error
D. None of the above
Answer : C
49. Each pass through a loop is called a/an
A. enumeration
B. iteration
C. culmination
D. pass through
Answer : C
50. A function to be called must be ended with a----------------
A. .
B. ?
C. ;
D. none of the above
Answer : C

Sharing is caring