CS101 SecondExam Form1
CS101 SecondExam Form1
CS101 SecondExam Form1
7. What will the value of "a" be after the following C++ code executes?
#include<iostream>
using namespace std;
int main( )
{
int a = 7, b = 5;
switch( a % b )
{
case 1: a = a-b;
case 2: a = a+b;
case 3: a = a*b;
case 4: a = a/b;
default: a = a;
}
return 0;
}
(Total Points: 1)
a. 7
b. 5
c. 9
d. 12
23. Which of the following assigns the value 5 to the fourth element in
(myArray)? (Total Points: 1)
a. myArray[ 3 ] = 5;
b. myArray[ 5 ] = 4;
c. myArray[ 0 ] = {4};
d. myArray[ 5 ] = {3};
24. Which of the following is not a correct array declaration? (Total Points: 1)
a. char a[ 1 ] = 'B';
b. bool a[ 5 ];
c. double a[ 3 ] = {12.5, 1.6};
d. int a[ ] = {'A', 20};