EGR 1400 Exam Questions With Complete
Solutions
In C#, you can simulate rolling two dice by selecting a random number between 1 and 6 to
represent each die roll and then adding them together to get the dice total. Let,s say that we
developed a program to do this and we rolled the pair of dice 50 times and recorded the
results of each roll on a sheet of paper. Can we just select one random number between 2
and 12 and achieve the same experimental results for the 50 rolls as rolling two die and
adding them?
a. No, It's not possible to get the same experimental results with one random number
b. Yes, using the same scaling as before
c. Yes, if the Visual C# code is written to scale the single random number between 2 and 12
d. Yes, if the random number is selected using myRand.Next(2,13);
No, It's not possible to get the same experimental results with one random number
What property of a Label control would you need to set to change the words displayed in
the Label on the form?
a. the Text property
b. the Name property
c. the Captain property
d. the Word property
e. None of these
, a. the Text property
Which of the following is the best name for a text box that will hold a person's age within a
Visual Studio .NET project, keeping in mind the recommended naming conventions?
a. Form1
b. txtAge
c. txtText1
d. Age
e. None of the above
b. txtAge
When the user clicks a button, ______ is raised.
a. an event
b. a setting
c. a method
d. a property
a. an event
Which if the following statements will set RandNum to a value between 1 and 3, inclusive?
a. RandNum = myRand.Next(1,3);
b. RandNum = myRand.Next(0,3);
c. RandNum = myRand.Next(1,4);
Solutions
In C#, you can simulate rolling two dice by selecting a random number between 1 and 6 to
represent each die roll and then adding them together to get the dice total. Let,s say that we
developed a program to do this and we rolled the pair of dice 50 times and recorded the
results of each roll on a sheet of paper. Can we just select one random number between 2
and 12 and achieve the same experimental results for the 50 rolls as rolling two die and
adding them?
a. No, It's not possible to get the same experimental results with one random number
b. Yes, using the same scaling as before
c. Yes, if the Visual C# code is written to scale the single random number between 2 and 12
d. Yes, if the random number is selected using myRand.Next(2,13);
No, It's not possible to get the same experimental results with one random number
What property of a Label control would you need to set to change the words displayed in
the Label on the form?
a. the Text property
b. the Name property
c. the Captain property
d. the Word property
e. None of these
, a. the Text property
Which of the following is the best name for a text box that will hold a person's age within a
Visual Studio .NET project, keeping in mind the recommended naming conventions?
a. Form1
b. txtAge
c. txtText1
d. Age
e. None of the above
b. txtAge
When the user clicks a button, ______ is raised.
a. an event
b. a setting
c. a method
d. a property
a. an event
Which if the following statements will set RandNum to a value between 1 and 3, inclusive?
a. RandNum = myRand.Next(1,3);
b. RandNum = myRand.Next(0,3);
c. RandNum = myRand.Next(1,4);