wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Menus, Dialog Boxes and Methods

Total questions: 17

Worksheet time: 24mins

Name
Class
Date
1.

In C#, what is a method?

a)

A function within a class

b)

A style of acting

c)

A variable within a class

d)

The body of a function

2.

How would you call this method?

a)

Console.WriteLine("Jordan");

b)

MyName();

c)

MyName("Jordan");

d)

call(MyName)

3.
________ methods are accessible to all classes and client programs.
a)
a. private
b)
b. public
c)
c. setter
d)
d. getter
4.
Public and private are examples of _____.
a)
a. return types
b)
b. parameters
c)
c. access specifiers
d)
d. Strings
5.

How are commands usually grouped in menus?

a)

The commands used most often are the ones put into menus

b)

similar or related commands are placed together

c)

commands that can be done using more than one kind of software are put into menus

d)

menu commands are designed to match all of the toolbar icons

6.

Which menu option will open a dialog box?

a)
b)
c)
d)
7.

It is a keyword that terminates the execution of a function and returns the control to the calling function

a)

break

b)

return

c)

getch

d)

main

8.

It is a return type that means no value is returned

a)

int

b)

double

c)

void

d)

char

9.

Select the correct syntax for a function header that contains a parameter list.

a)

void showTotal (int num1, int num2, num3)

b)

void showTotal (int num1, num2, num3)

c)

void showTotal (int num1, int num2, int num3)

d)

void showTotal (num1, num2, num3)

10.

Which of the following function will return a value?

a)

int sum (int val1, int val2)

{

return val1+val2;

}

b)

void sum (int val1, int val2)

{

return sum;

}

c)

void sum (int val1, int val2)

{

return val1+val2;

}

d)

int sum (val1, val2)

{

return sum;

}

11.

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;

}

a)

number between 1 to 100

b)

valid or invalid

c)

"status"

d)

true or false

12.

What are advantages of methods

a)

reusable code

b)

easy to test

c)

easier to make modifications to your code

d)

all of the above

13.

Look at the function sqrt(4).What is the parameter of this function

a)

4

b)

sqrt

c)

none of the above

14.

In order for your function not to have a return value you must type ________ before naming the function

a)

int

b)

void

c)

bool

d)

none of the above

15.

A method is a group of statements that perform a particular task

a)

True

b)

False

c)

None of the Above

16.

You can call the same method multiple times

a)

True

b)

False

17.
________ methods are accessible to all classes and client programs.
a)
a. private
b)
b. public
c)
c. setter
d)
d. getter