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)

CSE 1321 LATEST EXAM TEST 2026.pdf

Document preview thumbnail
Preview 2 out of 7 pages

CSE 1321 LATEST EXAM TEST

Content preview

CSE 1321 LATEST EXAM TEST 2026/2027 QUESTIONS
AND SOLUTIONS RATED A+
✔✔Variable = expression; - ✔✔1) the expression on the right side of the = operator is
evaluated Expression has data type and value

2) the result is stored in the variable on the left if the types are compatible (overwriting
the original value)

✔✔Shortcut Operators - ✔✔++ increment by 1

-- decrement by 1

+= a += 3; a = a + 3;
-= a -=10; a= a-10;
*= a*=4; a= a*4;
/= a/=7; a= a / 7;
%= a%=10; a= a % 10;

✔✔Two Types of Data Conversion - ✔✔-Widening conversion (promotion)
-Narrowing conversion (demotion)

✔✔Widening conversion (promotion) - ✔✔-safe, do not lose data
-goes to a "wider" (more bits) data type
-may lose precision (long to float)

✔✔Narrowing conversion (demotion) - ✔✔-may lose data
-may lose precision
-should be avoided
-compiler error unless specific cast done

✔✔Conversion Techniques - ✔✔- Assignment conversion
Example: assign an int to a long

-Promotion
Example: divide an int by a double

- Casting
Example: assign a double to int

✔✔Explicit Type Casting - ✔✔Syntax:
(dataType)(expression)

Note: parentheses around the expression are optional if the expression consists of 1
variable

, Useful for calculating averages:
double result = (double) 25/3;
double result = (double) total / count;

✔✔Expression evaluation follow - ✔✔operator precedent rule (order of operations).

✔✔The order of statement execution is called the - ✔✔flow of control

✔✔By default, execution is - ✔✔linear: one statement after another

✔✔A ------- allows us to choose which statements will be executed next: - ✔✔Selection
(conditional) statement

✔✔if - ✔✔if - block of code executes if a Boolean expression is true.
(selection statement)

✔✔if-else - ✔✔will execute one block of code if the Boolean expression is true, or
another if it is false.
(selection statement)

✔✔if-else-if - ✔✔tests a series of Boolean expressions and execute corresponding
block when it finds one that is true.
(selection statement)

✔✔switch - ✔✔lets the value of a variable determine where the program will branch to.

✔✔Relational Operators - ✔✔Create a true or false using a relational operator:

> greater than
< less than
== equals
! not
!= not equal
>= greater than or equal
<= less than or equal

✔✔!
!= - ✔✔not not equal to (relational operators)

✔✔Logical Operators - ✔✔Boolean expressions can also use the following logical
operators:
Logical NOT
Logical AND
Logical OR

Document information

Uploaded on
July 21, 2026
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.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.
BOARDWALK
3.5
(40)
Sold
276
Followers
8
Items
32861
Last sold
5 hours 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