- Home
- Programming
- C Sharp Programming
6.
If you want to iterate over the values in an array of integers called arrNumbers to perform an
action on them, which loop statement enables you to do this?
- A.foreach (int number in arrNumbers)
{
} - B.for each (int number in arrNumbers)
{
} - C.for (int i; each i in arrNumbers; i++)
{
} - D.foreach (number in arrNumbers) {
}
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
7.
What is the purpose of break; in a switch statement?
- A.It causes the program to exit.
- B.It causes the code to exit the switch statement.
- C.It causes the program to pause.
- D.It causes the code to stop executing until the user presses a key on the keyboard.
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
8.
What are the four basic repetition structures in C#?
- A.for, foreach, loop, while
- B.loop, while, do-for, for-each
- C.for, foreach, while, do-while
- D.do-each, while, for, do
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
9.
How many times will this loop execute?
int value = 0;
do
{
Console.WriteLine (value);
} while value > 10;
int value = 0;
do
{
Console.WriteLine (value);
} while value > 10;
- A.10 times
- B.1 time
- C.0 times
- D.9 times
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
10.
What is the maximum value you can store in an int data type?
- A.Positive infinity
- B.32,167
- C.65,536
- D.4,294,967,296
- Answer & Explanation
- Report
Answer : [D]
Explanation :
Explanation :