Assume that x,y, and temp are integer variables and x=5 and y=eight. Which of the following
traces of code swaps the values of x and y?
A. X = y;
y = x;
b. Temp = x;
x = y;
y = temp;
c. X = temp;
x = y;
y = temp;
d. X = y;
temp = x;
y = temp; - ANS-b. Temp = x;
x = y;
y = temp;
Consider the following sets of code
(p) if ((a == 1) && (b == 1))
txtBox.Text = "Hi";
(q) if (a == 1)
txtBox.Text = "Hi";
Which one of the following statements is proper?
A. (p) and (q) will produce one-of-a-kind outputs
b. (q) is not a legitimate set of Visual C# commands
c. The sets of code are equal, however (p) is preferred to (q) due to the fact (p) us clearer
d. The circumstance declaration in (p) isn't always valid - ANS-c. The sets of code are equal,
but (p) is desired to (q) because (p) us clearer
, How frequently does the MEssage Box get achieved in a loop that begins with the subsequent
assertion? Assume i is said through int i;
for (i = 1; i <= 1; i++)
x = x + 2;
//this is the sum, rely here
a. Zero
b. 2
c. Three
d. 1
e. None of those - ANS-d. 1
How normally will the subsequent sum execute? (x begins at zero with int x = 0;)
whilst (x < eight)
x = x + 2;
//This is the sum, count number here
a. Zero
b. Four
c. Five
d. 6
e. None of those - ANS-b. Four
Start w/ zero
2
4
6
8
In C#, you could simulate rolling cube by way of choosing a random quantity between 1 and 6
to symbolize each die roll and then including them collectively to get the dice total. Let,s say that
we evolved a application to do that and we rolled the pair of dice 50 instances and recorded the
outcomes of each roll on a sheet of paper. Can we just pick one random variety among 2 and 12
and obtain the equal experimental consequences for the 50 rolls as rolling die and including
them?
A. No, It's not possible to get the identical experimental outcomes with one random quantity
b. Yes, using the same scaling as before
c. Yes, if the Visual C# code is written to scale the unmarried random quantity between 2 and 12