BCIS 3630 EXAM QUESTIONS AND ANSWERS
Methods are commonly used to
a. speed up the compilation of a program
b. break a problem down into small manageable pieces
c. emphasize certain parts of the logic
d. document the program - Answers :b
!Which of the following would be a valid method call for the following method?
public static void showProduct
(int num1, double num2)
{int product;product = num1 * num2;System.out.println
("The product is " +product);}
a. showProduct("5", "40");
b. showProduct(10.0, 4.6);
c. showProduct(10, 4.5);
d. showProduct(3.3, 55); - Answers :c
!A value-returning method must specify ____ as its return type in the method header.
Select one:
a. an int
b. a double
c. a boolean
d. any valid data type - Answers :d
!Values that are sent into a method are called ____________.
Select one:
a. variables
b. arguments
c. literals
d. types - Answers :b
!Methods are commonly used to break a problem into small manageable pieces.
T/F - Answers :T
!Two general categories of methods are void methods and value returning methods.
T/F - Answers :T
!In the method header, the method modifier public means that the method belongs to
the class, not a specific object.
T/F - Answers :F
!You must have a return statement in a value-returning method.
, T/F - Answers :T
!Any method that calls a method with a throws clause in its header must either handle
the potential exception or have the same throws clause.
T/F - Answers :T
!The do-while loop must be terminated with a semicolon.
T/F - Answers :T
!The do-while loop is ideal in situations where you always want the loop to iterate at
least once.
T/F - Answers :T
!The ________ loop is ideal in situations where the exact number of iterations is known.
a while
b for
c if
d do while - Answers :b
!What will be the value of x after the following code is executed?int x = 10;while (x <
100){x += 100;}
10
100
110
90 - Answers :c
!How many times will the following do-while loop be executed?
int x = 11;do{x += 20;}while (x > 100);
a5
b0
c4
d 1 - Answers :d
How many times will the following for loop be executed?
for(int count = 10; count <= 21; count++)
System.out.println("java is great!")
a0
b 11
c 10
d 12 - Answers :d
Methods are commonly used to
a. speed up the compilation of a program
b. break a problem down into small manageable pieces
c. emphasize certain parts of the logic
d. document the program - Answers :b
!Which of the following would be a valid method call for the following method?
public static void showProduct
(int num1, double num2)
{int product;product = num1 * num2;System.out.println
("The product is " +product);}
a. showProduct("5", "40");
b. showProduct(10.0, 4.6);
c. showProduct(10, 4.5);
d. showProduct(3.3, 55); - Answers :c
!A value-returning method must specify ____ as its return type in the method header.
Select one:
a. an int
b. a double
c. a boolean
d. any valid data type - Answers :d
!Values that are sent into a method are called ____________.
Select one:
a. variables
b. arguments
c. literals
d. types - Answers :b
!Methods are commonly used to break a problem into small manageable pieces.
T/F - Answers :T
!Two general categories of methods are void methods and value returning methods.
T/F - Answers :T
!In the method header, the method modifier public means that the method belongs to
the class, not a specific object.
T/F - Answers :F
!You must have a return statement in a value-returning method.
, T/F - Answers :T
!Any method that calls a method with a throws clause in its header must either handle
the potential exception or have the same throws clause.
T/F - Answers :T
!The do-while loop must be terminated with a semicolon.
T/F - Answers :T
!The do-while loop is ideal in situations where you always want the loop to iterate at
least once.
T/F - Answers :T
!The ________ loop is ideal in situations where the exact number of iterations is known.
a while
b for
c if
d do while - Answers :b
!What will be the value of x after the following code is executed?int x = 10;while (x <
100){x += 100;}
10
100
110
90 - Answers :c
!How many times will the following do-while loop be executed?
int x = 11;do{x += 20;}while (x > 100);
a5
b0
c4
d 1 - Answers :d
How many times will the following for loop be executed?
for(int count = 10; count <= 21; count++)
System.out.println("java is great!")
a0
b 11
c 10
d 12 - Answers :d