Home Programming Kids Programming Hardware & Software Hardware & Networking APP security Software Education Kids Study MCQS Download OTHERS Multiple Choice Question (MCQ) Multiple Choice Question (MCQ) Login

C Programming Multiple Choice Question MCQ

Categories: Programming

Q1. Why is learning programming important in today's world?

(A) For academic purposes only

(B) To automate and solve complex problems

(C) Only for software development

(D) For entertainment purposes only


Answer: B


Q2. What is the main function of a compiler in programming?

(A) To write code

(B) To interpret code

(C) To convert code into machine language

(D) To debug code


Answer: C


Q3. Which of the following is true about interpreters?

(A) They execute programs faster than compilers

(B) They translate the entire program at once

(C) They translate and execute code line by line

(D) They are not used in modern programming


Answer: C


Q4. How does a compiler differ from an interpreter?

(A) A compiler executes code, while an interpreter does not

(B) A compiler debugs code, while an interpreter does not

(C) A compiler translates the entire program at once, while an interpreter translates it line by line

(D) A compiler is used only in C programming, while an interpreter is not


Answer: C


Q5. What is the primary purpose of writing a "Hello World" program when learning a new programming language?

(A) To test if the language supports string operations

(B)To learn complex programming concepts

(C) To demonstrate basic syntax and output

(D) To introduce advanced programming features


Answer: C


Q6. What will be the output of the following C program?

#include <stdio.h>

int main() {

printf("Hello, World!");

return 0;

}

(A) Hello, World!

(B) Syntax Error

(C) 0

(D) Nothing


Answer: A


Q7. Identify the error in this C program:

#include <stdio.h>

int main() {

print("Hello, World!");

return 0;

}

(A) Missing #include statement

(B) Incorrect function name

(C) Syntax error in return statement

(D) No error


Answer: B


Q8. Which of the following is not a keyword in C?

(A) int

(B) char

(C) include

(D) float


Answer: C


Q9 What data type would you use to store a character in C?

(A) int

(B) float

(C) char

(D) double


Answer: C


Q10. Which of the following is a valid identifier in C?

(A) 2ndName

(B) _name

(C) #name

(D) none of these


Answer: B


Q11 What is the size of 'int' data type in C?

(A) Depends on the system

(B) 4 bytes

(C) 8 bytes

(D) 2 bytes


Answer: A


Q12 What is the difference between 'float' and 'double' data types in C?

(A) Syntax only

(B) Precision

(C) Usage

(D) No difference


Answer: B


Q13 What will be the output of the following C code?

int main() {

char c = 'A';

printf("%d", c);

return 0;

}

(A) 65

(B) A

(C) Syntax Error

(D) None of these


Answer: A


Q14 Identify the error in this C code:

int main() {

int number = 100.5;

printf("%d", number);

return 0;

}

(A) Assigning float to int

(B) Syntax error

(C) No error

(D) Wrong printf format


Answer: A


Q15 Spot the error in this code snippet:

#include <stdio.h>

int main() {

const int age; age = 30;

printf("%d", age);

return 0;

}

(A) Uninitialized constant

(B) Missing return statement

(C) Syntax error in printf statement

(D) No error


Answer: A


Q16 What is the purpose of the printf function in C?

(A) To read input

(B) To print output

(C) To perform calculations

(D) To control program flow


Answer: B


Q17 What does %d signify in the printf or scanf function?

(A) Double data type

(B) Decimal integer

(C) Dynamic allocation

(D) Directory path


Answer: B


Q18 What will be the output of the following C code?

int main() {

printf("%d", 500);

return 0;

}

(A) 500

(B) %d

(C) Syntax Error

(D) None of these


Answer: A


Q19 What will the following C code output?

int main() {

int num;

scanf("%d", &num);

printf("%d", num);

return 0;

}

(A) The inputted number

(B) %d

(C) Syntax Error

(D) Nothing


Answer: A


Q20 Pseudocode: READ number PRINT "The number is ", number

What does this pseudocode do?

(A) Reads and prints a number

(B) Prints a fixed number

(C) Generates a random number

(D) None of these


Answer: A


C Programming Multiple Choice Question MCQ