Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

ITSC 1213 TEST 2 QUESTIONS AND CORRECT ANSWERS

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
23-07-2026
Written in
2025/2026

ITSC 1213 TEST 2 QUESTIONS AND CORRECT ANSWERS

Content preview

ITSC 1213 TEST 2 QUESTIONS AND CORRECT
ANSWERS


An exception can be handled with: - Answers - try/catch or try/catch/finally

Which of these regarding catch blocks are true? - Answers - You can have multiple
exceptions in several catch blocks

True or False: The finally clause is not required in a try/catch block - Answers - True

Catch blocks should catch exceptions in what order? - Answers - From most specific
exception to least specific

Why should you use exception handling? (Select all that apply) - Answers - To protect
your program from input errors, from mistakes you might make (like passing around
objects that haven't been initialized), badly formatted or missing files, and system level
issues that you can't predict

Your method has a try/catch block that handles 8 exceptions. An exception is caught by
the fifth catch block. When will the code in the remaining catch blocks be executed? -
Answers - They will not be executed

The keyword static when applied to methods and fields means what? - Answers - The
methods and fields may be accessed even when no class object has been created.

How would you access the printInfo method, given this documentation:

public class MediaClass - methods and fields for handling media files.

static void printInfo() - prints out information about the class and it's methods. - Answers
- MediaClass.printInfo();

Assume you have the following code.

public class MyClass {
private int count;

...
}

What is printed by the following code? Assuming this line of code is in a method within
the class.

, System.out.println("count = " + count); - Answers - count = 0

Assume you have the following code:

public class Hogwarts {
static final int NUM_STAFF = 7;

....
}

What is the output of the following code, assuming it is in another class in the same
package?

Hogwarts.NUM_STAFF--;
System.out.println("The number of Hogwarts staff is = " + Hogwarts.NUM_STAFF); -
Answers - Nothing, this code will not compile.

If you have a private method called getName() in MyNameClass, how would you call
this method on an object of MyNameClass called myName? - Answers - myName
cannot call the getName() method. Calling this method will result in a compiler error

Which of the following are NOT true regarding ArrayLists? - Answers - A single
ArrayList can hold objects of different classes

How would you allocate a new ArrayList to contain Double objects? (Multiple answers
allowed) - Answers - ArrayList<Double> myList = new ArrayList<Double>();

How should you allocate an ArrayList of 50 Cookie objects? (Multiple answers allowed)
- Answers - ArrayList<Cookie> myCookieList = new ArrayList<>(50);

or

ArrayList<Cookie> myCookieList = new ArrayList<Cookie>(50);

What is printed as a result of the following code?

ArrayList<String> avengers = new ArrayList<String>();
avengers.add("Ironman");
avengers.add("Hulk");
avengers.add(1, "Thor");
System.out.println(avengers.get(2)); - Answers - Hulk

Which of the following is NOT true regarding methods from the ArrayList package? -
Answers - "add(int i, Object x)" adds x at i and deletes the object previously in its place

Document information

Uploaded on
July 23, 2026
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$13.99
Get access to the full document:

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

Get to know the seller

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.
QUEENS Harvard University
View profile
Follow You need to be logged in order to follow users or courses
Sold
228
Member since
4 year
Number of followers
180
Documents
4767
Last sold
5 days ago

4.1

61 reviews

5
35
4
10
3
8
2
3
1
5

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