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

CMSC Midterm 2 UPDATED ACTUAL Questions and CORRECT Answers

Document preview thumbnail
Preview 4 out of 59 pages

CMSC Midterm 2 UPDATED ACTUAL Questions and CORRECT Answers

Content preview

CMSC Midterm 2 UPDATED ACTUAL
Questions and CORRECT Answers
remember to - CORRECT ANSWER - Write your name on each page of the exam


Which of the following are valid ways to declare a symbolic constant in Processing?


a. final float PI = 3.14;
b. float pi = 3.14;
c. final float pi = 3.14;

d. float PI = 3.14; - CORRECT 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


d. It is highly recommended to use uppercase for symbolic constant names - CORRECT
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


e. You can check whether two arrays a and b have the same contents using a == b - CORRECT
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


d. Each function gets its own storage space in a memory map - CORRECT 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'))


d. 99 - CORRECT ANSWER - b and c

,Which of the following are equal to "Hello123" in Processing?


a. "He" + "llo123"


b. "Hello" + 123


c. "Hello" + 12 + 3


d. "Hello" + (1 + 2 + 3) - CORRECT 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);


What gets printed? - CORRECT ANSWER - 5, 4, 3, 2, 1


int x;

, void setup() {
x = 1;
}


void draw() {
int x = 2;
mystery(x);
println(x);
noLoop ();
}


void mystery(int y) {
y++;
x--;
// End of Example

} - CORRECT 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++;
}


What gets printed? - CORRECT ANSWER - 4
8

Document information

Uploaded on
October 26, 2025
Number of pages
59
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.49

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.
STANFORDGRADESS
4.0
(241)
Sold
1674
Followers
109
Items
121810
Last sold
1 hour 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