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

Price = \$7
Payment methods

Problem Statement

1. Question : (TCO 4) Which of the following is the appropriate structure to program the logic determining if a 10% discount should be given based on a minimum purchase?

Sequence

Method

Loop

Decision

2. Question : (TCO 6) When using the Visual Studio debugger, press _____ to start debugging and then _____ to step through your program statement by statement.

F5, F5

F5, F10

F10, F5

F10, F10

3. Question : (TCO 6) To cause the Visual Studio debugger to halt execution of your program at a particular statement, set a _____ at that statement.

Watch

Locals

Debug

Breakpoint

4. Question : (TCO 4) How is a decision structure represented on a flow chart?

Square

Rectangle

Circle

Diamond

5. Question : (TCO 4) A conditional expression such as that in the statement “if (x < y)” produces a _____ result. Relational Boolean Logical Mathematical 6. Question : (TCO 4) Which of the following is true about the IF decision structure? An IF does not always need to be followed by an ELSE. An IF/ELSE is also known as a “dual selection” structure. It can be nested. All of the above 7. Question : (TCO 4) The following C# code _____ run, however it contains a _____ error. (Inspect the code carefully!) int x = 2, y = 3; if (x > y);
Console.WriteLine(“x is greater than y”);

will, syntax

will, logical

will not, syntax

will not, logical

8. Question : (TCO 4) Given that a = 5, b = 6, and c = 8, which of the following is false?

a == 5

7 <= (a + 2) c <= 4 (2 + a) != b 9. Question : (TCO 4) What will be the output of this code? int x = 3, y = 5; if (x + 3 > y)
{
Console.Write(“A, “);
if (x > y)
Console.Write(“B, “);
else
Console.Write(“C, “);
}
else
Console.Write(“D, “);

D,

B, D,

A, C,

A, D,

10. Question : (TCO 6) Raising an exception is the same as _____ an exception.

catching

defining

trying a block of code that might create

throwing

11. Question : (TCO 4) Write a C# segment to set a variable to 16 and then test that variable to determine if it’s less than 15 or greater than 20. Print out the variable and the result of the test.

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].
* 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.