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

D278 Exam Questions and Correct Answers

Document preview thumbnail
Preview 2 out of 6 pages

D278 Exam Questions and Correct Answers

Content preview

D278 Exam Questions and Correct Answers
What is the purpose of a variable?

A variable stores data that can be used and modified during a program's execution.

How do you save a value to a variable?

By using the assignment operator (=), e.g., x = 5.

What is a programming expression?

A combination of variables, constants, operators, and functions that evaluates to a value.

What is an identifier?

A name used to identify variables, functions, arrays, or other user-defined elements.

What constitutes a valid identifier?

Must start with a letter or underscore, followed by letters, digits, or underscores, and cannot be a

keyword.

What is a literal?

A fixed value in code, such as 5 or "hello".

What is an operator?

A symbol that performs operations on variables and values (e.g., +, -, *, /).

What precedence rules does programming use?

Defines the order in which operators are evaluated; parentheses > multiplication/division >

addition/subtraction.

How does an integer differ from a float?

Integers are whole numbers; floats contain decimal points.

What happens if you divide two integers?

Integer division gives an integer (in some languages, it truncates).

, What happens if you divide an integer and a float?

Integer/float returns a float.

What happens if you divide a nonzero floating point number by zero?

Typically results in infinity or a runtime error, depending on the language.

How do you convert an item's type?

Through type casting, like int(), float(), or str().

What does the modulo operator do?

Returns the remainder of a division (e.g., 5 % 2 = 1).

What is the difference in a variable and a constant?

A variable's value can change; a constant's value cannot.

How does an array work?

Stores multiple values in indexed positions.

What does index reference?

The position of an element in an array, starting at 0.

What is the purpose of each different data type?

Defines how data is stored and what operations can be performed on it.

How does a branch differ from a loop?

A branch chooses between alternatives; a loop repeats actions.

How does an if-else branch work?

Evaluates a condition and runs one block of code if true, another if false.

What does the equality operator do?

Compares two values to see if they are equal; it generally works across most primitive types.

What are the four relational operators?

Document information

Uploaded on
August 1, 2026
Number of pages
6
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$11.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

Sold
0
Followers
0
Items
51
Last sold
-



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