C Programming MCQs ( Multiple Choice Questions ) with Answers - Set I
Q1. Every C program consists of __________ function(s).
a) Only one
b) Only two
c) One or two
d) One or many ✔
Answer is d) One or many
Explanation : Each C program must have at least one function, which is main(),then there is no limit on number of functions
Q2. What is the correct value to return to the operating system upon the successful completion of a program?
a) 1
b) 0 ✔
c) Programs do not return a
d) 2
Answer is b) 0
Explanation : After successful completion of a program 0 is returned to the operating system.
Q3. What is the only function all C programs must contain?
a) start()
b) system()
c) main() ✔
d) Program()
Answer is c) main()
Explanation : Since main() is the starting of a program execution.
Q4. How would you round off a value from 1.66 to 2.0?
a) ceil(1.66) ✔
b) floor(1.66)
c) roundup(1.66)
d) roundto(1.66)
Answer is a) ceil(1.66)
Explanation : ceil(1.66) = 2.0 and floor(1.66) = 1.0
Q5. Which of the following is not a correct variable type in C ?
a) Float
b) Real ✔
c) Int
d) Double
Answer is b) Real
Explanation : Real is not a variable type in C language.
Q6. Which of the following is a not a keyword in C language?
a) Void
b) Volatile
c) Sizeof
d) Getchar ✔
Answer is d) Getchar
Explanation : Getchar() is not a keyword in C language.
Q7. Which of the following correctly accesses the seventh element stored in array Foo, an array with 100 elements?
a) Foo[6]; ✔
b) Foo[7];
c) Foo(7);
d) Foo;
Answer is a) Foo[6]
Explanation : Array index starts with 0 in c language.
Q8. Which of the following is a complete function?
a) int funct();
b) int funct(int x) {return x=x+1;} ✔
c) void funct(int) {printf(“Hello");}
d) void funct(x) {printf(“Hello");}
Answer is b) int funct(int x) {return x=x+1;}
Explanation : As return type for the function is int and in the function definition return statement is used by returning an integer value of x.
Q9. What is the return value of the following statement if it is placed in C program? strcmp (“ABC”,”ABC”);
a) 1
b) 33
c) Compilation error
d) 0 ✔
Answer is d) 0
Explanation : If the same statement is used in a C program compilation error will occur.
Q10. What number will z in the sample code given below?
int z, x=5, y= -10, a=4, b=2; z=x++ - --y *b/a;
a) 5 ✔
b) 6
c) 10
d) 11
Answer is a) 5
Explanation : According to precedence of operators.
Q11. Suppose the return type of function f is void. Which one of the following statements is true?
a) Function f does not contain a return statement
b) Function f does not have parameters
c) Function f returns a generic value ✔
d) Function f does not work correctly
Answer is c) Function f returns a generic value
Explanation : In C Programming Function returns a generic value.
Q12. How would you declare a constant of 5 called "MYCONST"?
a) constant MYCONST = 5;
b) int myconst = 5;
c) #define MYCONST 5; ✔
d) constant = 5;
Answer is c) #define MYCONST 5
Explanation : #define statement is used.
Q13. Which of the following function returns multiple values?
a) Printf()
b) Scanf() ✔
c) Printf() & Scanf()
d) Getch()
Answer is b) Scanf()
Explanation : Scanf() function returns multiple values.
Q14. Which command is used to skip the rest of a loop and carry on from the top of the loop again?
a) break;
b) Resume;
c) continue; ✔
d) skip
Answer is c) continue;
Explanation : continue statement is used to skip the rest of the statements in a loop and carry from the top of the loop again.
Q15. Which of the following is not a storage class in C?
a) Auto
b) Struct ✔
c) Extern
d) Static
Answer is b) Struct
Explanation : Struct is not a storage class in C language.
Recommended MCQs
C programming MCQs with Answers Set II
Informatica MCQs with Answers Set I
Informatica MCQs with Answers Set II
Informatica MCQs with Answers Set III
Informatica MCQs with Answers Set IV
Informatica MCQs with Answers Set V
Informatica MCQs with Answers Set VI
Computer Organization and Architecture MCQs with Answers Set I
Computer Organization and Architecture MCQs with Answers Set II
Computer Organization and Architecture MCQs with Answers Set III
If you have any doubts join the discussion below ,our Moderator will reply to your Queries