Which of the following assignment statements is correct

Assignment Help Computer Engineering
Reference no: EM132218379

1) What is Math.ceil(3.6)?

3.0
3
4.0
5.0

2) What is Math.floor(3.6)?

3.0
3
4
5.0

3) Math.pow(3, 3) returns _______.

27
9
27.0
9.0

4) Math.sqrt(4) returns _______.

2
2.0
1
1.0

5) To obtain the sine of 35 degrees, use _______.

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?

4
"4"
'\0004'
'4'

7) A Java Unicode character is stored in __________.

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)?

a
b
c
d

9) Which statement prints 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");
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?

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'?

96
97
98
99

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

Yes
No

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

(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)?

"SELECT"
"SELEC"
"SELE"
"ELECT"

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

toUpperCase("Java")
"Java".toUpperCase("Java")
"Java".toUpperCase()
String.toUpperCase("Java")

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

Java6
Java 123
java 123
Illegal expression

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

66
B
A1
Illegal expression

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

66
B
A1
Illegal expression

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

integer.parseInt(s);
Integer.parseInt(s);
integer.parseInteger(s);
Integer.parseInteger(s);

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

double.parseDouble(s);
Double.parsedouble(s);
double.parse(s);
Double.parseDouble(s);

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

123.4
123.5
1234.5
1234.56
1234.6

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

0.1e+04
0.123456e+04
0.123e+04
1.2e+03
1.23+03

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

12345
23456
123456
12345.6

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

123456****
23456*****
12345*****
****123456

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

true
false

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

'a'
"a"
'\000a'
'\a'

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

char c = '5';
char c = 5;
char c = "5";
char c = "344";

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

2
-2
a random number
invalid

29) parseInt is a method in the _______ class.

Integer
Double
Math
System

30) parseDouble is a method in the _______ class.

Integer
Double
Math
System

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

true
false

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

true
false

33) You compare two strings s1 and s2 using ________.

(s1==s2)
s1.compare(s2)
compareTo(s1, s2)
s1.compareTo(s2)

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

greater than 0
less than 0
equal to 0
less than or equal to 0

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

abc
bcd
bc
cde

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

s1.equals(s2)
s2.equals(s1)
s1.contains(s2)
s2.contains(s1)
!s1.contains(s2)

Reference no: EM132218379

Questions Cloud

Compute the average of the variables : Write an expression that computes the average of the variables exam1 and exam2 (both declared and assigned values).
Find the accumulated amount of the annuity : Find the accumulated amount of the annuity. (Round your answer to the nearest cent.)
Login to the system as root : Login to the system as root. Add multiple users named: user1, user2, user3, and user4.
What are the firm total liabilities : The firm also has total assets with a book value of $12 million. There is no preferred stock. What are the firm's total liabilities?
Which of the following assignment statements is correct : Which of the following assignment statements is correct to assign character 5 to c? Which of the following is the correct expression of character a?
Equity on the firm balance sheet : Common equity on the firm's balance sheet is 50% of its total assets. What is its net income?
Explain the specific relationship between risk : Explain the specific relationship between risk and reward and why this relationship must be true.
World of perfect financial markets : In a world of perfect financial markets (but not necessarily product markets), is the cost of capital of the firm independent of how it is operated and financed
Firm financial claims independent : In a world of perfect financial markets, is the cost of capital of the firm's financial claims independent of how it is financed?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Design a gui program that calculates a car gas millage

Design a GUI program that calculates a car's gas millage. The program's window should have text boxes that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank.

  Define the multiple-output qm procedure

Use the multiple-output QM procedure to simplify the functions in problem. Compare the complexity of this implementation to the one in problem.

  Explain the end-to-end process of how voip works

In order to complete assignment you will need to answer the below questions. Please complete the questions in a Word document and then upload the assignment.

  What is the maximum possible number of edges

For any directed graph with 10 vertices, what is the maximum possible number of edges in the shortest path between any two vertices?

  Why vista a better choice for home or office computing

Investigate net for information about some of the new features offered by Vista over previous operating systems or operating systems on other computing environments.

  Construct an alternative e-r tables

Construct an alternative E-R tables that uses only a binary relationship between students and course_offerings

  Describe a function that would accept seven values

Describe a function that would accept 7 values from the function call and determine the minimum and maximum of those 7 values.

  Write a program that plays a game called catch-the-creature

Write a program that plays a game called Catch-the-Creature. Use an image to represent the creature. Have the creature appear at a random location for a random.

  Define the expected benefits of the new system and for

-make a ppt presentation for this each section for about 3-4 slide with a notes carda. select networking hardware and

  Defines three phases and give a thorough example of each

What are four important tactical tasks for a negotiator in a distributive situation to consider? The typical steps or flow in a negotiation can be found.

  How to assign different attributes to an element in ansys

During a maintenance process on the three-dimensional truss in Problem, the AB member is replaced with a member with the following properties.

  Explain the methods to reduce the frustrations

Suggest at least three (3) methods to reduce the frustrations among the disabled population and how this population can be better served.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd