CS10b - Introduction to Computer Science Using Java, II - QUIZ
CS10b · Introduction to Computer Science Using Java, II
Harvard University
Questions
10 Questions
Practice 10 questions on CS10b - Introduction to Computer Science Using Java, II at Harvard University. Free AI-generated quiz on uNotes — track your score, retake anytime.
Consider the following Java method which operates on an ArrayList of Integers. If the method is called with an ArrayList initialized as [10, 20, 30], what is the exact output printed to the console?
2The provided Java code for `Prob2` constructs a GUI. Which of the following best describes the layout and arrangement of the JButtons within the JFrame?
3Given the Java classes `Prez`, `FDR`, `Lincoln`, and `Truman`, and the provided code snippet that creates an array of `Prez` objects and iterates through it, what is the precise output produced?
4You are tasked with writing a Java method `isSorted` that checks if a Stack of Integers is sorted in non-decreasing order from bottom to top. You are allowed to use one Queue as auxiliary storage. Which of the following approaches would correctly implement this method while adhering to the constraints?
5In the context of the provided `Bitset.java` code, what is the effect of the statement `setA.byteArray[0] = 17;` assuming `setA` is a valid `Bitset` object and `byteArray` is its public instance variable?
6Given the `ListNode` class and the initial state of `list` (1) and `list2` (2 -> 4 -> 3), draw the precise linked list structures for `list` and `list2` after the execution of the provided Java code.
7In the `Prob7.java` program, what single instruction should be placed in the `MyPanel()` constructor to enable mouse events for this panel?
8In the `Prob7.java` program, specifically within the `actionPerformed` method of the `ButtonListener` class, what is the minimal code required to toggle the `circleOrSquare` boolean variable when either button is pressed?
9Consider the MIPS assembly code for the `decode` subroutine. Which of the following assembly instructions are necessary to correctly implement the Caesar cipher decoding logic for lowercase letters ('a' through 'z')?
10In the MIPS `decode` subroutine, after the character has been potentially decoded, what is the purpose of the `sb $t3, ($a0)` instruction within the `loop`?