ISM 220 Exam 3
int [ ] anArray = new int [10]; int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1}; for (int i = 0; i < anotherArray.Length; i++) total += i; Using the above declaration along with the for loop, what is stored in total after the program statements are executed?
45
int [ ] score = {86, 66, 76, 92, 95, 88}; for (int i = score.Length-1; i > -1; i--) { total += score[i]; } Using the declaration above for score, what is added to total during the first iteration?
88
What is a method parameter?
A parameter is what goes in the parathesis after the method and it guides the method.
What is a method return value?
A return value is the result of the calculation.
ComboBox objects have an added feature over the ListBox controls in that ____.
ComboBox objects contain their own text box field
A variable with block scope is accessible throughout the class.
False
Constructor method headings require a return type.
False
If the method return type is void, the method will have no parameters.
False
If there are no parameters listed in parenthesis, the method will not return any values.
False
Instance methods must have the static keyword in their heading.
False
The entries found inside the parentheses of the method heading are called the access modifiers.
False
To add functionality to the ListBox control object, you register the DoubleClick( ) event handler method.
False
We specify data types of parameters in the method call.
False
When run, the following code will display the numbers 1 to 10 on the console: using System; namespace Methods { public class Program { static void Main(string[] args) { } static void CountToTen() { for (int index = 1; index <= 10; index++) Console.WriteLine(index); } } }
False
When you create a new Windows application using Visual Studio, if you do not see the constructed form, but instead see the program statements, you have selected the wrong template and need to begin again.
False
When you define a class method, you define its characteristics or fields in terms of the data.
False
The ____ property is used to determine whether a control is the one currently selected.
Focused
Variables added to a user-defined class are called __________ variables.
Instance
In the context of C# programming, what is a method?
It is a code block of statements telling it to preform a task and/or do calculation.
What is meant by a method call?
It is when you are asking to return a method within another method.
Which of the following is a user-defined method?
Main( )
Multi-dimensional arrays are called ________ in mathematics.
Matrices
_________ is calling a method from within itself.
Recursion
Double-clicking on the ListBox control registers which default event?
SelectedIndexChanged
To retrieve multiple selections from a ListBox control, you can use all of the following properties EXCEPT ____.
Text
A KeyPress( ) event is fired with each and every keystroke.
True
Additional controls can be bought from other vendors and added to the Toolbox.
True
In order to change the background color for the application, you could set the BackColor property of the form.
True
Object-oriented programming is a way of programming where you create chunks of code that are modeled after real world objects.
True
The GUI should be different if the application is going to be displayed on a WAP (Wireless AccessProtocol)-enabled device such as a tablet or a smart phone.
True
The keyword new is used as an operator to call constructor methods.
True
The type used in the foreach expression must match the array type.
True
User-defined classes are types, just like string, int, and bool.
True
We specify data types of parameters in the method heading.
True
You can declare an array without dimensioning its size, but the size must be determined before you can access it.
True
double [ ] price = new double [ ] {3, 2.2, 4.7, 6.1, 4}; Looking above, the value of price.Length is 5.
True
double [ ] price = new double [ ] {3, 2.2, 4.7, 6.1, 4}; With the declaration above, price[5] generates a runtime error.
True
How do we call a method?
You call a method by typing its name followed by parathesis within another method.
C# is an object-oriented language. All the code for an application must be placed in a(n) ____.
class
int [ ] anArray = new int [10]; int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1};
foreach(int val in anotherArray) total += val;
The first line of a method is called the ____ of the method.
heading
The return type is physically placed ____.
immediately preceding the name of the method
The static keyword must not be used with ____.
instance methods
To declare and instantiate memory for 4 exam scores that range in value from 0 to 100, the following declaration could be made ____.
int [ ] examScore = new examScore[4];
If you do not know how many entries will be stored with the array, you could dimension it ____.
large enough to hold the maximum number of entries
public static void Main( ) The return type for the method above is ____.
void