stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java Study Flashcards | StudBud
Explore
/
Java Study
Java Study
69 terms
·
StudBud Administration
·
181 plays
Do you know your Java?
Flashcards
69 cards
F
Practice quiz
P
Host live
L
Questions
69
Answers
1
What is java?
Write and run the code anywhere
Used for application programming, for mobile and web based applictions
All of the above
Can pass variables only by the value
2
A hash table is a data structure that stores items by mapping each item to a location in a(n) _.
Array
Basket
Class
Template
3
Method calls always contain what set of characters?
[ ]
( )
" "
{ }
4
How would you correctly add to a HashMap?
testHashMap.add("one");
testHashMap.put("key", "value");
testHashMap.put("one");
testHashMap.add("key", "value");
5
What two things does Java encapsulate into one container?
Attributes and methods
Variables and constants
Methods and parameters
Coffee and computers
6
What Loops are in Java?
For, Infiniti, Do While
Do While, Fruit, Infiniti
Loopdy, While, and Infiniti
For, Do While, While
7
The constructor that the JVM supplies if no constructor is declared
Default Constructor
Constructor
Constructor Overriding
Constructor Overloading
8
What is an Object?
Form of states and behaviors
A subclass of Hashtable
A template/ blueprint that describes the behavior of an object
Seriously, it's just part of Java
9
Set methods should be used to _.
create new numbers
return values from private attributes
get a pizza AND wings
set values for private attributes
10
If we wanted to maintain ordering, would we use an ArrayList or HashMap
Neither
HashMap
ArrayList
Either
11
This changes the color of Pet p with a setter
pet.setColor("red");
setColor(p, "red");
p.getColor("red");
p.setColor("red");
12
A list of elements that does not contain any duplicates is called _.
Hashset
List
Set
Arraylist
13
What is an abstract class?
A special method that is used to initialize objects
Designed to be used as a base class and cannot be directly instantiated
The process in which a function calls itself directly or indirectly
A data type that holds one single character
14
What is deadlock?
Overrides your current thread and immedietly runs the new thread
Is a situation where one thread is waiting on a second thread
A process used to stop running your code at line 25 everytime
Locks your code from being used from any outside source
15
What is a String?
A sequence of only numeric numbers
A sequence of chars
A string of methods within a class
Smaller version of rope
16
What is == ?
Can be overridden to give you a specific test for meaningful equality
Is a method of the base object class that all java objects are derived from
Is an object that can be used to loop through collections
A binary operator used to compare primitives and objects
17
How would I fetch the value from the HashMap for key="testKeyTwo"?
testHashMap.get("testKey");
testHashMap.get(2);
testHashMap.get("testKeyTwo");
testHashMap.get("testKeyTwo", 2);
18
Classes that are relating to each other through inheritance, and uses those methods to perform different tasks is called
Abstraction
Inheritance
Encapsulation
Polymorphism
19
What is multithreading?
Multiple amounts of thread in a method
Threading multiple times within code
A process of executing multiple threads simultaneously
A thread that can exist only in two states, running and blocked
20
Which of these is a heading of a class return method?
public String howdy()
public static void howdy()
public void howdy()
public static String howdy()
21
Private class memebers can be accessed _.
in Narnia
in the same class
in the same file
anywhere
22
Public members can be accessed _.
anywhere
in the same file
in Rivendell
in the same class
23
What does JDK stand for?
Java Development Kit
Java Deployment Kit
Java Data Kit
Java Driver Kit
24
In Java, what is stored on the heap?
Arrays
Classes
Methods
Calls
25
Difference between HashMap and HashTable code?
Hash Table stores data in key value pair while HashMap does not
HashMap does guarantee the order, Hash Table does not
HashMap class is non synchronized and permits nulls, Hash Table does not
There are no differences between the two
26
What is the difference between set and list?
List is an ordered sequence of elements/Set is a list of elements unordered
Set is an ordered sequence of elements/List is a list of elements unordered
27
What is Equals Method?
Is a method of the base object class that all java objects are derived from
Compares reference or memory location of objects in a heap
It's actually an operator and not a method
Is a block of code which only runs when it is called
28
What is a char?
Serve as the building blocks of data manipulation
A data type that has a lot of character
A data type that holds multipe characters
A data type that holds one single character
29
What is a Constructor?
A special method that is used to initialize objects
Is an object that can be used to loop through collections
Is a completely "abstract class", used to group methods with empty bodies
Is an ordinary member function of a class
30
The containment and hiding of information about an object is called _.
Abstraction
Encapsulation
Polymorphism
Inheritance
31
Members of a class that can be accessed by anyone is called _.
Public
Private
Protected
Default
32
The main reason to have a Constructor is _.
General usefulness
Readability
Initializing attributes
Starting things
33
Maps that link a key to a value and may have duplicate keys but cannot have duplicate values are a _.
Keymap
Mapkey
Collection
Hashmap
34
What Java keyword do we use to instantiate or construct an object?
int
static
new
create
35
Can you override the constructor?
False
True
36
A concept where a child class can access the methods of a parent class is called _.
Inheritence
Polymorphism
Encapsulation
Abstraction
37
What does finally do?
Does not define code that is always running after the try and catch block
A block that never stops running
A block that finishes your code for you
Always executes when the try block exits
38
Method of hiding the implementation details and showing only the functionality(essentials) is called _.
Abstraction
Polymorphism
Encapsulation
Inheritance
39
Can you instantiate an object from an interface or abstract class?
False
True
40
Is a string mutable or immutable?
A string is immutable
A string is mutable
41
Does Hash Table allow null values?
False
True
42
An ordered Collection that may contain duplicates
Node
Set
Array
List
43
Encapsulation is achieved by combining which of the following into a class
Methods and Attributes
None of the above
Object and Attribute
Methods and Objects
44
What are primitive data types?
A data type that holds one single character
Serve as the building blocks of data manipulation in Java
The main data type for Java
A data type that is made of prime numbers
45
A constructor has the same name as the class.
False
True
46
Members of a class are accessible only within the class itself and are not inherited would be called _.
Private
Public
Default
Protected
47
What is an Interface?
Is a 100% abstract class, it is a collection of abstract methods
A data type that holds one single character
A special method that is used to initialize objects
The process in which a function calls itself directly or indirectly
48
Which of these could be a header for a Constructor?
public Howdy()
private Howdy()
public void Howdy()
private String Howdy()
49
A getter method always returns a value
False
True
50
Which polymorphism concept is applied to inheritance relationship in java programming?
Constructor Overloading
Method Overriding
Method Overloading
None of them
51
What is a HashMap?
Is an array of a list
Is an object that can be used to loop through collections
Are used to store multiple values in a single variable
Is a class that implements an interface
52
Also known as package level this means that it is visible to all within a particular package, this is called _.
Protected
Public
Default
Private
53
Which of these is a heading of an object return method?
public static void howdy()
public static String howdy()
public String howdy()
public void howdy()
54
Members are accessible by the class itself, classes in the same package and subclasses in other packages is called _.
Private
Default
Public
Protected
55
What is the default value of float, byte, and boolean?
Float(0.0f), Byte(False), Boolean(null)
Float(0), Byte(0.0b), and Boolean(false)
Float(0.0f), Byte(0), Boolean(false)
Float(null), Byte(0), Boolean(true)
56
Which of these is a heading of a class void method?
public static String howdy()
public void howdy()
public String howdy()
public static void howdy()
57
What is an abstract variable?
There is no implementation of a variable so it can’t be abstract
A variable that is inside of an abstract class
A variable that is only accessible within the declared class
A variable that is called from an Interface
58
What is a Map?
Is an object that can be used to loop through collections
Is a class that implements that interface
Is an interface specified in the Java collections framework
Is an array of a list
59
What is an Exception?
A certain statement or block of statements that are executed
Allows an exception for code to run, even though there may be a bug
An event that disrupts the normal flow of program's instructions
When JDK removes any code not being used
60
Which of the following is true about Heap?
Garbage collection is done on heap memory
All of the above
Objects created on heap are accessible globally
JRE uses it to allocate memory for objects and JRE classes
61
Which is true about Getters and Setters?
Retrieves code information and stores it away from being seen or retrieved
Used to protect your data
Used to show your data
Gets your class and sets it
62
Get methods should be used to _.
create new numbers
set values for private attributes
get a pizza
return values from private attributes
63
Public and Private are known as _.
Optional Modifiers
Access Modifiers
Reference Modifiers
Privacy Settings
64
Each hash table array element is called a _.
Bucket
Node
Basket
Bullet
65
What is a Class?
Form of states and behaviors
It's just part of Java
A block of code which only runs when it is called
A template/ blueprint that describes the behavior of an object
66
What is Garbage collection?
Will check for missing code and throw an error in the console
A person that collects garbage on specific times of the week
Identify and discard all objects
Automatically identify unused objects and discard them
67
What are the new features introduced in java 8?
Lambda expression- adds functional processing capability to Java
Method references- referencing functions by their names
All of the above
Default method- interface to have default method implementation.
68
What is finalize?
The method that is called just before an object is garbage collected
The last line typed in your code
Finalizes your code by checking for any bugs
A method that is called just after an object is garbage collected
69
There can only be one . . . Constructor per class.
True
False