100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Data Structures and Algorithms in Java Exam Questions with Verified Solutions Graded A+

Rating
-
Sold
-
Pages
3
Grade
A+
Uploaded on
14-11-2024
Written in
2024/2025

Data Structures and Algorithms in Java Exam Questions with Verified Solutions Graded A+ Public, private, protected - Answers Private: only the class in which it is declared can see it; Protected: can only be seen and used by the package in which it was declared and can be seen by subclasses or package members; Public: Everyone can see it Different types of loops - Answers For, while, if What is inheritance? - Answers Inheritance is a mechanism in which one object acquires all the properties and behavior of another object of another class. It represents IS-A relationship. It is used for Code Reusability and Method Overriding. What does super mean? - Answers A reference variable that is used to refer parent class objects. Used in derived classes. Used to call parent methods. Used to access parent class constructor. What does static mean? - Answers variable or function is shared between all instances of that class. Belongs to the type, not the actual objects themselves What is an anonymous class? Why can't we write a constructor for an anonymous class? - Answers An anonymous class is a local class without a name. It is defined and instantiated in a single succinct expression using the 'new' operator. Since an anonymous class has no name it's not possible to write a constructor. We must instead use a local class or an instance initializer. How to write a class that implements an interface - Answers public class X implements YInterface What is a set? - Answers A set is a standard generic data type that uses an array data structure. Collection extends set. What is a linked list? - Answers A linear data structure with a node class that has nodes connected by pointers. Linked lists should have iterators What are instance variables? - Answers An instance variable is a variable which is related to a single instance of a class. Each time an instance of a class is created, the system creates one copy of the instance variables related to that class. An instance variable is declared inside a class, but not within a method. A variable which is defined inside a class and a method is known as a local variable. The opposite of an instance variable is a static variable. A static variable exists across instances of a class. By default, all variables are created as instance variables. What is a constructor? - Answers This is a special method used to instantiate objects of a particular class. It is used in conjunction with the new operator. It initializes an object immediately upon creation. Once defined, it is called immediately after the object is created. When a new instance of the class is created, the constructor is called. What are the four principles of object oriented programming? - Answers Abstraction, encapsulation, inheritance, polymorphism What is a map? - Answers Data structure used for fast lookups. Stores information in key value pairs. Its implementations in Java are HashMaps and HashTables What is the difference between a shallow and deep copy? - Answers A deep copy co

Show more Read less
Institution
Data Structures And Algorithms In Java
Course
Data Structures and Algorithms in Java








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Data Structures and Algorithms in Java
Course
Data Structures and Algorithms in Java

Document information

Uploaded on
November 14, 2024
Number of pages
3
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Data Structures and Algorithms in Java Exam Questions with Verified Solutions Graded A+

Public, private, protected - Answers Private: only the class in which it is declared can see it; Protected:
can only be seen and used by the package in which it was declared and can be seen by subclasses or
package members; Public: Everyone can see it

Different types of loops - Answers For, while, if

What is inheritance? - Answers Inheritance is a mechanism in which one object acquires all the
properties and behavior of another object of another class. It represents IS-A relationship. It is used for
Code Reusability and Method Overriding.

What does super mean? - Answers A reference variable that is used to refer parent class objects. Used in
derived classes. Used to call parent methods. Used to access parent class constructor.

What does static mean? - Answers variable or function is shared between all instances of that class.
Belongs to the type, not the actual objects themselves

What is an anonymous class? Why can't we write a constructor for an anonymous class? - Answers An
anonymous class is a local class without a name. It is defined and instantiated in a single succinct
expression using the 'new' operator. Since an anonymous class has no name it's not possible to write a
constructor. We must instead use a local class or an instance initializer.

How to write a class that implements an interface - Answers public class X implements YInterface

What is a set? - Answers A set is a standard generic data type that uses an array data structure.
Collection extends set.

What is a linked list? - Answers A linear data structure with a node class that has nodes connected by
pointers. Linked lists should have iterators

What are instance variables? - Answers An instance variable is a variable which is related to a single
instance of a class. Each time an instance of a class is created, the system creates one copy of the
instance variables related to that class. An instance variable is declared inside a class, but not within a
method. A variable which is defined inside a class and a method is known as a local variable. The
opposite of an instance variable is a static variable. A static variable exists across instances of a class. By
default, all variables are created as instance variables.

What is a constructor? - Answers This is a special method used to instantiate objects of a particular class.
It is used in conjunction with the new operator. It initializes an object immediately upon creation. Once
defined, it is called immediately after the object is created. When a new instance of the class is created,
the constructor is called.

What are the four principles of object oriented programming? - Answers Abstraction, encapsulation,
inheritance, polymorphism

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.
TutorJosh Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
332
Member since
1 year
Number of followers
16
Documents
28211
Last sold
1 day ago
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3.6

53 reviews

5
18
4
14
3
12
2
0
1
9

Recently viewed by you

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

Frequently asked questions