Filters
Question type

Study Flashcards

Most of the String comparison methods are case sensitive.

A) True
B) False

Correct Answer

verifed

verified

What will be the value of position after the following code is executed? int position; String str = "The cow jumped over the moon."; Position = str.indexOf("ov") ;


A) 14
B) 15
C) 18
D) 17

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

What will be displayed after the following statements are executed? String str = "red$green&blue#orange"; String[] tokens = str.split("[$&#]") ; For (String s : tokens) System.out.print(s + " ") ;


A) red green blue orange
B) red $ green & blue # orange
C) $ & #
D) red[$&#]green[$&#]blue[$&#]orange

E) B) and D)
F) All of the above

Correct Answer

verifed

verified

A wrapper class is a class that is "wrapped around" a primitive data type and allows you to create objects instead of variables.

A) True
B) False

Correct Answer

verifed

verified

The __________ class is the wrapper class for the char data type.


A) StringBuilder
B) Integer
C) Character
D) String

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

Which of the following statements will display the maximum value that a double can hold?


A) System.out.println(Double.MAX_VALUE) ;
B) System.out.println(Double.MAXIMUM_VALUE) ;
C) System.out.println(Double.MAX_VAL) ;
D) System.out.println(<double>(MAX_VALUE) ) ;

E) None of the above
F) All of the above

Correct Answer

verifed

verified

Trying to extract more tokens than exist from a StringTokenizer object will cause an error.

A) True
B) False

Correct Answer

verifed

verified

The Character wrapper class provides numerous methods for


A) converting objects to primitive data types
B) testing and converting character data
C) testing and converting numeric literals
D) performing operations with named constants

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

In the __________ file format, when data in a spreadsheet is exported, each row is written to a line and commas are used to separate the values in the cells.


A) comma separated value
B) extensible markup language
C) excel binary
D) data interchange

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

What will be the value of position after the following code is executed? int position; String str = "The cow jumped over the moon."; Position = str.lastIndexOf("ov", 14) ;


A) 14
B) 1
C) 0
D) -1

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

The String class's __________ method accepts a value of any primitive data type as its argument and returns a string representation of the value.


A) trim
B) getChar
C) toString
D) valueOf

E) All of the above
F) B) and C)

Correct Answer

verifed

verified

Which of the following statements converts a String object variable named str to an int and stores the value in the variable x?


A) int x = Integer.integer(str) ;
B) int x - str;
C) int x = Integer.parseInteger(str) ;
D) int x = Integer.parseInt(str) ;

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

You can concatenate String objects by using the


A) concat or trim methods
B) concat method or the + operator
C) concatenate or join methods
D) concatenate method or the + operator

E) A) and C)
F) C) and D)

Correct Answer

verifed

verified

What will be displayed after the following code is executed? String str = "RSTUVWXYZ"; System.out.println(str.charAt(5) ) ;


A) W
B) X
C) V
D) U

E) B) and D)
F) A) and D)

Correct Answer

verifed

verified

Which of the following statements converts a double variable named tax to a string and stores the value in the String object named str?


A) String str = Double.toString(tax) ;
B) String str = double(tax) ;
C) String str = double.toString(tax) ;
D) String str = tax.Double.toString(str) ;

E) All of the above
F) B) and D)

Correct Answer

verifed

verified

The term __________ is commonly used to refer to a string that is part of another string.


A) nested string
B) literal
C) substring
D) delimiter

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

What will be displayed after the following code is executed? boolean matches; String str1 = "The cow jumped over the moon."; String str2 = "moon"; Matches = str1.endsWith(str1) ; System.out.println(matches) ;


A) true
B) moon
C) false
D) The cow

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

Given the following code, how many times will the while loop be executed? StringTokenizer st = new StringTokenizer("Java programming is fun!") ; While (st.hasMoreTokens() ) System.out.println(st.nextToken() ) ;


A) 7
B) 4
C) 5
D) 1

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

The __________ method returns a copy of the calling String object with all leading and trailing whitespace characters deleted.


A) remove
B) trim
C) compress
D) concat

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

You may cause an off-by-one error when working with a character position within a string if you think of the first position in the string as 1.

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer