Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
Can someone please help me with these? Question 1 What will be displayed on the console given the following code fragment?
Can someone please help me with these?
Question 1
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
system("pause");
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << num1Par << num2Par;
}
A) 33
B) 34
C) 35
D) 36
Question 2
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
return 0;
}
void myFunction (int num1Par, int num2Par) {
num1Par++;
num2Par++;
cout << num1Par << num2Par;
}
A) 42
B) 43
C) 44
D) 45
Question 3
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
return 0;
}
void myFunction (int num1Par, int num2Par) {
num1Par++;
num2Par++;
++num1Par;
++num2Par;
cout << num1Par << num2Par;
}
A) 65
B) 56
C) 23
D) 43
Question 4
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
system("pause");
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << pow(num2Par,num1Par);
}
A) 33
B) 46
C) 64
D) 65
Question 5
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 4;
int num2 = 3;
myFunction (num1, num2);
system("pause");
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << pow(num2Par,num1Par);
}
A) 81
B) 80
C) 79
D) 77
Question 6
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 2;
int num2 = 2;
myFunction (num1, num2);
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << pow(num2Par,pow(num1Par,num2Par));
}
A) 14
B) 15
C) 16
D) 13
Question 7
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 18;
int num2 = 2;
cout << modIt(num1, num2);
return 0;
}
int modIt(int num1Par, int num2Par) {
return num1Par % num2Par;
}
A) 2
B) -1
C) 1
D) 0
Question 8
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 1234561;
int num2 = 2;
cout << modIt(num1, num2);
return 0;
}
int modIt(int num1Par, int num2Par) {
return num1Par % num2Par;
}
A) 4
B) 3
C) 2
D) 1
Question 9
What will be displayed on the console given the following code fragment?
int main() {
int aSide = 3;
int bSide = 4;
myFunction (aSide, bSide);
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << sqrt(pow(num1Par,2.0) + pow(num2Par, 2.0));
}
A) 5555
B) 555
C) 55
D) 5
Question 10
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << pow(num2Par,num2Par);
}
A) 245
B) 256
C) 222
D) 652
Question 11
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << sqrt(num2Par);
}
A) 5
B) 4
C) 3
D) 2
Question 12
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
myFunction (num1, num2);
cout << (num1 * num2);
return 0;
}
void myFunction (int num1Par, int num2Par) {
cout << num1Par << num2Par;
}
A) 1234
B) 3412
C) 1423
D) 2345
Question 13
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
int num2 = 4;
num1 = myFunction (num1, num2);
cout << num1;
return 0;
}
int myFunction (int num1Par, int num2Par) {
cout << num1Par << num2Par;
return (num1Par * num2Par);
}
A) 1234
B) 3412
C) 4312
D) 3222
Question 14
What will be displayed on the console given the following code fragment?
int main() {
int num1 = 3;
double num2 = 4.0;
num1 = gradeIt(num2);
cout << num1;
return 0;
}
int gradeIt (double scorePar) {
if (scorePar >= 60.0)
return 1;
else
return -1;
}
A) 2
B) 1
C) 0
D) -1
Question 15
What will be displayed on the console given the following code fragment?
int main() {
double num2 = 4.0;
string message = "";
cout << gradeIt(num2);
return 0;
}
string gradeIt (double scorePar) {
if (scorePar < 60.0)
return "Passed";
else
return "Failed";
}
A) Passed
B) Failed
C) PassedFailed
D) none of the above
Question 16
What will be displayed on the console given the following code fragment?
int main() {
double num2 = 4.0;
string message = "";
cout << gradeIt(pow(20, num2));
return 0;
}
string gradeIt(double scorePar) {
if (scorePar > 60.0)
return "Passed";
else
return "Failed";
}
A) Passed
B) Failed
C) Pass
D) Fail
Question 17
What will be assigned to variable message given the following code fragment?
int main() {
int num1 = 3;
int num2 = 5;
double num3 = 6.0;
string message = "";
message = gradeIt(num2) + gradeIt(num1, num2);
return 0;
}
string gradeIt (double scorePar) {
if (scorePar < 60.0)
return "Passed";
else
return "Failed";
}
string gradeIt (int num1Par, int num2Par) {
if (num1Par > 3 && num2Par > 3)
return "YES";
else
return "NO";
}
A) PassedNO
B) PassedYES
C) Passed
D) YES
Question 18
What will be assigned to variable statement given the following code fragment?
int main() {
int num1 = 3;
int num2 = 5;
double num3 = 6.7;
string statement = "CS";
statement = gradeIt(num2, num3);
return 0;
}
string gradeIt (double scorePar) {
if (scorePar < 60.0)
return "Passed";
else
return "Failed";
}
string gradeIt (int num1Par, int num2Par) {
if (num1Par > 3 && num2Par > 3)
return "YES";
else
return "NO";
}
string gradeIt (int num1Par, double num2Par) {
return to_string(num1Par * (int)num2Par);
}
A) 20
B) 30
C) 40
D) 50
Question 19
What will be assigned to variable output given the following code fragment?
int main() {
double num1 = 3;
double num2 = 5;
int num3 = 9;
string output = "CS";
output = output + modIt(num3) + modIt(num1, num2);
return 0;
}
string modIt(int num3Par) {
return to_string(num3Par) + "ABC";
}
string modIt (double num1Par, double num2Par) {
return "CS225";
}
A) CS9AB