NEW
Font size
WorksheetsMenus, Dialog Boxes and Methods
Total questions: 17
Worksheet time: 24mins
In C#, what is a method?
A function within a class
A style of acting
A variable within a class
The body of a function
How would you call this method?
Console.WriteLine("Jordan");
MyName();
MyName("Jordan");
call(MyName)
How are commands usually grouped in menus?
The commands used most often are the ones put into menus
similar or related commands are placed together
commands that can be done using more than one kind of software are put into menus
menu commands are designed to match all of the toolbar icons
Which menu option will open a dialog box?
It is a keyword that terminates the execution of a function and returns the control to the calling function
break
return
getch
main
It is a return type that means no value is returned
int
double
void
char
Select the correct syntax for a function header that contains a parameter list.
void showTotal (int num1, int num2, num3)
void showTotal (int num1, num2, num3)
void showTotal (int num1, int num2, int num3)
void showTotal (num1, num2, num3)
Which of the following function will return a value?
int sum (int val1, int val2)
{
return val1+val2;
}
void sum (int val1, int val2)
{
return sum;
}
void sum (int val1, int val2)
{
return val1+val2;
}
int sum (val1, val2)
{
return sum;
}
What value is returned in the following code snippet?
bool isValid(int number)
{
bool status;
if (number >= 1 && number <= 100)
status = true;
else
status = false;
return status;
}
number between 1 to 100
valid or invalid
"status"
true or false
What are advantages of methods
reusable code
easy to test
easier to make modifications to your code
all of the above
Look at the function sqrt(4).What is the parameter of this function
4
sqrt
none of the above
In order for your function not to have a return value you must type ________ before naming the function
int
void
bool
none of the above
A method is a group of statements that perform a particular task
True
False
None of the Above
You can call the same method multiple times
True
False
