Pre-lab questions
Name:
Cnet ID:
Lab start time:
Note: There may be more than one answer.
Copy and paste this into any editor. Remove lines that
are incorrect answers. Some may have more than one
answer.
_____1. The C compiler takes what as input?
a) a flow-chart with the program design
b) instructions written for a human
c) code written in a programming language
d) code written in binary
_____2. What does the C compiler produce as output?
a) a web page
b) an executable
c) optimized code written in a programming language
d) an iPad app
_____3. What function prints to the screen in functions.c?
a) printf
b) print
c) cout
d) putc
_____4. What syntax do you use for a single-line comment?
a) /* ... */
b) //
c) $
d) #
_____5. What syntax do you use use for a multi-line comment?
a) /* ... */
b) //
c) $
d) #
_____6. What do you put at the top of every .c file?
a) #include <stdio.h>
#include <stdlib.h>
b) #define FILENAME_C
c) #ifndef FILENAME_C
d) #undef FILENAME_C
_____7. What do you put at the top of every .h file?
a) #include <stdio.h>
#include <stdlib.h>
b) #define FILENAME_H
c) #ifndef FILENAME_H
d) #undef FILENAME_H
_____8. Where does every C program start?
a) in the first function in the file named main.c
b) in the last function in the file named main.c
c) in the first function in the first file of the compile line
d) in the function named main
_____9. What does the x.h file need to contain?
a) prototypes or signatures of all functions in x.c
that are used outside of x.c.
b) declarations (with extern preceding it) of all variables declared
in x.c that are used outside of x.c.
c) #include "x.c"
d) declarations of any types that are created for x.c but are used
outside of x.c.
_____10. What is the return type of the return_a_value function?
a) int
b) unsigned int
c) char
d) float
_____11. What line of code in main calls fact on the number 5?
a) unsigned long int result = fact(input);
b) fact(5);
c) num_correct += check_factorial(5, 120);
d) return_a_value(3);