Java OOP interview questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Inheritance is carried out with the keyword ___.

"extends" placed in the subclasses definition

What is the sibling selector operator?

+

How many access modifiers are there in Java? What are they?

3 - public, private, protected. They control the permissions that other objects have to call these variables, methods, or classes.

In CSS, what symbol is used for immediate children?

> (example: div > p means only the first p within all div elements)

What is a Transaction in SQL?

A group of statements that will be executed as one (atomically)

In SQL what is an inner join?

A join that combines a left and right tables values which both meet specific conditions.

In SQL what is a left join? Right Join?

A join that combines a left table's values with some of the right tables values which match a specific condition. Right join is the opposite.

What is abstraction?

A principle in object oriented programming where you simplify complex systems to be usable by other systems that don't need to know how it works.

In SQL, what is a join?

An operation the combines the results of two tables.

What do we call using more than one column as the primary key?

Composite key

What are the three sublanguages of SQL?

DDL - Data Definition Language (create, alter, drop), DML -Data Manipulation Language (select, insert, update, delete = CRUD operations), and TCL - Transaction Control Language ()

What is polymorphism?

Describes the fact that a subclass IS AN instance of the super class as well, and can be treated as such. The fact that many subclasses can take on their own forms but can still be treated as being the same general superclass type, is polymorphism. Subclasses can override public and protected parent methods to give themselves unique behavior. Polymorphism also refers to classes that implement interfaces, as they are treated as being all of the same type.

What do you call when a column refers to a primary key column of another table?

Foreign key

What is the static keyword for?

In Java, if a field is declared static, then exactly a single copy of that field is created and shared among all instances of that class. In fact, the keyword is accessible even without any instances of the class.

What SQL type allows for variable length of characters?

VARCHAR

What is the keyword "final" used for?

Variables that can't be changed, methods that can't be overridden, or classes that can't be extended.

What is meant by overriding methods?

When subclass redefines it's own version of a method that was originally defined in the superclass.

Can interfaces extend other interfaces?

Yes

How do you define an interface?

Just like a class, but with the keyword interface instead.

What is an RDBMS?

Like Microsoft SQL Server or MySQL

What are interfaces in Java?

Like a compiler-enforced contract used to guarantee the availability of methods classes that implement an interface.

What is a protected member?

Members are only accessible from any class within the same package or any subclass from any package.

Can a subclass directly access PRIVATE instance variables from its parent class?

No

Do linked lists have indexes?

No

Can interfaces extend a class?

No, they are totally different things.

Can interfaces implement other interfaces?

No. That would mean an interface would need a concrete implementation for a method, which it can't have.

How many classes can a class extend?

Only one

Explain the private modifier. Who has access?

Private members are only accessible from within the class it is defined in.

Which access levels are allowed at the Class level?

Public and no modifier/default (package-level) only. NOT private or protected.

A full join?

Returns all records from both tables

What are data structures designed to do?

Standardized patterns of code for organizing one or more variable. Ex: Arrays

What datatypes are used in javascript?

String, Number, Boolean, Object

What SQL type represents a combination of data and time?

TIMESTAMP

What access is set by default when you don't use access modifiers?

The default level of access means all classes of the same package have access to these members.

Define encapsulation in OOP.

The protecting of variables from outside influence by declaring them as private. They can only be accessed by methods created for them, such as setters and getters.

A class can implement multiple interfaces. T or F?

True

All non-abstract classes must have their own version of the methods from the interface which it implements. T or F?

True

Linked list nodes hold references for its neighbors. T or F?

True

Methods and Variables support all modifiers. T or F?

True

Objects generally have states and behaviors. T or F?

True

Typically you should use the most restricted access level. T or F?

True

What do you call a column that can only consist of unique values such as email addresses, but isn't a primary key?

Unique Key

Name interfaces for ___ or ___.

adjectives or verbs (Domesticated, Runnable)

An overloaded method will have different types of ___ for each method definition.

parameters

Name some table constraints.

primary key, unique key, foreign key, not null, check (certain condition)

Common practice is for instance variables to ___ (private or public?).

private (with public methods to access them)

In interfaces, all methods are implicitly __.

public abstract

Inheritance gives subclasses access to parent's ___.

public and protected variables and methods

In interfaces, all variables are implicitly __.

public static final

What kind of inheritance is created with interfaces?

type-inheritance

What do you call using the superclass in the reference type and a subclass in the constructor? ex: Animal myDog = new Dog();

upcasting - this only gives you access to the Animal public and protected members, but not the subclasses public or protected members. (myDog an only use the Animal methods, not the Dog methods)

What's another word for a method's definition, which includes the access modifier, return type, methodName, parameters and exceptions?

method signature


Kaugnay na mga set ng pag-aaral

SOPHIA Human Biology Unit 2 Challenge 2: Skeletal Muscles

View Set

Chapter 3 Inflammation and Tissue Repair

View Set

Ch.2 The Market System and the Circular Flow

View Set

Society The Basics: Gender Stratification

View Set

ATI- Professional Communication: Types of Communication

View Set

ASSESSMENT PRACTICE QUESTIONS FINAL CHAPTERS

View Set