CS161 Exam – 14 questions – instant Delivery – Perfect Solution

Lab Price = $10
Please feel free to send us your queries at: [email protected]
P.S: This is just a study guide. The questions may not appear exactly like this.
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

1. The output of the following code will be 3.

int num1 = 1;

int* num2 = &num1; int& num3 = *num2; num1 = 3;
std::cout << num3 << std::endl; • True • False 2. If we have a program with a variable bob of type pointer-to-Employee, what is the following line equivalent to? fn = bob->firstName;

• fn = *(bob).firstName;

• fn = *(bob.firstName);

• fn = (*bob).firstName;

• fn = (*bob.firstName);

3. The following code will print the number 7.
int num = 4; int* val = # num = 7;
std::cout << val << std::endl;  True  False 4. The name of an array acts as a pointer to the first element in the array. • True • False 5. A pointer is a variable that can store a memory address as its value. • True • False 6. What would the result of the following code be? int nums[4] = {1,2,3,4}; nums[2] = 7; std::cout<< *nums << std::endl; • It will print 1. • It will print a syntax error message. • It will print garbage, because we are accessing memory we didn't allocate. • It will print [1, 2, 7, 4]. Question 7 7. Pass by reference makes a copy of the value that is being passed and stores it in the corresponding parameter of the function. • True • False 8. You indicate that a function does not return a value by… o putting a “&” in front of the function name. o giving it a return type of “void”. o leaving out the return type. o giving a reference type as tthe return type. 9. Each class may have any number of constructors, but at most one destructor. • True • False 10. A class can contain variables of other class types. True False 11. In C++ a single array may store different data types. o True o False 12. What is the output of the following code? int nums[] = {1,2,3,4}; nums[2] = 7; for (int i=0; i<4; i++) std::cout << nums[i] << " "; std::cout << std::endl; • 1 7 3 4 • 1 2 7 4 • 1 7 2 4 • 1 3 7 4 13. What string will the following code output? string str = “infinite indigo origami”; string output = “”; int counter = 1; while (str.at(counter) != ‘i’) { output += str.at(counter); counter += 3; } std::cout << output << std::endl; OUTPUT: nnengog 14. Assume there is a class called Cat, which has a string field called name, and a get method called getName. If you have an array of pointers to Cat objects, how would you get the name of the third Cat? • catArray[2].getName() • *catArray[2].getName() • catArray[2]->getName()

• catArray[getName(2)]

Relevant Material
Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on [email protected]
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Lab Price = $10
Please feel free to send us your queries at: [email protected]

Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply