💡 C Programming MCQs and Exam Questions

Practice 159 approved 💡 C Programming MCQs and exam questions from the 💻 Programming subject.

159 solved MCQs

Which of the following cannot be checked in a switch-case statement?Answer: Float Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?Answer: rem = fmod(3.14, 2.1); What are the types of linkages?Answer: External, Internal and None Which of the following special symbol allowed in a variable name?Answer: _ (underscore) Is there any difference between following declarations? 1 : extern int fun(); 2 : int fun();Answer: No difference, except extern int fun(); is probably in another file How would you round off a value from 1.66 to 2.0?Answer: ceil(1.66) By default a real number is treated as aAnswer: double Which of the following is not user defined data type? 1 : struct book { char name[10]; float price; int pages; }; 2 : long int l = 2.35; 3 : enum day {Sun, Mon, Tue, Wed};Answer: 2 Is the following statement a declaration or definition? extern int i;Answer: Declaration Identify which of the following are declarations 1 : extern int x; 2 : float square ( float x ) { ... } 3 : double pow(double, double);Answer: 1 and 3 In the following program where is the variable a getting defined and where it is getting declared? #include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;Answer: extern int a is declaration, int a = 20 is the definition When we mention the prototype of a function?Answer: Declaring In C++ the body of the function is enclosed which?Answer: { } Where are data and programs stored when the processor uses them?Answer: main memory Loops within loops are called _____ loops.Answer: Nested Which modules is not part of C programming?Answer: Converter The single character is represented by _____ format specifier.Answer: %c The comparison between two values is performed by _____ operator.Answer: Relational In BASIC programming, _____ command is used to clear screen.Answer: CLS In C language, compound operator contains _____ operator and assignment operator.Answer: Arithmetic Which is capable to accept a string with white space characters?Answer: gets() High-level programming languages are classified into ______ categories.Answer: 2 Which of the following is correct email address?Answer: username@website.info Surena an invention of the university of Tehran is?Answer: Robot A quantity whose value may change during execution of the program is called a _____?Answer: Variable C language was developed by Dennis M. Ritchie in _____?Answer: 1972 Which describes meaning to statement of a programming language?Answer: Semantic Which is used when a single block of statements is to be executed if the condition is true?Answer: If statement Which loop is preferred to use when the programmer knows in advance how many times the body of the loop will be executed?Answer: For The rules of a programing language according to which statements of program are to be written are referred as _____?Answer: Syntax