Hot Topics
CTS Solution
Technical Round
- Question 1
What are the types of Inheritance?
- Answer
There are three types of Inheritance in Java. They are:
Single Inheritance: In single inheritance child class have access to the data members of its parent class.
Multilevel Inheritance: In multilevel inheritance child class inherits from its parent class as well as parent class acts as a child class to some other parent class
Hierarchical Inheritance: In hierarchical inheritance parent class can be accessed by more than one child class.
- Question 2
What is the difference between an object and a class?
- Answer
Object | Class |
1. A object is the reality of class | A class is a blueprint of similar types of objects |
2. Object can be created as many number of times as you want | Class has to be created only once at first |
3. Object takes physical space or memory space | Class does not take any physical or memory space |
4. Object has to be defined with the new keyword in front of class name | Class in defined with the class keyword |
- Question 3
Where is python used in real world?
- Answer
Python in real world is used in:
Machine Learning and AI
Data Analytics
Game Development
IoT
Application Development
- Question 4
What is a database index?
- Answer
It is a mechanism to improve database performance through reducing the number of disk access when a query runs. An index is a form of data structure.
- Question 5
Similarity between inheritance and polymorphism.
- Answer
Inheritance and polymorphism are related concepts in Object-Oriented Programming (OOP).
Inheritance refers to the ability of a new class to inherit the attributes and methods of an existing class. This allows for the creation of new classes based on existing ones, promoting code reusability and modularity.
Polymorphism refers to the ability of an object to take on multiple forms. It allows for objects of different classes to be used interchangeably in the same context, as long as they implement the same methods. This promotes the use of objects based on their interface, rather than their implementation.
Both inheritance and polymorphism contribute to the fundamental principles of OOP, including encapsulation, abstraction, and modularity. Inheritance enables code reuse and polymorphism allows for flexible and dynamic behavior, making it easier to create flexible and maintainable software.
- Question 6
What is the difference between class and structure?
- Answer
Class | Structure |
1. Class are of reference types. | Structure is of value types. |
2. Class is generally used in large programs. | Structure are used in small programs. |
3. Classes can contain constructor. | Structure does not contain parameter less constructor or destructor, but can contain parameterized constructor or static constructor. |
4. All the reference types are allocated on heap memory. | All the value types are allocated on stack memory. |
5. The data member of a class can be protected. | The data member of struct can’t be protected. |
- Question 7
What is a destructor?
- Answer
A destructor works as a garbage collector which is automatically called once the life cycle of an object ends.
- Question 8
Define what is an object.
- Answer
An object is the reality of the class after creation of which we can access the data members and member functions of the classes. Object memory will be occupied separately.
- Question 9
How can we access private and protected members of a class?
- Answer
In Java if a class contains private data member then to access that private data member at least one public method.
In case of protected member we can have child class object or else a public method.
- Question 10
Do all HTML tags come in pair?
- Answer
No all HTML tags does not come in pair, they are often referred as self-closing tag. Example: <br/>,<link/>,etc.
- Question 11
What are the advantages of CSS?
- Answer
Advantages of CSS are:
CSS plays an important role to style same kind of elements without repeating same code and thus helping us to achieve DRY code.
It helps in maintenance of a website by making it easy and reducing maintenance time.
Changes in CSS can make a website device friendly and thus making the site responsive.
It is less complex.
- Question 12
What is the difference between HTML element and tags?
- Answer
HTML tags starts with < and ends with > and whatever expression is written inside the HTML tag is called HTML element.
Example:
HTML tag – <h1></h1>
HTML element – <h1>Hello World! </h1>
- Question 13
Can you handle the exception in C++?
- Answer
Yes, just like any other object oriented programming language we can also handle exception in C++ using three keywords: try, catch & throw.
- Question 14
What is the Standard Template Library?
- Answer
Standard Template Library is a combination of containers, functions, algorithms in a minimized format so that we don’t have to write big chunks of code again and implement it within no time.