100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSCI A201 JAVA Midterm Exam Questions and Correct Answers Latest 2025

Rating
-
Sold
-
Pages
10
Grade
A+
Uploaded on
23-01-2025
Written in
2024/2025

CSCI A201 JAVA Midterm Exam Questions and Correct Answers Latest 2025 Given String name; the value of name is directly stored in its memory space. - Answers False String objects are immutable. - Answers True Contents of the package do not need to be imported into a program in order to be used. - Answers False In order to use a predefined method, you simply need to know the name of the method. - Answers False The method length in the class String returns the number of characters in the string including whitespace characters. - Answers True The method printf is used only to format the output of decimal numbers. - Answers False The default output of decimal numbers of the type float is up to 15 decimal places. - Answers False A string consisting of only an integer or a floating-point number is called a numeric string. - Answers True The method parseInt is used to convert a numeric integer string into a value of the type double. - Answers False The classes Integer, Float, and Double are not wrapper classes. - Answers False Which of the following is a valid statement? - Answers String name = "Doe"; In Java, all variables declared using a class are ____. - Answers reference variables Suppose str is a String variable. The statement str = new String("Hello World"); is similar to which of the following? - Answers str = "Hello World"; Which statement instructs a program to run the garbage collector? - Answers S(); Suppose that str is a String variable. Write a Java statement that uses the operator new to instantiate the object str and assign the string "Java Programming" to str. - Answers str = new String ("Java Programming"); There are ____ types of methods in a class. - Answers 2 Which package is automatically imported by the Java system? - Answers What is the value of the following statement? M(3,2) - Answers 9.0 What will most probably happen if you omit the dot (.) operator when accessing a method? - Answers A syntax error will be reported. An expression such as h(); is an example of a(n) ____. - Answers method call Which of the following outputs 56734.987 to three decimal places? - Answers Sf("%.3f", 56734.98745); What is the output of the following statement? Sf("%.3f", 56.1); - Answers 56.100 The method compareTo belongs to which class? - Answers String A static method can be called using the name of the class containing the method, and a method must be called in order to be executed - Answers True To force the output to be right justified, you use the format specifier flag. If the flag is set to '-', then the output of the result is right justified. - Answers False If console is a Scanner object initialized to the standard input device, then the expression Double() retrieves the next string form the standard input device. - Answers False If console is a Scanner object initialized to the standard input device, then the expression Int() retrieves the next character from the standard input device. - Answers False If console is a Scanner object initialized to the standard input device, then the expression () retrieves the next character from the standard input device. - Answers False If console is a Scanner object initialized to the standard input device, then the expression Double() retrieves the next _______from the standard input device. - Answers floating number Suppose console is a Scanner object initialized with the standard input device. The expression Int(); is used to read one int value and the expression Double(); is used

Show more Read less
Institution
CSCI A201 JAVA
Course
CSCI A201 JAVA









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSCI A201 JAVA
Course
CSCI A201 JAVA

Document information

Uploaded on
January 23, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CSCI A201 JAVA Midterm Exam Questions and Correct Answers Latest 2025

Given



String name;



the value of name is directly stored in its memory space. - Answers False

String objects are immutable. - Answers True

Contents of the java.util package do not need to be imported into a program in order to be used. -
Answers False

In order to use a predefined method, you simply need to know the name of the method. - Answers False

The method length in the class String returns the number of characters in the string including
whitespace characters. - Answers True

The method printf is used only to format the output of decimal numbers. - Answers False

The default output of decimal numbers of the type float is up to 15 decimal places. - Answers False

A string consisting of only an integer or a floating-point number is called a numeric string. - Answers
True

The method parseInt is used to convert a numeric integer string into a value of the type double. -
Answers False

The classes Integer, Float, and Double are not wrapper classes. - Answers False

Which of the following is a valid statement? - Answers String name = "Doe";

In Java, all variables declared using a class are ____. - Answers reference variables

Suppose str is a String variable. The statement

str = new String("Hello World");



is similar to which of the following? - Answers str = "Hello World";

Which statement instructs a program to run the garbage collector? - Answers System.gc();

, Suppose that str is a String variable. Write a Java statement that uses the operator new to instantiate
the object str and assign the string "Java Programming" to str. - Answers str = new String ("Java
Programming");

There are ____ types of methods in a class. - Answers 2

Which package is automatically imported by the Java system? - Answers java.lang

What is the value of the following statement?

Math.pow(3,2) - Answers 9.0

What will most probably happen if you omit the dot (.) operator when accessing a method? - Answers A
syntax error will be reported.

An expression such as str.length(); is an example of a(n) ____. - Answers method call

Which of the following outputs 56734.987 to three decimal places? - Answers System.out.printf("%.3f",
56734.98745);

What is the output of the following statement?

System.out.printf("%.3f", 56.1); - Answers 56.100

The method compareTo belongs to which class? - Answers String

A static method can be called using the name of the class containing the method, and a method must be
called in order to be executed - Answers True

To force the output to be right justified, you use the format specifier flag. If the flag is set to '-', then the
output of the result is right justified. - Answers False

If console is a Scanner object initialized to the standard input device, then the expression
console.nextDouble() retrieves the next string form the standard input device. - Answers False

If console is a Scanner object initialized to the standard input device, then the expression
console.nextInt() retrieves the next character from the standard input device. - Answers False

If console is a Scanner object initialized to the standard input device, then the expression console.next()
retrieves the next character from the standard input device. - Answers False

If console is a Scanner object initialized to the standard input device, then the expression
console.nextDouble() retrieves the next _______from the standard input device. - Answers floating
number

Suppose console is a Scanner object initialized with the standard input device. The expression
console.nextInt(); is used to read one int value and the expression console.nextDouble(); is used to read
two double values. - Answers False

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TutorJosh Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
336
Member since
1 year
Number of followers
16
Documents
28319
Last sold
6 hours ago
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3.6

53 reviews

5
18
4
14
3
12
2
0
1
9

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions