Object-Oriented Programming Flashcards

(97 cards)

1
Q

a methodology or paradigm to design a program using classes and objects

A

Object-Oriented Programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Any entity that has state and behavior is known as an ?

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A _________ is a template that is used to create objects, and to define object data types and methods. Core properties include the data types and methods that may be used by the object

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A ________can also be defined as a blueprint from which you can create an individual object. _______ doesn’t consume any space.

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Advantages of OOPs over Procedure Oriented Programming

A
  • Makes development and maintenance easier as the code increases in size.
  • provides data hiding, wheres with POP data is stored globally
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A _____is a blueprint from which individual objects are created.

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

a ___________is a block of codes similar to the method. It is called when an instance of the object is created, and memory is allocated for the object.

It is a special type of method which is used to initialize the object.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Rules to remember while creating a constructor

A
  • Constructor name must be the same as its class name
  • A Constructor must have no explicit return type
  • A Java constructor cannot be abstract, static, final, and synchronized
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Two Types of Constructors

A
  1. Default
  2. Parameterized
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The __________constructor is a no-args constructor that the Java compiler inserts on your behalf

A

default

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A constructor which has a specific number of parameters is called a ____________constructor.

A

parameterized

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The _______________constructor is used to provide different values to the distinct objects.

A

parameterized

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A ___________is used to initialize the state of an object.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

______________________ in Java is a technique of having more than one constructor with different parameter lists. They are arranged in a way that each constructor performs a different task. They are differentiated by the compiler by the number of parameters in the list and their types.

A

Constructor overloading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A _____________is used to expose the behavior of an object.

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A ___________ must not have a return type.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The ___________is invoked implicitly.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

A _________must have a return type.

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The Java compiler provides a _____________ if you don’t have any constructor in a class

A

default constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The __________is invoked explicitly.

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

The ________ is not provided by the compiler in any case.

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The _____________ name must be same as the class name.

A

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The _____________ name may or may not be same as class name.

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The Four Pillars of OOP

A
  1. Inheritance
  2. Polymorphism
  3. Encapsulation
  4. Abstraction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
_________ in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of OOPs
Inheritance
26
When you ________ from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also.
inherit
27
The idea behind ______________ in Java is that you can create new classes that are built upon existing classes.
inheritance
28
Inheritance represents the ____ relationship which is also known as a parent-child relationship.
IS-A
29
Advantages of Inheritance
1. Method Overriding (so runtime polymorphism can be achieved). 2. Code Reusability.
30
________ is a class which inherits the other class. It is also called a derived class or extended class
Sub Class/Child Class
31
______________ is the class from where a subclass inherits the features. It is also called a base class.
Super Class/Parent Class
32
____________ is a mechanism which facilitates you to reuse the fields and methods of the existing class when you create a new class. You can use the same fields and methods already defined in the previous class.
reusability
33
Programmer is the subclass and Employee is the superclass. The relationship between the two classes is Programmer ______ Employee. It means that Programmer is a type of Employee.
IS-A
34
Type of inheritence: Class A is parent class of class B
Single
35
Type of inheritence: Class A is a parent class of class B and class C
Heirarchical
36
Type of Inheritence: Class A is parent of Class B, Class B is parent of Class C
Multilevel
37
Class A and Class B are parents of Class C
Multiple
38
Class A is a parent Class of Class B and class C; Class of Class B and class C are parents of Class D
Hybrid
39
To reduce the complexity and simplify the language, ________ inheritance is not supported in java.
multiple/hybrid
40
Problem with multiple inheritence:
Ambiguity: If A and B classes have the same method and you call it from child class object, there will be ambiguity to call the method of A or B class.
41
____________ is the ability of an object to take on many forms. The most common use of ____________ in OOP occurs when a parent class reference is used to refer to a child class object.
Polymorphism
42
Any Java object that can pass more than one _____ test is considered to be polymorphic
IS-A
43
True or False: In Java, all Java objects are polymorphic since any object will pass the IS-A test for their own type and for the class Object.
True
44
If a class has multiple methods having same name but different in parameters, it is known as _______________.
Method Overloading
45
If we have to perform only one operation, having same name of the methods increases the ___________ of the program.
readability
46
Two Types of Overloading
1. Changing number of arguments 2. Changing the data type (ie string to int)
47
True of False: Method overloading is not possible by changing the return type of the method.
true
48
True or False: You can have any number of main methods in a class by method overloading.
True
49
True or False: In Java, not all Java objects are polymorphic even though any object will pass the IS-A test for their own type and for the class Object.
False
50
True of False: Method overloading is possible by changing the return type of the method.
False
51
If subclass (child class) has the same method as declared in the parent class, it is known as ___________ in Java
method overriding
52
_______________ in Java is a process of wrapping code and data together into a single unit
Encapsulation
53
Advantages of Encapsulation
1. By providing only a setter or getter method, you can make the class read-only or write-only 2. control over the data -- Suppose you want to set the value of id which should be greater than 100 only, you can write the logic inside the setter method. 3. data hiding 4. easy to test
54
The ___________ class is the example of a fully encapsulated class.
Java Bean
55
The Four Access Modifiers
1. private 2. default 3. protected 4. public
56
Properties of a Private Access Modifier
accessible within class
57
Properties of a default Access Modifier
accessible within class and within package
58
Properties of a protected Access Modifier
accessible within class, within package, and outside of class by subclass only
59
Properties of a public Access Modifier
accessible within class, within package, outside of class by subclass only, and outside of package
60
___________ is a process of hiding the implementation details and showing only functionality to the user.
Abstraction
61
______________ lets you focus on what the object does instead of how it does it.
Abstraction
62
________________ is the process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. Shared characteristics can be attributes, associations, or methods.
Generalization
63
_______________ means creating new subclasses from an existing class. If it turns out that certain attributes, associations, or methods only apply to some of the objects of the class, a subclass can be created.
Specialization
64
The two ways to achieve abstraction in java:
1. Abstract class (0 to 100%) 2. Interface (100%)
65
Rules of an Abstract Class
1. An abstract class must be declared with an abstract keyword. 2. It can have abstract and non-abstract methods. 3. It cannot be instantiated. 4. It can have constructors and static methods also. 5. It can have final methods which will force the subclass not to change the body of the method.
66
True or False: A method which is declared as abstract and does not have implementation is known as an abstract method.
True
67
The ___________ keyword in Java is used for memory management mainly. We can apply java [same word] keyword with variables, methods, blocks and nested class. The [same word] keyword belongs to the class than an instance of the class.
static
68
The ____________ keyword in java is used to restrict the user.
final
69
a final variable that have no value it is called _______ final variable or __________ final variable.
blank, uninitialized
70
Tables can have hundreds, thousands, sometimes even millions of rows of data. These rows are often called __________.
records
71
A ______________ is a collection of information that is organized so that it can be easily accessed, managed and updated.
database
72
A _________ uses a structure that allows us to identify and access data in relation to another piece of data in the database.
Relational Database
73
True or False: Often, data in a relational database is organized into tables.
True
74
___________ are labeled with a descriptive name (say, age for example) and have a specific data type.
Columns
75
A ________________ is a program that allows you to create, update, and administer a relational database.
relational database management system (RDBMS)
76
True or False: Most relational database management systems use the SQL language to access the database.
True
77
_____________________ is a programming language used to communicate with data stored in a relational database management system.
SQL (Structured Query Language)
78
SQL syntax is similar to the ____________, which makes it relatively easy to write, read, and interpret.
English language
79
__________ is a relational database management system and contains a minimal set of SQL commands (which are the same across all RDBMSs).
SQLite
80
A ____________ is a field in a table which uniquely identifies each row/record in a database table
primary key
81
True or False: A table can have only one primary key, which may consist of single or multiple fields
True
82
When multiple fields are used as a primary key, they are called a ______________.
composite key
83
2 Rules for Primary Keys
1. Primary keys must contain unique values. 2. primary key column cannot have NULL values.
84
True or False: If a table has a primary key defined on any field(s), then you cannot have two records having the same value of that field(s)
True
85
A ___________ is a key used to link two tables together. This is sometimes also called as a referencing key
foreign key
86
DDL - Data Definition Language
- CREATE, ALTER, DROP
87
DML - Data Manipulation Language
- SELECT, INSERT, UPDATE, DELETE
88
DCL - Data Control Language
- GRANT, REVOKE
89
TCL - Transaction Control Language
- SAVEPOINT, ROLLBACK, COMMIT
90
The SQL _________ statement is used to fetch the data from a database table which returns this data in the form of a result table. These result tables are called _________.
SELECT, result-sets
91
The SQL _____________ clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables.
WHERE
92
The SQL ____________ Statement is used to add new rows of data to a table in the database.
INSERT INTO
93
Different Types Of Joins: INNER JOIN
the space inside the venn diagram
94
The SQL ________ clause is used to combine records from two or more tables in a database. A _______ is a means for combining fields from two tables by using values common to each.
JOIN
95
Different Types Of Joins: LEFT JOIN
all of the first table, and where it overlaps with the right
96
Different Types Of Joins: RIGHT JOIN
all of the second (right table) and where it overlaps with the left.
97
Different Types Of Joins: FULL JOIN
both full tables