Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions on Data Collections, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Subtopic: Using Text Files Clear filter

Questions 81–90 of 181
  1. 81
  2. 82
  3. 83
  4. 84
  5. 85
  6. 86
  7. 87
  8. 88
  9. 89
  10. 90

Question 81

Multiple choice Using Text Files
A text file contains: 2.5. What is printed?
String s = sc.next();
sc.close();
double d = Double.parseDouble(s);
System.out.println(d + d);
Pick an answer, then check it. The solution opens in a window.

Question 82

Multiple choice Using Text Files
A text file contains:    hello    world    (with extra spaces). What is printed?
String s = sc.next();
String t = sc.next();
sc.close();
System.out.println(s.length() + " " + t.length());
Pick an answer, then check it. The solution opens in a window.

Question 83

Multiple choice Using Text Files
A text file is completely empty (contains no data at all). What is printed?
boolean result = sc.hasNext();
sc.close();
System.out.println(result);
Pick an answer, then check it. The solution opens in a window.

Question 84

Multiple choice Using Text Files
A text file contains a single line: 5 (followed by a newline). What is printed? int n =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 85

Multiple choice Using Text Files
A text file contains: 7. What is printed? String s…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 86

Multiple choice Using Text Files
A text file contains: 7. What is printed? String s =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 87

Multiple choice Using Text Files
A text file contains: 7 2. What is printed? int a = sc.nextInt(); int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 88

Multiple choice Using Text Files
A text file contains: 10 20 30. What is printed? String s =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 89

Multiple choice Using Text Files
A text file contains two lines: abc def What is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 90

Multiple choice Using Text Files
A text file contains three lines: first second third What is printed? String a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 81 of 181
Page 9 of 19