Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Consider the following function prototype. void funcTemp(int x, float y = 7.5

ID: 672971 • Letter: 1

Question

1) Consider the following function prototype. void funcTemp(int x, float y = 7.5, char ch = '*'); Which of the folloiwng statement in C++ is valid? (i) funcTemp(6, '#'); (ii) funcTemp(); (iii) funcTemp(3.9, '$');

A)    Only (i) and (ii)

B)    None of these

C)    Only (i) and (iii)

D)    Only (ii) and (iii)

2) Suppose that nameStr is a character array of size 21. Which of the following statement is valid in C++?


(i)       
    if (strcmp(nameStr, "Lisa") == 0)
        cout << nameStr << endl;
(ii)  
    if (nameStr[0] == 'L')
        cout << nameStr[0] << endl;

A)    None of these

B)    Only (i)

C)    Only (ii)

D)    Both (i) and (ii)

A)    None of these

B)    Only (i)

C)    Only (ii)

D)    Both (i) and (ii)

Explanation / Answer

1. C)    Only (i) and (iii)

2. D)    Both (i) and (ii)