Question: 1/ What will be displayed in the list box. for (int i = 12; i >= 0; i-=4) { outputListBox.Items.Add(i*i); } OutputListBox (write only one
1/
What will be displayed in the list box.
for (int i = 12; i >= 0; i-=4)
{
outputListBox.Items.Add(i*i);
}
OutputListBox (write only one number in each box without decimals)
2/ What values will the following code segment add to the list box?
for (int x = 0; x <2; x++)
{
outputListBox.Items.Add(x);
for (int y = 1; y >0; y--)
{
outputListBox.Items.Add(y);
}
}
OutputListBox (write only one number in each box without decimals)
3/ nt count = 2;
do
{
outputListBox.Items.Add(count);
count *= count;
}
while (count < 20);
a) What will be displayed in the list box?
OutputListBox (write only one number in each box without decimals)
a) What will be the final value of count?
4/What will be displayed in the list box when the GoButton is clicked?
private void GoButton_Click(object sender, EventArgs e)
{
int x = 7;
AddToListBox(x);
x = Sum(7, 2);
AddToListBox(x);
SetToZero(x);
AddToListBox(x);
}
// AddToListBox method
private void AddToListBox(int value)
{
outputListBox.Items.Add(value); ;
}
// Sum method
private int Sum(int num1, int num2)
{
return num1 + num2;
}
// SetToZero method
private void SetToZero(int number)
{
number = 0;
outputListBox.Items.Add(number);
}
OutputListBox
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
