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

CMSC Midterm 2 Exam Verified Exam Questions and Answers Latest update 2026/2027

Document preview thumbnail
Preview 4 out of 78 pages

CMSC Midterm 2 Exam Verified Exam Questions and Answers Latest update 2026/2027

Content preview

CMSC Midterm 2 Exam
Verified Exam Questions and Answers Latest update 2026/2027

Question:
remember to -
Answer:
Write your name on each page of the exam
Which of the following are valid ways to declare a symbolic constant in Processing?

Question:
a. final float PI = 3.14;

b. float pi = 3.14;

c. final float pi = 3.14;

d. float PI = 3.14; -
Answer:
a and c
Which of the following are false statements regarding symbolic constants in Processing?
a. Symbolic constant names must always be uppercase, or your program won't run
b. If you try to modify a symbolic constant, your program won't run
c. If you try to modify a symbolic constant, your program will give you a warning

Question:
d. It is highly recommended to use uppercase for symbolic constant names -
Answer:
a and c
Which of the following are true statements regarding arrays in Processing?
a. An array can contain data of multiple types (e.g. mix of int and float)
b. The largest legal index in an array is length - 1
c. You are not allowed to have global array variables
d. It is possible to have an array of length 0

Question:
e. You can check whether two arrays a and b have the same contents using a == b -

,Answer:
b and d
Which of the following are false statements regarding memory maps?
a. A memory map is a dynamic visual representation of the organization of data in a program
b. Each program has a unique memory map that is determined before the program begins
c. The memory map keeps changing as the program executes

Question:
d. Each function gets its own storage space in a memory map -
Answer:
b
Which of the following are equal to 'C' in Processing? Note that the ASCII code for 'A' is 65 and
for 'a' is 97.
a. 'c'
b. (char) ('A' + 2)
c. (char) ('c' - ('a' - 'A'))

Question:
d. 99 -
Answer:
b and c
Which of the following are equal to "Hello123" in Processing?
a. "He" + "llo123"
b. "Hello" + 123
c. "Hello" + 12 + 3

Question:
d. "Hello" + (1 + 2 + 3) -

,Answer:
a and b and c
int [] arr = {1, 2, 3, 4, 5};

int i = 0, j = arr.length - 1;
while (i < j) {
int mystery = arr[i];

arr[i] = arr[j];

arr[j] = mystery;

i++;

j--;

}
println(arr);

Question:
What gets printed? -
Answer:
5, 4, 3, 2, 1
int x;
void setup() {

x = 1;

}
void draw() {

int x = 2;

mystery(x);

println(x);

noLoop ();

}

, Question:
void mystery(int y) {

y++;

x--;

// End of Example

}-
Answer:
2
int [] arr = {2, 4, 6, 8, 10, 12, 14, 16};

int x = 1;
for (int i = 1; i % 2 == 1; i += x) {

println(arr[i]);

x++;

}

Question:
What gets printed? -

Document information

Uploaded on
October 16, 2026
Number of pages
78
Written in
2026/2027
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.
Sold
22
Followers
0
Items
11510
Last sold
4 weeks 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