Using the follwing code the answer is A)13
#include <iostream>
#include <math.h>
void exam(int & N){ N++; std::cout<<N<<std::endl;}
int main(){
int num=10;
for (int i=0;i<3;i++) exam(num);
std::cout<<num;
}
6) What is the final value of variable num after executing the following statements? void Exam(int...
11) What is the output of the following Che statements? void Exam(int N) { int list1[3] { 2, 4, 6); if (NX2 - 0) cout << listi[N - 1); else cout << listi[N 5):) void main() { int list[3] - (1, 3, 5); Exam(list[2]);} A) 2 B) 4 C) 6 D) 3 12
1) Fix the Function #include <iostream> void print Num() { std::cout << number; }; int main() { int number = 35; printNum (number); return 0; (Give two ways to fix this code. Indicate which is preferable and why.) #include <iostream> void double Number (int num) {num = num * 2;} int main() { int num = 35; double Number (num); std::cout << num; // Should print 70 return 0; (Changing the return type of doubleNumber is not a valid solution.)
7 Question 27 4 pts What is displayed by this program? #include <stdio.h> void seven(int *xPtr); int main(void) int x,y: X-5: y = 6: seven(&x): seven(&y): printf("%4d%4d\n", x,y); return(0); void seven(int "xPtr) inty: y -'xPtr+2; *xPtry3; (Show blank spaces with asterisks)
What is the output of the following C++ code? int count = 1; int num = 25; while (count < 25) { num--; count++; } cout << count « " " « num << endl i 25 1 0 24 1 0 25 0 0 24 0 In this while loop statement, while (counter < 10), where counter is an int variable. Which statement below is an equivalent way to write this while statement? while (10 < counter) while (9...
QUESTION 26 Given the following function: int secret(int num, int m) inti, prod=1; if (m=0) return 1: - for (i=0; i<m; i++) { prod = prod * num; } return prod; What is the output for this function call? cout << secret(10,6);
homework c++ find the error/correction void Showval (int n) for (int i = 0; i<10;-) cout <<n [i; )
What is the value of n after the following snippet? int n = 13, m = 16; int* np = &n; np = &m; *np = 10; O 16 O 10 O A memory address O 13 True or False? This snippet correctly frees the memory it allocates. int** nums = new int*[10]; for (int i = 0; i < 10; i++) { nums[i] = new int; for (int i = 0; i < 10; i++) { delete nums[i]; delete...
Consider the following code. It is valid. What is printed? public static void TestLabel() { int i = 0; MyLabel: for (i++; i<20; i++) { if (i 10) continue MyLabel; System.out.println(i); } nothing (doesn't work) 20 10
computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int 10 for(= 0; i < 101) printf("d", 1); A. 10 times B. 1 time C. It will run forever D. 0 times 2. What will be the output of this program? #include <stdlib.h> #include <stdio.h> int main() int a = 100, b = 200, C = 300; if(!a >= 500) b = 300; C = 400; printf("%d, 8d, &d", a, b, c); return 0;...
22. (6 points) Determine the output for the following coe # include < stdio.h > int main(void) ( int z 1, total -0, y printf(d , x) ) //end-for printf("The total %d\n", total) ) //end-main