Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q10: Which of the following is not an error (either a syntax error or a logic error)? Neglecting to include an action in the body

Q10: Which of the following is not an error (either a syntax error or a logic error)?

  1. Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false.
  2. Spelling a key word (such as while or if) with a capitalized first letter.
  3. Using a condition for a while statement that is initially false.
  4. An infinite loop.

Q11: How many times is the body of the loop below executed?

int counter;

counter = 1;

while ( counter < 20 )

{

// body of loop

counter = counter + 2;

} // end while

  1. 19
  1. 20
  1. 10
  1. 11

Q12: Which statement is true?

  1. Dividing two integers results in integer division.
  2. With integer division, any fractional part of the calculation is lost.
  3. With integer division, any fractional part of the calculation is truncated.
  4. All of the above.

Q13: In an expression containing values of the types int and double, the ________ values are ________ to ________ values for use in the expression.

  1. int, promoted, double.
  2. int, demoted, double.
  3. double, promoted, int.
  4. double, demoted, int.

Q14: Local variables must be ________.

  1. initialized when they are declared.
  2. initialized before their values are used in an expression.
  3. declared and initialized in two steps.
  4. declared at the top of the metho

Q15: Which statement is true?

  1. A while statement cannot be nested inside another while statement.
  2. An if statement cannot be nested inside another if statement.
  3. A while statement cannot be nested inside an if statement.
  4. None of the above is true.

Q16: Which of the following code segments does not increment val by 3:

  1. val += 3:
  2. val = val+1; val = val+1; val = val+1;
  3. c = 3; val = val + (c == 3 ? 2 : 3);

d. All of the above increment val by 3.

Q17: What does the expression x %= 10 do?

  1. Adds 10 to the value of x, and stores the result in x.
  2. Divides x by 10 and stores the remainder in x.
  3. Divides x by 10 and stores the integer result in x.
  4. None of the above.

Q18: What is the result value of c at the end of the following code segment?

int c = 8;

c++;

++c;

c %= 5;

  1. 0
  1. 1
  1. 3
  1. None of the

Q19: Which of the following is not a primitive type?

a. char b. float

c. String d. int

Q20: Which primitive type can hold the largest value?

a. int b. long

c. float d. double

Q21: What is the size in bits of an int?

  1. 8
  1. 16
  1. 32
  1. 64

Q22: In Java graphics, coordinate units are measured in ________.

  1. dots.
  1. pixels.
  1. points.
  1. inches.

Q23: Keyword ________ indicates the inheritance relationship.

  1. extends
  2. super
  1. inherits
  2. sub

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_2

Step: 3

blur-text-image_3

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

T Sql Window Functions For Data Analysis And Beyond

Authors: Itzik Ben Gan

2nd Edition

0135861446, 978-0135861448

More Books

Students also viewed these Databases questions