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 7 pages
Exam (elaborations)

CMSC 131 EXAM 1 QUESTIONS WITH VERIFIED ANSWERS

Document preview thumbnail
Preview 2 out of 7 pages

CMSC 131 EXAM 1 QUESTIONS WITH VERIFIED ANSWERS

Content preview

CMSC 131 EXAM 1 QUESTIONS WITH VERIFIED
ANSWERS


Object - Answers - The principal entities that are manipulated by a Java program

Class - Answers - A blueprint or template for the structure of an object. The structure
around which all Java programs are based. A typical program has many classes.

Method - Answers - Java's term for a procedure or subroutine. Every method belongs to
some class, and a class may have many methods

Main Method - Answers - There must be exactly one method called main. This is where
execution begins.
public static void main(String args[]){
//body
}

Statements - Answers - Individual instructions. There are many different types of
statements. Each method consists of some number of statements.

Declarations - Answers - (Ex of statement) Declare (and initialize) variables

Assignment - Answers - (Ex of statement) Compute and assign a new value to a
variable

Method invocation - Answers - (Ex of statement) Execute a method (which may return a
result)

Control flow - Answers - The order in which statements are executed. General rule is
top to bottom.

What is Java compiled into? - Answers - Java bytecode

What do you need to run Java bytecode? - Answers - A bytecode interpreter ("Java
Virtual Machine")

Why is Java more portable than C or C++? - Answers - C/C++ programs are compiled
into machine code (rather than Java bytecode) and executed directly by CPU.

A class consists of a combination of data units, called ___________, and computation
units, called ___________. - Answers - variables,
methods

, Methods - Answers - Where all the computation takes place. Each method has a name,
a list of arguments enclosed in parentheses, and body, enclosed in curly braces.
Ex:
public static void main (String[]args){
//body
}

Variables - Answers - Data items that the methods operate on. Can be of various types.

List all primitive variable types - Answers - 8 types: byte, short, int, long, float, double,
boolean, and char

What do expressions/operators do? - Answers - Manipulate variables
Ex:
x = (2*y-z)/32

Comments - Answers - Used to indicate programmer's intent. Do not affect program's
execution. There are line comments ( using // ) and block comments ( using /star ... star/
)

Debugging - Answers - Process of finding and fixing problems

"Compile time" errors - Answers - Caught by compiler.
Ex:
Syntax errors
Variable type errors

"Run time" errors - Answers - appears during program execution
Ex:
division by zero
semantic errors

Different types of data require _________ __________ of memory. - Answers - different
amounts. The compiler's job is to reserve sufficient memory

Operations can only be performed between variables with _____________ types. -
Answers - compatible

Valid Variables Names - Answers - -Starts with: a letter (a-z or A-Z), or dollar sign ($), or
underscore ( _ )
-Followed by: zero or more letter, dollar signs, underscores, or integers
-Cannot be any of reserved names (class, float, int, if, etc.)

Camel case - Answers - A capitalization style
Ex:

Document information

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

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