Fundamentals Final UPDATED Exam
Questions and CORRECT Answers
Who invented the C language? - Correct Answer- Dennis Ritchie invented C at Bell Labs
When you compile a correct C program you get a machine executable file such as a.out
produced by the gnu compiler gcc. - Correct Answer- True
Which is true:
1. #define is a preprocessor command often used to introduce named constants
2. double and goto are keywords declaring types.
3. return (0); is normally the last statement in main()
4. The file stdio.h is where the compiler finds scanf(). - Correct Answer- 1, 3, 4
The statement printf("HELLO\t\tWORLD\n"); - Correct Answer- Prints HELLO WORLD
followed by a new line
The expression PI * radius * radius would be used to compute - Correct Answer- A circles
area
In a format string for printf which would you use to print an int? - Correct Answer- %d
The code
i = -10;
while ( i < 0)
{ ... do something ; i--; }
Displays a common error - Correct Answer- its an infinite loop
, The following program is suppose to write Hello World onto the screen but it has syntax
errors - find and correct.
#include <stdio.h>
int main(void)
{
printf(" Hello World\n");
return 0,
} - Correct Answer- It should be return 0;
Assume the given declarations and fill in the value of the expression . int a = 3, b = 4, c = 0, d
= '1';
Expression: a % b - Correct Answer- 3
Assume the given declarations and fill in the value of the expression . int a = 3, b = 4, c = 0, d
= '1';
Expression: b % a - Correct Answer- 1
Assume the given declarations and fill in the value of the expression . int a = 3, b = 4, c = 0, d
= '1';
Expression: a < b - Correct Answer- 1
Assume the given declarations and fill in the value of the expression . int a = 3, b = 4, c = 0, d
= '1';
Expression: c < b && a > 3 - Correct Answer- 0