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? -
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? -