A Learning Platform

SUCCESS

Success = Discipline + Consistency + Sacrifice.
Discipline - in what you do.
Consistency - in what you do.
Sacrifice - for what you do.

                   -- Manjunatha C. P. --

C PROGRAMMING MCQ SET 3

1. Which qualifier tells the compiler that a variable may change unexpectedly?
A) const
B) volatile
C) static
D) extern

B) volatile

2. What is the result of the expression: 3 + 4 * 2 ?
A) 14
B) 11
C) 10
D) 7

B) 11

3. Which function is used to move the file pointer to a specific location?
A) fopen()
B) fseek()
C) ftell()
D) rewind()

B) fseek()

4. Which of the following creates a symbolic constant?
A) #define
B) const
C) typedef
D) enum

A) #define

5. What is the scope of a global variable?
A) Within a block
B) Within a function
C) Throughout the program
D) Only in header file

C) Throughout the program

6. Which operator is used for conditional execution?
A) :
B) ?
C) &&
D) ||

B) ?

7. What does the extern keyword indicate?
A) Local variable
B) Global variable defined elsewhere
C) Constant variable
D) Register variable

B) Global variable defined elsewhere

8. Which function appends one string to another?
A) strcpy()
B) strcmp()
C) strcat()
D) strlen()

C) strcat()

9. What is the output type of relational operators in C?
A) int
B) float
C) char
D) void

A) int

10. Which header file is required for strlen()?
A) math.h
B) string.h
C) ctype.h
D) stdlib.h

B) string.h

11. A structure that contains a pointer to itself is called?
A) Nested structure
B) Self-referential structure
C) Union
D) Array structure

B) Self-referential structure

12. Which function flushes the output buffer?
A) flush()
B) fflush()
C) fclear()
D) clearbuf()

B) fflush()

13. What is the value of the expression: !0 ?
A) 0
B) 1
C) -1
D) Undefined

B) 1

14. Which operator is used to increment a value by 1?
A) ++
B) +=
C) +
D) **

A) ++

15. Which type of casting is done automatically by the compiler?
A) Explicit casting
B) Implicit casting
C) Forced casting
D) Manual casting

B) Implicit casting

16. Which function opens a file in binary mode for reading?
A) fopen("file","rb")
B) fopen("file","r")
C) open()
D) read()

A) fopen("file","rb")

17. What is the typical size of float data type?
A) 2 bytes
B) 4 bytes
C) 8 bytes
D) Depends on system

B) 4 bytes

18. Which operator has the lowest precedence?
A) *
B) +
C) =
D) &&

C) =

19. Which statement is used to terminate the program?
A) break
B) exit()
C) return
D) continue

B) exit()

20. What does the function ftell() return?
A) File size
B) Current file pointer position
C) File name
D) EOF value

B) Current file pointer position

21. Which keyword suggests inline expansion of a function?
A) inline
B) static
C) extern
D) register

A) inline

22. Which function supports dynamic memory resizing?
A) malloc()
B) calloc()
C) realloc()
D) free()

C) realloc()

23. What is the default initial value of global variables?
A) Garbage value
B) 0
C) NULL
D) Depends on compiler

B) 0

24. Which operator is used for bitwise XOR?
A) ^
B) |
C) &
D) ~

A) ^

25. Which function is the safest replacement for gets()?
A) scanf()
B) fgets()
C) puts()
D) getline()

B) fgets()