0% found this document useful (0 votes)
11 views7 pages

MCQs

The document covers the history and significance of the C programming language, including its developer Dennis Ritchie and its key features. It also discusses setting up the development environment, data types, control structures, functions, arrays, pointers, and file handling in C. Each section includes multiple-choice questions to test knowledge on these topics.

Uploaded by

tharunss192006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

MCQs

The document covers the history and significance of the C programming language, including its developer Dennis Ritchie and its key features. It also discusses setting up the development environment, data types, control structures, functions, arrays, pointers, and file handling in C. Each section includes multiple-choice questions to test knowledge on these topics.

Uploaded by

tharunss192006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

History and Significance of C Programming

1. Who developed the C programming language?


a) Dennis Ritchie
b) Ken Thompson
c) Bjarne Stroustrup
d) James Gosling

2. In which year was the C language developed?


a) 1972
b) 1980
c) 1995
d) 2000

3. Which of the following is a key feature of C?


a) Platform dependence
b) Object-oriented nature
c) Low-level access to memory
d) None of the above

4. C is widely used for:


a) Web development
b) System programming
c) Mobile application development
d) All of the above

5. The standard version of C used today is:


a) C89
b) C99
c) C11
d) C17

2. Setting Up the Development Environment

6. Which tool is required to compile a C program?


a) Interpreter
b) Compiler
c) Debugger
d) Editor

7. What is the file extension of a C program?


a) .cpp
b) .c
c) .java
d) .py

8. Which of the following is a popular C compiler?


a) GCC
b) JDK
c) Node.js
d) Swift

9. What command is used to compile a C program in GCC?


a) gcc program.c -o output
b) compile program.c
c) run program.c
d) execute program.c

10. Which of the following is NOT part of a C program structure?


a) Header files
b) Main function
c) Class declaration
d) Variable declarations

3. Data Types, Variables, and Constants

11. Which of the following is NOT a fundamental data type in C?


a) int
b) float
c) char
d) string

12. What is the size of an int variable in most C compilers?


a) 1 byte
b) 2 bytes
c) 4 bytes
d) 8 bytes

13. How do you declare a constant in C?


a) int x = 10;
b) const int x = 10;
c) constant int x = 10;
d) define x 10;

14. What is the format specifier for printing a float value in C?


a) %d
b) %c
c) %f
d) %lf

15. Type casting is used to:


a) Convert one data type to another
b) Declare a new variable
c) Read input from the user
d) Define a function

4. Control Structures – Conditional Statements

16. The if-else statement is used for:


a) Looping
b) Decision making
c) Memory allocation
d) File handling

17. What will be the output of if(0) in C?


a) True
b) False
c) Error
d) Undefined

18. Which statement is used to execute different blocks of code based on multiple
conditions?
a) if-else
b) for
c) switch-case
d) while

19. The default case in a switch statement:


a) Must always be present
b) Is optional
c) Should be placed at the beginning
d) Can appear multiple times

20. The correct syntax for an if statement is:


a) if condition { }
b) if (condition) { }
c) if { condition }
d) if ( ) condition { }
5. Control Structures – Loops

21. A loop that runs indefinitely is called a:


a) Finite loop
b) Infinite loop
c) Count-controlled loop
d) Break loop

22. Which loop always executes at least once?


a) for
b) while
c) do-while
d) switch

23. Which keyword is used to exit a loop?


a) stop
b) break
c) continue
d) return

24. The for loop in C is used for:


a) Infinite loops only
b) Predefined iterations
c) Conditional execution
d) File handling

25. The continue statement:


a) Exits the loop
b) Skips the current iteration
c) Terminates the program
d) Declares a variable

6. Functions in C

26. Which keyword is used to define a function?


a) func
b) def
c) function
d) None of the above

27. A function that calls itself is called a:


a) Recursive function
b) Inline function
c) Anonymous function
d) Pointer function

28. What is the return type of a function that does not return anything?
a) int
b) void
c) float
d) null

29. How do you call a function in C?


a) call function();
b) function();
c) execute function();
d) run function();

30. Which of the following is a valid function prototype?


a) void sum();
b) sum();
c) function sum();
d) int sum{};

7. Arrays and Strings

31. Arrays in C are:


a) Dynamic
b) Fixed-size
c) Object-oriented
d) None of the above

32. Strings in C are terminated by:


a) A semicolon (;)
b) A newline character (\n)
c) A null character (\0)
d) A space

33. Which function is used to find the length of a string?


a) strlen()
b) length()
c) strsize()
d) strcount()

34. What is the index of the first element in an array?


a) 1
b) 0
c) -1
d) Undefined

35. Searching in an array can be performed using:


a) Linear search
b) Binary search
c) Both a and b
d) None of the above

8. Pointers and Dynamic Memory Allocation

36. A pointer variable stores:


a) A normal variable
b) A function
c) The address of another variable
d) A loop

37. Which function is used for dynamic memory allocation?


a) malloc()
b) free()
c) memory()
d) allocate()

38. How do you deallocate memory in C?


a) remove()
b) free()
c) delete()
d) release()

9. File Handling

39. Which function is used to open a file?


a) fileopen()
b) openfile()
c) fopen()
d) newfile()

40. What mode is used to open a file for reading?


a) "w"
b) "r"
c) "a"
d) "rw"

You might also like