Java Chapter 4

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Math.sqrt(4) evaluates to ______.

2.0

Math.floor(5.5) evaluates to ________.

5.0

Math.ceil(5.5) evaluates to ________.

6.0

"smiles".substring(1, 5) returns "mile" A. True B. False

A

"unhappy".substring(2) returns "happy". A. True B. False

A

What is Math.floor(3.6)? A. 3.0 B. 3 C. 4 D. 4.0

A

What is Math.rint(3.3)? A. 3.0 B. 3 C. 4.0 D. 4

A

What statement prints smith\exam1\test.txt? A. System.out.println("smith\\exam1\\test.txt"); B. System.out.println("smith"\exam1"\test.txt"); C. System.out.println("smith\exam1\test.txt"); D. System.out.println("smith\"exam1\"test.txt");

A

s1 and s2 are strings. What is the result? s1.equals(s2) == s2.equals(s1) A. True B. False

A

What is the return value of "SELECT".substring(4, 4)? A. Empty String B. T C. C D. E

A if beginningIndex == endIndex, return empty string

Which of the following statements are correct to concatenate string s1 into s2 A. s2 += s1; B. s2.concate(s1); C. s1.concate(s2); D. s1 += s2;

A B D

__________ returns true A. "peter".equalsIgnoreCase("Peter") B. "peter".compareToIgnoreCase("Peter") C. "peter".compareToIgnoreCase("peter") D. "peter".equals("peter") C. "peter".equalsIgnoreCase("Peter")

A D E

To check whether a char variable ch is an uppercase letter, you write__ A. ('A' <= ch <= 'Z') B. (ch >= 'A' && ch <= 'Z') C. (ch >= 'A' && ch >= 'Z') D. (ch >= 'A' || ch >= 'Z')

B

What is Math.round(3.3)? A. 3.0 B. 3 C. 4 D. 4.0

B

What is Math.ceil(3.6)? A. 3.0 B. 3 C. 4.0 D. 4

C

What is Math.rint(3.6)? A. 3.0 B. 3 C. 4.0 D. 5.0

C

What is Math.round(3.6)? A. 3.0 B. 3 C. 4 D. 4.0

C

What is System.out.print('z' - 'a'); A. a B. z C. 25 D. 26

C

x = 'b'; System.out.print(++x); A. b B. a C. c D. d

C

A Java character is stored in A. four bytes B. three bytes C. one byte D. two bytes

D

The Unicode of 'a' is 97. What is the Unicode for 'c'? A. 97 B. 98 C. 96 D. 99

D

What is "Welcome" + 1 + 1 * 2? A. Welcome3 B. Welcome4 C. Welcome11*2 D. Welcome12

D

What is Math.rint(3.5)? A. 3.0 B. 3 C. 4 D. 4.0 E. 5.0

D

What is the return value of "SELECT".substring(0, 5)? A. "ELECT" B. "SELE" C. "SELECT" D. "SELEC"

D

Will System.out.println((char)4) display 4? A. Yes B. No

no


Kaugnay na mga set ng pag-aaral

Business Analytics Test 1 - Chp 3

View Set

American Government Ch. 1-5 and 13 (Inquizitive)

View Set

Chapter 13 Leverage and capital structure

View Set

CHEM 1035 Final Exam Study Guide - Virginia Tech

View Set

Strategic Compensation Exam 2 Study Guide (Chapter 4)

View Set