C1S170 Week 3 Sample Quiz in C# – 35/35 marks

Price = $7
Please feel free to send us your queries at: [email protected]
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

1. Question : (TCO 5) When writing a program, if you know exactly how many times statements in a loop should execute, use the _____ structure.

do while

for

goto

while

2. Question : (TCO 5) When used within a loop structure, the _____ statement causes execution to jump out of the loop and proceed with subsequent statements in the program.

break

continue

goto

jump

3. Question : (TCO 5) A _____ looping structure, such as WHILE, performs its conditional expression _____ its contents execute.

posttest, after

pretest, before

posttest, while

pretest, while

4. Question : (TCO 10) During a code walk-through, someone may suggest that this code be replaced with _____, as it is more efficient.

int val = 0;
while (val < 10) { Console.WriteLine(val); val++; } for(int val = 0; val < 10; val++) { Console.WriteLine(val); } for(int val = 0; val <= 10; val++) { Console.WriteLine(val); } for(int val = 0; val < 10; val--) { Console.WriteLine(val); } int val = 0; do while (val < 10) { Console.WriteLine(val); val++; } 5. Question : (TCO 5) A block of statements within the body of a FOR loop must be surrounded with _____. curly braces {} parentheses () square brackets [] None of the above 6. Question : (TCO 5) What output will this set of statements produce? int a = 1; while (a < 1) { Console.Write("{0}\t", a); a++; } Console.Write("{0}\t", a); An infinite loop An exception 1 1 1 7. Question : (TCO 5) In this code, the variable _____ is a counter and the variable _____ is an accumulator. double total = 0, weight = 2.0, limit =10, max = 50; int track = 0; for (int num = 0; num <= limit; num++ ) { total = total + weight * num; if (total <= max) track++; } num, track total, track track, total weight, limit 8. Question : (TCO 5) In this code, the inner FOR loop _____. int i = 1, j = 1; for (i = 1; i < 4; i++) { for (j = 1; j < 4; j++) { Console.Write("{0}{1} ", i, j); } } contains a syntax error is nested executes three times executes four times 9. Question : (TCO 5) Your program keeps asking for last names from the user until he/she enters “####.” In this context, the “####” is used as a(n) _____. accumulator counter sentinel value test value 10. Question : (TCO 10) Which of the following are best programming practices? Indenting the statements in the body of each control structure Nesting multiple repetition structures Including comments to describe its functionality Always using descriptive variable, method, and program names All of the above 11. Question : (TCO 5) Using a WHILE loop, write the C# code required to print every 2nd integer from 1 to 201 (i.e., 1, 3, 5, 7, etc.). Print each number on its own line.

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.
Payment Details
Price = $7
Please feel free to send us your queries at: [email protected]
Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply