Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) What is Math.ceil(3.6)? (1pts) 3.0 3 4.0 5.0 2) What is Math.floor(3.6)? (1pts) 3.0 3 4 5.0 3) Math.pow(3, 3) returns _______. (1pts) 27

1)

What is Math.ceil(3.6)?

(1pts)

3.0

3

4.0

5.0

2)

What is Math.floor(3.6)?

(1pts)

3.0

3

4

5.0

3)

Math.pow(3, 3) returns _______.

(1pts)

27

9

27.0

9.0

4)

Math.sqrt(4) returns _______.

(1pts)

2

2.0

1

1.0

5)

To obtain the sine of 35 degrees, use _______.

(1pts)

Math.sin(35)

Math.sin(Math.toRadians(35.0))

Math.sin(Math.toDegrees(35.0))

Math.sin(Math.toRadian(35))

Math.sin(Math.toDegree(35))

6)

Which of the following is the correct expression of character 4?

(1pts)

4

"4"

'\0004'

'4'

7)

A Java Unicode character is stored in __________.

(1pts)

one byte

two bytes

three bytes

four bytes

8)

Suppose x is a char variable with a value 'b'. What is the printout of the statement System.out.println(++x)?

(1pts)

a

b

c

d

9)

Which statement prints smith\exam1\test.txt?

(1pts)

System.out.println("smith\exam1\test.txt");

System.out.println("smith\\exam1\\test.txt");

System.out.println("smith\"exam1\"test.txt");

System.out.println("smith"\exam1"\test.txt");

10)

Suppose i is an int type variable. Which of the following statements display the character whose Unicode is stored in variable i?

(1pts)

System.out.println(i);

System.out.println((char)i);

System.out.println((int)i);

System.out.println(i + " ");

11)

The Unicode of 'a' is 97. What is the Unicode for 'c'?

(1pts)

96

97

98

99

12)

Will System.out.println((char)4) display 4?

(1pts)

Yes

No

13)

To check whether a char variable ch is an uppercase letter, you write ___________.

(1pts)

(ch >= 'A' && ch >= 'Z')

(ch >= 'A' && ch <= 'Z')

(ch >= 'A' || ch <= 'Z')

('A' <= ch <= 'Z')

14)

What is the return value of "SELECT".substring(0, 5)?

(1pts)

"SELECT"

"SELEC"

"SELE"

"ELECT"

15)

Which of the following is the correct statement to return JAVA?

(1pts)

toUpperCase("Java")

"Java".toUpperCase("Java")

"Java".toUpperCase()

String.toUpperCase("Java")

16)

The expression "Java " + 1 + 2 + 3 evaluates to ________.

(1pts)

Java6

Java 123

java 123

Illegal expression

17)

Note that the Unicode for character A is 65. The expression "A" + 1 evaluates to ________.

(1pts)

66

B

A1

Illegal expression

18)

Note that the Unicode for character A is 65. The expression 'A' + 1 evaluates to ________.

(1pts)

66

B

A1

Illegal expression

19)

The __________ method parses a string s to an int value.

(1pts)

integer.parseInt(s);

Integer.parseInt(s);

integer.parseInteger(s);

Integer.parseInteger(s);

20)

The __________ method converts a string s to a double value.

(1pts)

double.parseDouble(s);

Double.parsedouble(s);

double.parse(s);

Double.parseDouble(s);

21)

The statement System.out.printf("%3.1f", 1234.56) outputs ___________.

(1pts)

123.4

123.5

1234.5

1234.56

1234.6

22)

The statement System.out.printf("%3.1e", 1234.56) outputs ___________.

(1pts)

0.1e+04

0.123456e+04

0.123e+04

1.2e+03

1.23+03

23)

The statement System.out.printf("%5d", 123456) outputs ___________.

(1pts)

12345

23456

123456

12345.6

24)

The statement System.out.printf("%10s", 123456) outputs ___________. (Note: * represents a space)

(1pts)

123456****

23456*****

12345*****

****123456

25)

You can cast a character value to an int, or an int to char.

(1pts)

true

false

26)

Which of the following is the correct expression of character a?

(1pts)

'a'

"a"

'\000a'

'\a'

27)

Which of the following assignment statements is correct to assign character 5 to c?

(1pts)

char c = '5';

char c = 5;

char c = "5";

char c = "344";

28)

The expression 'e' - 'c' is ________________.

(1pts)

2

-2

a random number

invalid

29)

parseInt is a method in the _______ class.

(1pts)

Integer

Double

Math

System

30)

parseDouble is a method in the _______ class.

(1pts)

Integer

Double

Math

System

31)

"unhappy".substring(2) returns "happy".

(1pts)

true

false

32)

"smiles".substring(1, 5) returns "mile".

(1pts)

true

false

33)

You compare two strings s1 and s2 using ________.

(1pts)

(s1==s2)

s1.compare(s2)

compareTo(s1, s2)

s1.compareTo(s2)

34)

"ab".compareTo("aa") is _________.

(1pts)

greater than 0

less than 0

equal to 0

less than or equal to 0

35)

"abcdefgh".subString(1, 3) returns ________.

(1pts)

abc

bcd

bc

cde

36)

Given two Strings s1 = "Welcome to Java" and s2 = "Programming is fun", which of the following is true?

(1pts)

s1.equals(s2)

s2.equals(s1)

s1.contains(s2)

s2.contains(s1)

!s1.contains(s2)

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

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions