C Programming Language Quiz
English
Advanced
This quiz has basic question about C programming language.
Description
31
Questions
1 min
Per question
4:25
Average time
3.0
Contest Score
4.5
Community Rating
17
Participants
23 comments
Fairy Meerkat
It is a good quiz about C. It doesn't have deep questions but very good in testing fundamentals of C language.
Giant Kitten author
Thanks.
@bela
so Nice Keep it up
Giant Kitten author
Thank you so much for the feedback.
Agile Jaguar
Pointers are not addresses but pointer is a special type of variable which can hold the address of a variable.
Good for basic level of c language.
Giant Kitten author
Thank you so much for your time and comment.
Michael
There's another definition for Pointers I.e. A special type of variable... Nice questions once again
Giant Kitten author
Thanks for the feedback :)
Small Lizard
Which one of the following is true about conditional compilation?
Your answer is "It compiles the program based on a condition".
About "It is handled by the computer": it is correct too, because preprocessor is running on the computer.
Giant Kitten author
Sorry for the unclear choice. It was meant like the computer handles it on it's own with out being instructed. Appreciate the comment. It will be rectified ASAP.
Small Lizard
The minimum number of temporary variables needed to swap the contents of two variables is...
You say that 0, and this is your code:
b = a + b;
a= b - a;
b= b - a;
But this is possible only for number data types. How to swap two instances of a struct, for example?
Giant Kitten author
Yes, the case should be specified. I thought it was implicitly indicated, that the variables are numbers. Thanks for the comment. I will correct the issue ASAP.
Small Lizard
Literal means...
Your answer is string constant.
Let's read https://en.wikipedia.org/wiki/Literal_(computer_programming):
"Literal is a notation for representing a fixed value in source code."
For example, literals are: 1, 1.5, "hello", true, 'x'.
String constant is const char s="world".
Giant Kitten author
Sorry for the error in this question. It was meant to ask about string literal as in: String constants, also known as string literals, are a special type of constants which store fixed sequences of characters.
CORRECTION: the question should read as String literals.
Small Lizard
The C language doesnot do automatic array bound checking. This is...
Your answer is C's shortcoming.
But this is advantage too, because language spends time for automatic array bound checking, so C works faster because of it doesn't do this.
Giant Kitten author
I guess you understood it that way but the general understanding is that: "Many programming languages, such as C, never perform automatic bounds checking to raise speed. However, this leaves many off-by-one errors and buffer overflows uncaught. Many programmers believe these languages sacrifice too much for rapid execution..."
https://en.m.wikipedia.org/wiki/Bounds_checking
Thanks for pointing out the ambiguity.
Small Lizard
One of the following is not a keyword in C?
Let's read https://en.cppreference.com/w/c/keyword:
"This is a list of reserved keywords in C. Since they are used by the language, these keywords are not available for re-definition." And here provided list of keywords.
You can define your own variable named "main", "scanf", "IF" or "printf", so they all are not keywords. The only keyword in options is "if".
Giant Kitten author
Thanks for pointing out the mistake. The question should read as one of the following is a keyword in C and the answer would be if.
Small Lizard
One of the following is NOT a valid argument to the function main in a C program:...
I can name arguments of main function as I want. Example: https://ideone.com/zTUAaK
Giant Kitten author
That's true. It was refering to a general approach as in: The main() function has two arguments that traditionally are called argc and argv and return a signed integer. Most Unix environments expect programs to return 0 (zero) on success and -1 (negative one) on failure.

https://opensource.com/article/19/5/how-write-good-c-main-function#:~:text=The%20main()%20function%20has,(negative%20one)%20on%20failure.&text=The%20argument%20vector%2C%20argv%2C%20is,line%20that%20invoked%20your%20program.
Take the quiz to leave a comment