Sys Ana Des Quiz 3

Which of the following loop correctly prints the elements of the array?
char[] arr = new char [] {'k', 'i', 'C', 'i', 't'};
1. do
{ Console.WriteLine((char) i);}
while (int i=0; i < arr; i++);
2. foreach (int i in arr)
{ Console.WriteLine((char) i);}
3. for (int i = 0; i < arr; i++)
{Console.WriteLine((char) i);}
4. while (int i = 0; i < arr; i++)
{Console.WriteLine((char) i);}
5. do
{Console.WriteLine((char) i);}
until (int i = 0; i < arr; i++);
A. 1
B. 2
C. 3
D. 4
E. 5
Click the card to flip 👆
1 / 10
Terms in this set (10)
Which of the following loop correctly prints the elements of the array?
char[] arr = new char [] {'k', 'i', 'C', 'i', 't'};
1. do
{ Console.WriteLine((char) i);}
while (int i=0; i < arr; i++);
2. foreach (int i in arr)
{ Console.WriteLine((char) i);}
3. for (int i = 0; i < arr; i++)
{Console.WriteLine((char) i);}
4. while (int i = 0; i < arr; i++)
{Console.WriteLine((char) i);}
5. do
{Console.WriteLine((char) i);}
until (int i = 0; i < arr; i++);
A. 1
B. 2
C. 3
D. 4
E. 5
The following is a list of functions and attributes with their context. Which ones are functions:
a) "Deposit money into an account" in an automatically teller machine
b) "Check Pre-requisites" in college registration system
c) "A little of a book" in a college library system
d) "Compute total gross pay for part-time employees" in a payroll system
e) "the grade point average (gpa)" in a registration system
f) "Make an order" in a point of sale (POS) system.
A. a, b, d, e, f
B. a, b, d, f
C. c and e
D. all of them
E. None of them
The following code is to convert a 10-based integer 9823232 into 6-based integer using a while-loop, what is the condition that you will use in the missing place?
int x = 9823232;
string result = "";
while ( // your code here //)
{
result = x%6 + result;
x = x/6;
}
result = x + result;
A. x >= 6
B. x%6 < 6
C. x <= 6
D. x%6 <= 6
E. x > 0