1. Which of the following is a valid C# identifier?
a. 2a_big_Car
b. __STOP
c. ha*t123
d. skidoo-
e. none of the above
2. (True or False) 3000000000 is a valid C# value of the int type?
3. The symbols for comments are:
a. // for a single line and /* */ for multiple lines
b. /* */ for a single line and // for multiple lines
c. /* for a single line and /* */ for multiple lines
d. none of the above
In Questions 4-7 assume integer variables x=10, y=5, z=3, w=2.
4. The value of x + y % w is
a. 1
b. 11
c. 12
d. none of the above
5. The value of x / z * y is
a. 16 2/3
b. 0
c. 15
d. none of the above
6. The value of w *= y + z is
a. 13
b. 16
c. 18
d. none of the above
7. The value of (x++ + --y) - (++x + y--) is
a. 0
b. 1
c. -1
d. 2
e. -2
8. Which of the following is not a C# keyword?
a. class
b. public
c. main
d. int
e. none of the above
9. What is wrong with the following declaration?
int switch;
switch =5;
10. Which expression
i) 5 + (7* 3) or ii) (5 + 7) * 3
has the same value as the expression 5 + 7 * 3?
11. What will be the output when the following code fragment is run?
int x = 12, y = 14, z;
z = y / x +7;
x = z * z;
System.Console.WriteLine(x);
12. Which of the following statements, if any, have the same result for integers? x and y?
a. x += y;
b. y += x;
c. x = x + y;
13. Write a C# code to compute the value of the polynomial x4 + x2 +9x - 7.
14. Write a C# program to compute the perimeter of a square of length a.
15. Write a C# program that takes one number from the user and shows whether this number is odd or even.