Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . What is the printout of the following switch statement? char ch = ' a ' ; switch ( ch ) { case '
What is the printout of the following switch statement?
char ch a;
switch ch
case a:
case A:
cout ch endl; break;
case b:
case B:
cout ch endl; break;
case c:
case C:
cout ch endl; break;
case d:
case D:
cout ch endl;
a ab
b a
c abcd
d aa
What is the printout of the following code?
#include
using namespace std;
void fint &p int p
p;
p;
int main
int x;
int x;
fx x;
cout x is x x is x;
a x is x is
b x is x is
c x is x is
d x is x is
The following code displays
#include
using namespace std;
void maxValueint value int value int max
if value value
max value;
else
max value;
int main
int max ;
maxValue max;
cout "max is max endl;
return ;
a max is
b max is
c max is
d max is
What is the output of the following code?
#include
using namespace std;
void fdouble &p
p ;
int main
double x ;
double y ;
fx;
fy;
cout x is x;
cout y is y endl;
return ;
a x is y is
b x is y is
c x is y is
d x is y is
e x is y is
The following program invokes p three times. What is the printout from the last call of p
#include
using namespace std;
int j ;
void p
int i ;
static int j ;
i;
j;
cout i is i j is j endl;
int main
p;
p;
p;
a i is j is
b i is j is
c i is j is
d i is j is
Given the following two arrays:
char sabc;
char s "abc";
Which of the following statements is correct?
a s has three characters
b s has three characters
c s has four characters
d s has four characters
Analyze the following code:
int main
int x;
int i;
for i ; i ; i
xi i;
cout xi;
return ;
a The program may have a runtime error because the last statement in the main function has the out of bound index for the array.
b The program displays
c The program has a compile error because i is not defined in the last statement in the main function.
d The program displays
e The program might displays a random number
Show the output of the following code:
#include
using namespace std;
void increaseint x int size
for int i ; i size; i
xi;
void increaseint y
y;
int main
int x
;
increasex;
int y
;
increasey;
cout x y;
a
b
c
d
e
Suppose you declare
char city "Dallas";
How many characters are stored in city?
a
b
c
d
What is the printout of the following code?
char s "Dallas";
char s "Dallas";
strcats s;
cout s;
a Dallas
b DD
c DallasDallas
d D
When you pass an array to a function, the function receives
a a copy of the array
b the reference of the array
c the length of the array
d a copy of the first element
What is the output of the following code?
#include
using namespace std;
int main
int matrix
;
int sum ;
for int i ; i ; i
cout matrixi;
return ;
a
b
c
d
e
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