CS 180 Practice Exam Solutions
What is the value stored in the variable j after executing the following statement? int j = (15 | x) & 14; In the aforementioned statement x is a variable of type int containing an integer between 0 (inclusive) and 15 (inclusive). correct answer: 14 What will be the value of x after the execution of the following code segment? int x = 3; switch(x - 1) { case 1: x += 4; case 2: x = 1; case 3: case 4: x /= 3; case 5: x++; break; case 6: x *= 4; default: x = 2; } correct answer: 1 Review the following to answer the question
Document information
- Uploaded on
- May 19, 2023
- Number of pages
- 27
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers