Question
C Program Our teacher gave us quizzes to use as a study guide and I want to make sure I did this correct. Thanks for
C Program
Our teacher gave us quizzes to use as a study guide and I want to make sure I did this correct. Thanks for the help!
There are 10 questions on this quiz. DO NOT PUT YOUR ANSWERS ON THIS SHEET RECORD THEM ON THE ANSWER SHEET ONLY. Using the code below (IGNORE ALL COMPILE ERRORS):
Use the following code to answer the next few questions: m. typedef enum { Holly, Tom, Julie, Fred } nameT; n. nameT yyy; o. yyy = RightFrom(Holly); p. printf(%d, yyy); r. nameT RightFrom(nameT xxx) s. { t. return ( ( xxx + 2 ) % 4 ); w. }
1. What is the numerical value of Holly?
2. On what line of code is memory allocated for a nameT?
3. What value will printf() display?
4. Would the following code get past the compiler? yyy = Nancy;
5. A data type in C has two properties. a) state and class b) limit and structure c) domain and set of operations d) none of these ============================================================================ Using the code below (IGNORE ALL COMPILE ERRORS)
a. #include
b. int sum(int n);
c. int main(){
d. int num,add;
e. printf("Enter a positive integer: "));
f. scanf("%d",&num);
g. add=sum(num);
h. printf("sum=%d",add);
j. }
k. int sum(int n){
m. if(n=0)
n. return n;
p. else
r. return n+sum(n-1);
s. }
6) If I enter the number 4 for the scanf on line f, what will the output of this program look like IF ALL ERRORS WERE FIXED?
7) T / F Recursion is not used in this code.
8) Which line of code has a compile error?
9) Which line of code above uses the address operator?
10) Which line of code has an error that will cause the program to execute improperly (think CS1050 level) ?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started