CIS 162 AD - C# Programming I - Section 5832
Worksheet #3
Due Thursday, February 23, 2006

Name:

I. Definitions: please explain the following terms:

  1. boolean variable

  2. Unicode character

  3. switch statement

  4. break statement

  5. conditional operator

  6. logical operator

  7. the NOT operator

  8. nested if...else statement

II. Questions or short essay

  1. What is the difference between the = operator and the = = operator?

  2. What are the three basic programming constructs?

  3. If you combine && and || operators in an expression, which has higher precedence? How can you control the precedence of operators in an expression with mixed logical operators?

  4. What is the advantage of using a switch statement rather than nested if statements?

  5. Explain the indentation style that should be used with the selection statement.

  6. What is the syntax of the if...else statement?

  7. What are the relational operators?

  8. What does it mean that && and || are short-circuiting?
III. Programming Exercise Write source code for the following:

    Write a program that allows the user to enter two integers and a character. If the character is 'A', add the two integers. If it is 'S', subtract the second integer from the first. If it is 'M', multiply the integers. Display the results of the arithmetic. Use several methods in your program to accomplish the separate tasks.