ITSC 1213 ALL SET QUESTIONS AND ANSWERS
SET A+
✔✔What is the keyword to use to indicate that a variable's value cannot be changed -
✔✔final
✔✔A synonym for class method is which of the following - ✔✔static method
✔✔The area of code in which a variable is known is called its - ✔✔scope
✔✔The standard for encapsulation is to declare your instance variables to be _____
and your methods to be _____. - ✔✔private, public
✔✔If only the code within the same package can access your fields and/or methods,
you have used which of the following access modifiers? - ✔✔default
✔✔You can use the keyword "final" to modify non-static variables - ✔✔True
✔✔Another name for a field is an _____ variable - ✔✔instance
✔✔An instance variable remains accessible only as long as its _____ - ✔✔class
✔✔Digitizing a sound means to capture the _____________ with a microphone. -
✔✔pitch
✔✔Loops are crucial for manipulating sound arrays. Which of the following is an
example of a for-each loop? - ✔✔for (SoundSample sample : sampleArray) {...}
✔✔another name for a field is - ✔✔instance variable
, ✔✔In certain situations, multiple constructors with identical parameter types are valid. -
✔✔Yes, if they're in a different order
✔✔If you wanted to create an array of objects, which of the following would be valid -
✔✔String [] s = {"A", "B", "C"};
OR
String [] s = new String[10];
✔✔The values of an object's instance variables determine it's - ✔✔state
✔✔Given the following code:
public static void Q1() {
int sum = 0;
int j = 0;
for (int i = 0; i < 10; i++, j++) {
for (int k = 5; k < 10; k++, j++) {
sum++;
}
}
System.out.println(j);
System.out.println(sum);
}
What value of j will be printed? - ✔✔60
✔✔Will this statement compile?
for (int i=0, j=0, k=0, l=0, m=0, n=0, o=0, p=0; i < 5; i++) { ... } - ✔✔Yes
✔✔What will be the output of this?
int i = 0;
for (; i< 100;) {
i++;
}
System.out.println(i); - ✔✔100
✔✔What will be printed?
int j = 0;
int sum = 0;
SET A+
✔✔What is the keyword to use to indicate that a variable's value cannot be changed -
✔✔final
✔✔A synonym for class method is which of the following - ✔✔static method
✔✔The area of code in which a variable is known is called its - ✔✔scope
✔✔The standard for encapsulation is to declare your instance variables to be _____
and your methods to be _____. - ✔✔private, public
✔✔If only the code within the same package can access your fields and/or methods,
you have used which of the following access modifiers? - ✔✔default
✔✔You can use the keyword "final" to modify non-static variables - ✔✔True
✔✔Another name for a field is an _____ variable - ✔✔instance
✔✔An instance variable remains accessible only as long as its _____ - ✔✔class
✔✔Digitizing a sound means to capture the _____________ with a microphone. -
✔✔pitch
✔✔Loops are crucial for manipulating sound arrays. Which of the following is an
example of a for-each loop? - ✔✔for (SoundSample sample : sampleArray) {...}
✔✔another name for a field is - ✔✔instance variable
, ✔✔In certain situations, multiple constructors with identical parameter types are valid. -
✔✔Yes, if they're in a different order
✔✔If you wanted to create an array of objects, which of the following would be valid -
✔✔String [] s = {"A", "B", "C"};
OR
String [] s = new String[10];
✔✔The values of an object's instance variables determine it's - ✔✔state
✔✔Given the following code:
public static void Q1() {
int sum = 0;
int j = 0;
for (int i = 0; i < 10; i++, j++) {
for (int k = 5; k < 10; k++, j++) {
sum++;
}
}
System.out.println(j);
System.out.println(sum);
}
What value of j will be printed? - ✔✔60
✔✔Will this statement compile?
for (int i=0, j=0, k=0, l=0, m=0, n=0, o=0, p=0; i < 5; i++) { ... } - ✔✔Yes
✔✔What will be the output of this?
int i = 0;
for (; i< 100;) {
i++;
}
System.out.println(i); - ✔✔100
✔✔What will be printed?
int j = 0;
int sum = 0;