Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

CMSC131 EXAM 1 QUESTIONS WITH VERIFIED ANSWERS

Document preview thumbnail
Preview 2 out of 5 pages

CMSC131 EXAM 1 QUESTIONS WITH VERIFIED ANSWERS

Content preview

CMSC131 EXAM 1 QUESTIONS WITH VERIFIED
ANSWERS


A method that does not access any instance variables should be defined as: - Answers
- Static

When we call a method that has a String parameter, we pass to the method: - Answers
- The address of the String object

Which of the following is an alternative to the equals method to determine whether two
strings are
the same? - Answers - compareTo

Which one of the following correctly describes an immutable object? - Answers - An
object that, once created, cannot have its internal state changed.

What does the new operator return? - Answers - The address in the heap where the
object was created

A constructor method: - Answers - is called after the object has been created

A .class file is the result generated by the: - Answers - Java Compiler

The expression "cat".compareTo("dog") has: - Answers - A negative value.

The class Ceiling provides several methods and one of them can be called as follows:
Ceiling.compute(). What can we
say about the compute() method? - Answers - The compute() method is a static
method.

Which of the following expressions is equivalent to m *= 10 + p; ? - Answers - None of
the above.

When we append a string to another string (e.g., mes += "house"; where mes is a String
variable with the value "my"): - Answers - A new object is created that represents the
concatenation of mes and "house".

The Java compiler generates: - Answers - Bytecode.

How many different combinations of 0's and 1's can be represented with 4 bits? -
Answers - 16

Which of the following are variable names that will compile? - Answers - hot34, _$_145

, The decimal equivalent of the binary number 101 is: - Answers - 5

In the following code fragment, the casting of m to an integer will permanently change
the value of m to:
double m = 4.7;
System.out.println((int)m); - Answers - The value of m will not change

How many objects are present in the following code fragment?
int x = 7;
String result = ""; - Answers - 1

After the following code fragment is executed:
int x = Integer.parseInt("123 in"); - Answers - An error will take place when the code is
executed.

Which of the following is a high level programming language (Circle all that apply)? -
Answers - a. Java

The expression "cat".equals("dog") evaluates to: - Answers - false

Why do we use .equals for comparisons between String? What is == comparing? -
Answers -

Which of the following correctly generates an integer from 35-51 (inclusive, exclusive)? -
Answers -

What is the largest value that can be represented with 7 bits? - Answers - 256

What is 1110 0011 in base 10? - Answers -

Rachel is confused about the difference between declaring, initializing and instantiating.
Give an example of each below
with a brief description/explanation: - Answers - Declaring:
Initializing:
Instantiating:

What is 200 in base 2? - Answers -

How many objects are present in the following code fragment?
int x = 7;
String result = "";
StringBuffer resultBuff = new StringBuffer("Uhhh");
double y = 22; - Answers - 2

Document information

Uploaded on
July 10, 2026
Number of pages
5
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.09

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
GEEKA
3.8
(361)
Sold
2137
Followers
1449
Items
58515
Last sold
2 days ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions