Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Question 1 What will be the value of counter after the following code is executed? int counter = 0; int num; do { num =

**Question 1

What will be the value of counter after the following code is executed?

int counter = 0;

int num;

do

{

num = keyboard.nextInt();

if (num > 4)

counter ++;

} while (num != 0);

Assuming the input is: 4 10 -3 2 -11 9 0 6

Counter would be the value of:

Group of answer choices

3

7

4

2

Flag this Question

**Question 2

The "--counter" is a prefix mode operator

Group of answer choices

True

False

Flag this Question

**Question 3

int x = 2;

int num = 3 - ++x;

The value of num would be:

Group of answer choices

5

1

0

3

Flag this Question

**Question 4

The part of the for loop that always executes just at the beginning of the loop:

Group of answer choices

no answer is correct

test

initialize

increment/decrement

Flag this Question

**Question 5

A while loop is best for reading values from a file

Group of answer choices

True

False

Flag this Question

**Question 6

int x = 2;

while (x > 0 && x < 4)

{ System.out.println(x++);

}

The number of times the loop executes is:

Group of answer choices

2

1

0

No answer is correct

Flag this Question

**Question 7

Need to have "throws IOException" on main to do file I/O

Group of answer choices

True

False

Flag this Question

**Question 8

Assuming randomNums is a Random object, the:

System.out.println(randomNums.nextInt(13));

Would print a random number from 1 to 13

Group of answer choices

True

False

Flag this Question

**Question 9

A while loop is a posttest loop

Group of answer choices

True

False

Flag this Question

**Question 10

The value returning methods generally are the ones that print

Group of answer choices

True

False

Flag this Question

**Question 11

The method that returns an int is:

Group of answer choices

Math.pow()

keyboard.nextInt()

No answer is correct

main()

Flag this Question

**Question 12

Enumerated types can make a program more readable

Group of answer choices

True

False

Flag this Question

**Question 13

The advantage to creating methods would be:

Group of answer choices

Makes a program simpler

Makes a program more organized and readable

All answers are correct

Can reuse the method again and again

Flag this Question

**Question 14

A void method can call a value returning method

Group of answer choices

True

False

Flag this Question

**Question 15

public static void xyz(int x)

{ System.out.println(x*x);

}

The above method is an example of:

Group of answer choices

No answer is correct

class

value returning method

void method

Flag this Question

**Question 16

A method must have at least one parameter

Group of answer choices

True

False

Flag this Question

**Question 17

Given the method header of:

public static int nearPrime(int num)

The "int num" part is an example of

Group of answer choices

Method name

Method parameter list

Method modifiers

Method return type

Flag this Question

**Question 18

Class methods are generally not automatically called

Group of answer choices

True

False

Flag this Question

**Question 19

public void anExample(int number)

{ int y = Z;

int answer = number y * 12;

}

The ___ is set to the value of an equation

Group of answer choices

answer

number

y

Z

Flag this Question

**Question 20

Arguments that are objects (like String or array) are passed by value

Group of answer choices

True

False

Flag this Question

**Question 21

The programming method that does not protect data is:

Group of answer choices

Sequential statements

Procedural programming

Object oriented programming

No answer is correct

Flag this Question

**Question 22

To compare a string str to quit you do: str.equals(quit)

Group of answer choices

True

False

Flag this Question

**Question 23

Object oriented programming is good with software reuse

Group of answer choices

True

False

Flag this Question

**Question 24

If you don't define a constructor, your object-oriented program will create a default constructor

Group of answer choices

True

False

Flag this Question

**Question 25

You can overload a method as long as the return type is different

Group of answer choices

True

False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions