Ans 4: Edge in this graph from given options
(4,5)
(2,4)
(3,1)
=====================================================================================
Ans 5
// Write C++ code here
std::vector<int> v ={6,4,81,99,17};
v.pop_back(); //remove 17
v.pop_back(); //remove 99
v.push_back(32); //add 32 at end [6,4,81,32]
v.pop_back(); //remove 32
v.push_back(12); //add 12 at end [6,4,81,12]
v.pop_back(); //remove 12
v.push_back(18); //add 18 at end [6,4,81,18]
v.push_back(21); //add 21 at end [6,4,81,18,21]
v.pop_back(); //remove 21 [6,4,81,18]
Correct option is D
v = {6,4,81,18}
=====================================================================================
Ans 6
vector are passed by value in C++ unless specified by &.
Correct option is True
=====================================================================================
Question 4 1 pts Which of the following is an edge in this graph? (select all...
XCORE Question 1 Consider the following program void Elint x, int y Y = y + 1 cout<<x<<"*«y << endl; void nain) 1 int i, a13): all) = 15; a 2) - 203 a13) = 25; cout <i«"" <all) <<"" << a12) << ""« a[3] << endl; cout <i<** <all) << "" << a12) <<""« a[3] << endl; What values of the variable and array A are printed with the following rules. a parameters are passed by value bi parameters...
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)
All in C++ Create a function NumEven( std: forward_list-int> SList) that computes and returns the number of even values in a singly linked list SList of type std: forward_list-int> If there is no even value or the list is empty, return 0. Select the appropriate C++ statement for each of the below to implement the function. unsigned NumEven (std:: forward_list<int> Slist) { Select] Select ] Select ] } [ Select] for (int i; i < num; i++) { if (n...
select the correct answer What will be the output at line 13? 1 #include <iostream> 2 using namespace std; 5 int main() 6 int k-4; 8 for(int j-3; j<3+11; j++) 92 { 10 k-k+3; 11 12 13 cout<<k3 14 15 return; 16 7 Select one: A. 44 B. 23 C. 26 D. 27
For each implementation, answer the following question: Suppose I run this with a particular value of n, and it takes 10 seconds. Suppose I run it again, but I double the value of n. How long should I expect it to run? Implementation 1 void Q4(vector <int> &v, int n) { int i; v.clear(); for (i = 0; i < n; i++) v.push_back(i); for (i = 0; i < n; i++) v.push_back(i); for (i =...
6. Please provide step by step and concepts explanation. Thank you ! What is the output of the following program? #include <iostream> using namespace std; int fun (int p 2, int q = 3) return p+ qi int main (void) cout < fun (O +fun (1) + fun (1, 2) <<endl; return 0; 6 O 8 10 O 12
QUESTION 16 In R6, a unit vector in same direction as v = is equal to O TIVIL <V,V>V È proje (v)e;
For each implementation, answer the following question: Suppose I run this with a particular value of n, and it takes 10 seconds. Suppose I run it again, but I double the value of n. How long should I expect it to run? Implementation 1 void Q4(vector <int> &v, int n) { int i; v.clear(); for (i = 0; i < n; i++) v.push_back(i); for (i = 0; i < n; i++) v.push_back(i); for (i =...
Question 5 10 pts Predict the output of the following C program: #include <stdio.h> void mainot double x[4] = (3.14, 1.62, 2.72,654.1); printf("%d %c %.f", (int)(100**(x+1)), (int)x[3]/10, x[2]); 12pt Paragraph BI UAB T2 : p O words