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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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