• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 137 pages
Exam (elaborations)

Lehigh University — CSE 007 Introduction to Programming — Final Exam With questions and Answers & Rationales

Document preview thumbnail
Preview 4 out of 137 pages

COURSE TOPICS COVERED Topic Description Java Fundamentals Variables, data types, operators, input/output, type conversion Control Flow Conditional statements (if, else, switch), loops (for, while, do-while) Methods Method declaration, parameters, return types, scope, overloading Arrays Declaration, initialization, traversal, searching, sorting, multidimensional arrays Object-Oriented Programming Classes, objects, constructors, encapsulation, inheritance, polymorphism Strings String methods, immutability, comparison Algorithms Linear search, binary search, selection sort, insertion sort Recursion Base cases, recursive cases, recursive problem-solving Computing Breadth Number systems, compilers, pair programming, ethics (if covered)

Content preview

Lehigh University — CSE 007
Introduction to Programming — Final
Exam With questions and answers
with rationales

COURSE TOPICS COVERED

Topic Description

Variables, data types, operators,
Java Fundamentals
input/output, type conversion

Conditional statements (if, else, switch),
Control Flow
loops (for, while, do-while)

Method declaration, parameters, return
Methods
types, scope, overloading

Declaration, initialization, traversal,
Arrays
searching, sorting, multidimensional array

,Topic Description

Object-Oriented Classes, objects, constructors,
Programming encapsulation, inheritance, polymorphism

Strings String methods, immutability, comparison

Linear search, binary search, selection sort
Algorithms
insertion sort

Base cases, recursive cases, recursive
Recursion
problem-solving

Number systems, compilers, pair
Computing Breadth
programming, ethics (if covered)


PART I: JAVA FUNDAMENTALS (Questions 1-30)


1. Which of the following is a valid Java identifier?
• A) 2ndPlace
• B) _myVar

, • C) my-var
• D) class
• E) my var
Answer: B
Rationale: Identifiers must start with a letter, underscore
(_), or dollar sign ($), followed by letters, digits,
underscores, or dollar signs. _myVar is
valid. 2ndPlace starts with a digit, my-var contains a
hyphen, class is a keyword, and my var contains a space.


2. Which of the following is a primitive data type in Java?
• A) String
• B) Integer
• C) boolean
• D) Double
• E) ArrayList
Answer: C
Rationale: Java has eight primitive data
types: byte, short, int, long, float, double, char,

, and boolean. String, Integer, Double, and ArrayList are
reference types.


3. What is the output of the following code?
java
int x = 5;
int y = 2;
System.out.println(x / y);
• A) 2
• B) 2.5
• C) 3
• D) 2.0
• E) Compiler error
Answer: A
Rationale: Integer division truncates the decimal
portion. = 2 (remainder 1 is discarded).


4. What is the output of the following code?

Document information

Uploaded on
July 2, 2026
Number of pages
137
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$15.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.
MREXAMS
2.5
(4)
Sold
25
Followers
1
Items
979
Last sold
3 months 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