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

CS 1331 Final Exam with precise detailed solutions

Rating
-
Sold
-
Pages
38
Grade
A+
Uploaded on
13-08-2025
Written in
2025/2026

CS 1331 Final Exam with precise detailed solutions

Institution
CS 1331
Course
CS 1331

Content preview

CS 1331 Final Exam with precise |!! |!! |!! |!! |!! |!!




detailed solutions |!!




How does OOP model the real world? - correct answer✔✔Classes are the
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




model/blueprint or template from which specific objects are made. |!! |!! |!! |!! |!! |!! |!! |!!




Each class has state (attributes) and behaviors (methods).
|!! |!! |!! |!! |!! |!! |!!




Encpsulation - correct answer✔✔how each object manages its own data by |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




granting and restricting access of its instance variables and its methods
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




to other classes.
|!! |!!




Inheritance - correct answer✔✔Classes form a hierarchy where some |!! |!! |!! |!! |!! |!! |!! |!! |!!




classes inherit information or functionality from parent classes.
|!! |!! |!! |!! |!! |!! |!!




Interpreted vs. Compiled languages - correct answer✔✔Interprets code as |!! |!! |!! |!! |!! |!! |!! |!! |!!




it reads the code. Compiled languages read through the code and compile
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




it before excecuting
|!! |!!




What kind of language is Java? (interpreted or compiled) - correct
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




answer✔✔Java is a mixture of both. The compiler checks mostly for |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




correct syntax to see if the code can run and then compiles the code into
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




byte code. |!!




The byte code goes into the java interpreter in the Java virtual machine
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




where it is interpreted. This is why we can have compile-time errors as
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




well as runtime errors.
|!! |!! |!!




Syntax vs. Semantics - correct answer✔✔Syntax - What is legal in a
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




language (ie grammar and structure). What words and symbols are|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




allowed and how they are allowed to be arranged. |!! |!! |!! |!! |!! |!! |!! |!!

,Semantics - What the statements and symbols mean and do (what
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




happens when you run it). How the language gets interpreted.
|!! |!! |!! |!! |!! |!! |!! |!! |!!




JDK - correct answer✔✔Java Development Kit; compiler + interpreter
|!! |!! |!! |!! |!! |!! |!! |!!




Syntax - correct answer✔✔Grammar or rules; how di I write a valid
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




statement



Semantics - correct answer✔✔The meaning of the statement; ie what does
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




a for loop mean and do in a program when it is run.
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




Source Code - correct answer✔✔The program you write; collection of
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




statements in a file |!! |!! |!!




Byte Code - correct answer✔✔result of compiling source code into portable
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




code for the interpreter (java byte code)
|!! |!! |!! |!! |!! |!! |!!




(Java) Compiler - correct answer✔✔Converts source code into byte code
|!! |!! |!! |!! |!! |!! |!! |!! |!!




IDE - correct answer✔✔Integrated Development Environment
|!! |!! |!! |!! |!!




JDK vs JRE - correct answer✔✔JDK (Java Development Kit) is a set of tools
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




including the JRE used to develop and run apps in Java. The JRE (Java
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




Runtime Environment) is a package used to run apps in java.
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




Inline vs Block comments - correct answer✔✔// makes a line comment
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




/* Block Comment */ are the markers around a block comment.
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!

,Can you change a variable type after it is decalred - correct answer✔✔You
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




cannot change the variable type after it is declared.
|!! |!! |!! |!! |!! |!! |!! |!! |!!




What do variables hold in java? - correct answer✔✔They either hold a
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




primitive data type or the location of an object |!! |!! |!! |!! |!! |!! |!! |!!




What does it mean that java is strongly typed? - correct answer✔✔You
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




cannot assign an inappropriate value to a variable
|!! |!! |!! |!! |!! |!! |!!




Primitive types of variables - correct answer✔✔Numbers: |!! |!! |!! |!! |!! |!!




-integers: byte, short, int, long (8, 16, 32, 64 bits respectively) |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




-decimals: float, double (32, 64 bits respectively) |!! |!! |!! |!! |!! |!!




Char: a single character |!! |!! |!!




Boolean: true or false |!! |!! |!!




What are literals in java? - correct answer✔✔Literals are the source code
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




representation of a fixed value. |!! |!! |!! |!!




Ie: int num = 20; char c = "a";
|!! |!! |!! |!! |!! |!! |!! |!!




In this case, 20 is the literal, that represents the value of 20, and "a" is
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




the literal that represents the character a.
|!! |!! |!! |!! |!! |!!




Ascii vs unicode. Which does java use? - correct answer✔✔Java uses ascii.
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




Ascii (8-bit) and unicode (16-bit) are both ways that character values get
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




converted (encoded) into binary for the computer to understand. |!! |!! |!! |!! |!! |!! |!! |!!




Expressions - correct answer✔✔Combination of 1 or more operators and |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




operands.

Ie: 3 + 4 * 5
|!! |!! |!! |!! |!!

, Operators - correct answer✔✔symbols that perform and actions or
|!! |!! |!! |!! |!! |!! |!! |!! |!!




operations and return a result |!! |!! |!! |!!




Operator precedence rules - correct answer✔✔Operators with the same
|!! |!! |!! |!! |!! |!! |!! |!! |!!




precedence next to each other determine order of evaluation by |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




associativity (left to right or right to left) |!! |!! |!! |!! |!! |!! |!!




1. var++ and var-- (postfix)
|!! |!! |!! |!!




2. +, -(unary plus minus ie -5, -num), ++var and --var (Prefix)
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




3. (type)(casting)
|!!




4. !
|!!




5. *,/,%
|!!




6. +, - (Binary addition and subtraction ie: 3 + var)
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




7. <, <=, >, >= (Relational)
|!! |!! |!! |!! |!!




8. ==, != (Equality)
|!! |!! |!!




9. ^(Exclusive OR)
|!! |!!




10. && |!!




11. || |!!




12. ?: (Ternary operator)
|!! |!! |!!




13. =, +=, -=, *=, /=, %= (Assignment operators)
|!! |!! |!! |!! |!! |!! |!! |!!




------------------

1) unary ops (right to left)
|!! |!! |!! |!! |!!




2) */% (left to right)
|!! |!! |!! |!!




3) binary (left to right)
|!! |!! |!! |!!




4) assignment (right to left)
|!! |!! |!! |!!




How are integers divided? - correct answer✔✔It throws away the
|!! |!! |!! |!! |!! |!! |!! |!! |!! |!!




remainder.

Written for

Institution
CS 1331
Course
CS 1331

Document information

Uploaded on
August 13, 2025
Number of pages
38
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$18.49
Get access to the full document:

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

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.
Ruiz Liberty University
View profile
Follow You need to be logged in order to follow users or courses
Sold
102
Member since
1 year
Number of followers
1
Documents
14000
Last sold
1 week ago
Top-Quality Study Materials for Success – Ace Your Exams with Expert Resources!

Access high-quality study materials to help you excel in your exams. Get notes, summaries, and guides tailored to your courses!

3.2

15 reviews

5
4
4
4
3
2
2
1
1
4

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