Question
QUESTION 12 Which of these lines is NOT produced by the following code, assuming they are correctly implemented in a program? (You may need to
QUESTION 12 Which of these lines is NOT produced by the following code, assuming they are correctly implemented in a program? (You may need to fix them, but without altering the output, i.e. fix the double quotes) cout << "*" << setw(5) << 123 << "*" << 123 << "*" << endl; cout.setf(ios::showpos); cout << "*" << setw(5) << 123 << "*" << 123 << "*" << endl; cout.unsetf(ios::showpos); cout.setf(ios::left); cout << "*" << setw(5) << 123 << "*" << setw(5) << 123 << "*" << endl;
10 points QUESTION 13 Which of the following are correct ways to end a loop using a test for end-of-file? (Two correct answers)
10 points QUESTION 14 Which function takes a single char value from the input file, without regard to whether it is a whitespace?
10 points QUESTION 15 To open a file for read-write and random access does NOT require
10 points QUESTION 16 Why does this version of the swap function fail to work? Is there a fix? void swap(int & lhs, int& rhs) { lhs = rhs; rhs = lhs; }
10 points QUESTION 17 Consider the following function and code segment. void One( int first, int & second ) { first = 17; second = first + 1; } int main() { // other code ... int j = 4; int k = 3; One(j, k); // other code .. } After the call to One(j, k); what are the values of j and k?
10 points QUESTION 18 Which is correct?
10 points QUESTION 19 Which is correct?
10 points QUESTION 20 Consider the function, where the programmer inadvertently left out the ampersand in the definition of parRef. What is the output of the code? void doStuff(int parValue, int parRef) { parValue = 100; cout << parValue in call to doStuff = << parValue << endl; parRef =222; cout << parRef in call to doStuff = << parRef << endl; } and consider the call, which we assume is in a complete and correct program int n1 = 1, n2 =2; doStuff(n1, n2); cout << n1 after call to doStuff = << n1 << endl; cout << n2 after call to doStuff = << n2 << endl;
|
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