EGR 1400 PAPER ACTUAL QUESTIONS AND
ANSWERS SURE A+
✔✔int.TryParse(txtVal.Text, out myInt); - ✔✔Which of the following statements will
convert a string in txtVal.Text to an integer variable myInt if the value in the textbox is a
number otherwise it will convert any non-numeric value to a 0?
✔✔form - ✔✔In Lab 4, in order to keep score throughout the game, the variable for
keeping score was a ____ level variable
✔✔c - ✔✔On Lab 3, the ideal weight estimator, it is necessary to change what is
measured when the user selects whether they are Male or Female. This can be
accomplished by:
a.
changing the labels next to the text boxes where the user enters the measurements
using an IF-statement and necessary code in the Group Boxes OptionChanged event.
b.
changing the labels next to the text boxes where the user enters the measurements
using an IF-statement and necessary code on the Changed event of the text box for
each of the measurements.
c.
changing the labels next to the text boxes where the user enters the measurements
using an IF-statement and necessary code in the rdoMale and rdoFemale radio buttons
Click event.
d.
adding an IF-statement and necessary code to the code in the 'Calculate' button that
changes the text in the labels next to the text boxes where the user enters the
measurement.
✔✔The two sets of code are equivalent, but (p) is preferred to (q) because (p) is clearer.
- ✔✔Consider the following two sets of code, p and q.
<p>
, if ((a == 1) && (b == 1))
{
txtBox.Text = "Hi";
}
<q>
if (a == 1)
{
if (b == 1)
{txtBox.Text = "Hi";}
}
Which one of the following statements is true?
a.
(q) is not a valid set of Visual C# instructions.
b.
(p) and (q) will produce different outputs.
c.
The condition statement in (p) is not valid.
d.
The two sets of code are equivalent, but (p) is preferred to (q) because (p) is clearer.
✔✔false - ✔✔int cnt = 4;
if ( int.parse(txtVal1.Text) <= int.parse(txtVal2.Text) )
{
cnt = cnt + int.parse(txtVal2.Text);
Breakpoint 1
}
true or false the program will stop at breakpoint 1 with the txtVal1 = 10 and txtVal2 = 2?
✔✔8 - ✔✔int cnt = 4;
if ( int.parse(txtVal1.Text) <= int.parse(txtVal2.Text) )
{
cnt = cnt + int.parse(txtVal2.Text);
if (cnt > 8)
{
cnt = cnt - 1;
}
else
{
cnt = cnt + 1; (breakpoint 2)
}
}
Given txtVal1.Text = 2 and txtVal2.Text = 4. If the user presses the GO button, what will
Cnt be when C# .NET stops at breakpoint #2?
ANSWERS SURE A+
✔✔int.TryParse(txtVal.Text, out myInt); - ✔✔Which of the following statements will
convert a string in txtVal.Text to an integer variable myInt if the value in the textbox is a
number otherwise it will convert any non-numeric value to a 0?
✔✔form - ✔✔In Lab 4, in order to keep score throughout the game, the variable for
keeping score was a ____ level variable
✔✔c - ✔✔On Lab 3, the ideal weight estimator, it is necessary to change what is
measured when the user selects whether they are Male or Female. This can be
accomplished by:
a.
changing the labels next to the text boxes where the user enters the measurements
using an IF-statement and necessary code in the Group Boxes OptionChanged event.
b.
changing the labels next to the text boxes where the user enters the measurements
using an IF-statement and necessary code on the Changed event of the text box for
each of the measurements.
c.
changing the labels next to the text boxes where the user enters the measurements
using an IF-statement and necessary code in the rdoMale and rdoFemale radio buttons
Click event.
d.
adding an IF-statement and necessary code to the code in the 'Calculate' button that
changes the text in the labels next to the text boxes where the user enters the
measurement.
✔✔The two sets of code are equivalent, but (p) is preferred to (q) because (p) is clearer.
- ✔✔Consider the following two sets of code, p and q.
<p>
, if ((a == 1) && (b == 1))
{
txtBox.Text = "Hi";
}
<q>
if (a == 1)
{
if (b == 1)
{txtBox.Text = "Hi";}
}
Which one of the following statements is true?
a.
(q) is not a valid set of Visual C# instructions.
b.
(p) and (q) will produce different outputs.
c.
The condition statement in (p) is not valid.
d.
The two sets of code are equivalent, but (p) is preferred to (q) because (p) is clearer.
✔✔false - ✔✔int cnt = 4;
if ( int.parse(txtVal1.Text) <= int.parse(txtVal2.Text) )
{
cnt = cnt + int.parse(txtVal2.Text);
Breakpoint 1
}
true or false the program will stop at breakpoint 1 with the txtVal1 = 10 and txtVal2 = 2?
✔✔8 - ✔✔int cnt = 4;
if ( int.parse(txtVal1.Text) <= int.parse(txtVal2.Text) )
{
cnt = cnt + int.parse(txtVal2.Text);
if (cnt > 8)
{
cnt = cnt - 1;
}
else
{
cnt = cnt + 1; (breakpoint 2)
}
}
Given txtVal1.Text = 2 and txtVal2.Text = 4. If the user presses the GO button, what will
Cnt be when C# .NET stops at breakpoint #2?