Introduction to Programming

Question #45

Read the question, compare the options, and review the correct answer below.

CS201 · Midterm#45

Consider the following code segment. What will be the output of the following program?
int func(int) ;
int num = 10 ;
int main(){
int num ;
num = 5 ;
cout << num ;
cout << func(num) ;
}
int func(int x){
return num ;
}

  1. A
    5, 5
  2. B
    10, 5
  3. C
    5, 10
  4. D
    10, 10
Show correct answer

Correct answer: C. 5, 10

Check community answers against your course notes.
← More practice questionsTake a timed test