ISYS 303 - Previous Quizzes Flashcards
Which program is responsible for allowing someone to run a Java program?
JRE
Which is NOT a key consideration for using Java? Simple Secure Compiles into an executable file High Performance
Compiles into an executable file
The process that protects code from changes by other people and also hides details or how things work (like driving a car) by binding code and data together is called..... OOP Encapsulation Polymorphism Inheritance
Encapsulation
The ability to use a single interface (or method) but use it for different types of actions (like printing an excel, word, or pdf file) is called ... OOP Encapsulation Polymorphism Inheritance
Polymorphism
Which is NOT a valid Java data type. IOW, which could you NOT use to declare a variable. integer boolean double char
integer
Which data type should be used if you were worrying about memory and were trying to represent score on a test? byte short int long
byte
A float data type can hold a larger number and larger decimal than a double
True
False
False
Which would be the correct Java statement for declaring a string variable and assigning it the value of Greg string greg; String sName = "Greg"; String sName = 'Greg'; String "Greg" = sName;
String sName = “Greg”;
What could you embed in a System.out.println statement and cause a blank line to be inserted? "/t" "/n" "\n" "\\"
“\n”
What would the following lines of Java code display (assuming all code before and after were correct)
int iCount;
iCount = 2;
iCount++;
System.out.println(++iCount);
3
4
2
unknown
4
What would the following Java source code display assuming all code before and after were correct
int iCount = 2;
System.out.println(–iCount);
2
1
0
unknown
1
What does the following print?
int iCount = 10; if (iCount = 5) { System.out.println("Hi"); } else { System.out.println("Bye"); }
Hi
Bye
Hi and Bye
Nothing, there are bugs
Nothing, there are bugs
What key word is used to create an object? Student Scanner new main
new
Scanner scanInput = new Scanner(System.in);
What statement clears the buffer? (HINT: remember, there is a carriage return left in the buffer when you go from scanning an integer to scanning a string so the computer just grabs the enter key and thinks that value is the input. We get around this by using multiple scanner objects - one for strings, one for ints, etc.)
scanInput.close();
scanInput.nextLine();
scanInput.flush();
It cannot be done
scanInput.nextLine();
A ____________________________ is like a template or a mold that is used to instantiate objects.
Method
Class
Program
Parameter
Class
Assuming iCount was declared properly, how many times will “Hi” be printed?
for (iCount = 0; iCount
None of the above
Assuming iCount was declared properly, what will the following print?
for (iCount = 5; iCount > 0; iCount = iCount + 2)
System.out.println(iCount);
5 3 1
5 4 3 2 1
4 3 2 1
None of the above
None of the above