1. Mention the storage classes names in C++.
A class with at least one pure virtual function is called as abstract class. We cannot
instantiate (to call a constructor of a Class which creates an an instance
or object, of the type of that Class) an abstract class.
2. What is an abstract class in C++? A class with at least one pure virtual function is
called as abstract class. We cannot instantiate (to call a constructor of a Class
which creates an an instance or object, of the type of that Class) an
abstract class.
3. What are the main differences between C and C++? C and C++ share many
similarities in terms of their syntax, compilation, and basic memory. However, there
are a few key differences between the two languages:
C is a procedural programming language, whereas C++ is a multi-paradigm language
that supports procedural programming as well as other programming philosophies
C does not support object-oriented programming concepts like polymorphism and
encapsulation, unlike C++.C++ supports several new features like namespace,
reference variable functionality, operator overloading, and function overloading
1. What are the main characteristics of C++ as a programming language? C++ is a
general-purpose programming language, which means it supports software in a wide
variety of application domains.
It’s also considered a multi-paradigm programming language, which means it supports
object-oriented, procedural, functional, and generic programming frameworks.
Other notable characteristics are its portability, power, and complexity, which makes it one of
the more difficult programming languages to learn.
1. What is a class in C++? Classes are the fundamental building blocks of object-
oriented programming in C++. They are a user-defined data type representing a group
of related objects. Classes hold member functions and variables together.
2. What are the strengths of C++? C++ has many strengths, including:
Portability: C++ programs can be used across different operating systems
Multi-paradigm frameworks: C++ offers great programming flexibility, supporting
object-oriented, generic, and procedural programming frameworks
Scalability: C++ is a powerful programming language that can be used to create
resource-intensive programs as well as simpler, low-level programs
3. What are the weaknesses of C++? There are a few drawbacks to using C++. These
include:
Its steep learning curve: C++ is a challenging programming language to learn,
especially for junior developers
Security: The presence of pointers and global variables in C++ pose a relatively high
security threat
Memory management: Manual memory allocation can be time-consuming
Pointers: Pointers are complex and will disrupt performance if implemented
incorrectly
4. How is memory managed in C++? C++ supports dynamic memory, which means
memory must be managed manually by the user rather than automatically with a
garbage collector feature. Memory is allocated and deallocated dynamically using the
‘new’ and ‘delete’ operators respectively.
5. What are the different types of variables in C++? Variable types determine the size
and layout of the variable’s memory, the values that can be stored within that memory,
and the operations that can be applied to the variable. Some of the main variable types
in C++ are:
char: stores single characters
int: stores integers
float: stores floating-point values
double: stores floating-point values with twice as much precision as float
void: represents the absence of a type
bool: stores a value that is either ‘true’ or ‘false’
6. What is namespace in C++? A namespace is a declarative region that allows entities
like classes, objections, and functions to be grouped under one name. This divides the
global scope into narrower sub-scopes, thereby preventing unwanted collisions.
7. How can C++ programs be optimized? There are several techniques for optimizing C++
programs, such as to:
Use better algorithms
Reduce memory allocation
Use better compilers
Use optimal data structures
Use multithreading
8. How is exception handling performed C++? Exception handling is the process of
separating code that deals with exceptional circumstances from the rest of the program. It’s
implemented using three keywords, which are often used together:
1. try identifies a block of code for which certain exceptions will be activated
2. catch catches an exception in the code
3. throw throws an exception when a problem is detected
9. What are the three types of access specifiers in C++? Access specifiers define how
the attributes and methods of a class can be accessed. The three types in C++ are:
1. Public: All class members can be accessed from anywhere in the program
2. Private: Class members can only be accessed by the member functions inside the
class
3. Protected: Class members can be accessed by the member functions inside the class
or by any subclass of that class
10. List the types of inheritance supported in C++.
Single (subclass can extend only one superclass to inherit its properties
and methods), Multilevel (includes the involvement of at least two or
more than two classes. One class inherits the features from a parent
class ), Multiple(the capability of creating a single class with multiple
super classes.( The class from which the subclass is derived)),
Hierarchical( inheritance of properties and methods from a single
superclass by multiple subclasses) and hybrid.
11. What are the main concepts of OOPs in Java?
Inheritance: Inheritance is a process where one class acquires the properties of
another.
Encapsulation: Encapsulation in Java is a mechanism of wrapping up the data
and code together as a single unit.
Abstraction: Abstraction is the methodology of hiding the implementation
details from the user and only providing the functionality to the users.
Polymorphism: Polymorphism is the ability of a variable, function or object to
take multiple forms.
12. What is the difference between a local variable and an instance variable?
In Java, a local variable is typically used inside a method, constructor, or a block and
has only local scope. Thus, this variable can be used only within the scope of a block.
Whereas, an instance variable in Java, is a variable which is bounded to its object
itself. These variables are declared within a class, but outside a method. Every object
of that class will create it’s own copy of the variable while using it.
13. Differentiate between the constructors and methods in Java?
Methods Constructors
1. Used to represent the behavior of an
1. Used to initialize the state of an object
object
2. Must have a return type 2. Do not have any return type
3. Needs to be invoked explicitly 3. Is invoked implicitly
4. No default method is provided by the 4. A default constructor is provided by the compiler if
compiler the class has none
5. Method name may or may not be same 5. Constructor name must always be the same as the
as class name class name
14. What is Polymorphism? Polymorphism is briefly described as “one interface, many
implementations”. Polymorphism is a characteristic of being able to assign a different
meaning or usage to something in different contexts – specifically, to allow an entity such as a
variable, a function, or an object to have more than one form
15. What is collection class in Java? In Java, the collection is a framework that acts as an
architecture for storing and manipulating a group of objects. Using Collections you can
perform various tasks like searching, sorting, insertion, manipulation, deletion, etc.
16. What is inheritance in Java?
Inheritance in Java is the concept where the properties of one class can be inherited by the
other. It helps to reuse the code and establish a relationship between different classes.
Inheritance is performed between two types of classes:
1. Parent class (Super or Base class)
2. Child class (Subclass or Derived class)
A class which inherits the properties is known as Child Class whereas a class whose
properties are inherited is known as Parent class.
[Link] are the different types of inheritance in Java?
Single Inheritance: In single inheritance, one class inherits the properties of another i.e there
will be only one parent as well as one child class.
Multilevel Inheritance: When a class is derived from a class which is also derived
from another class, i.e. a class having more than one parent class but at different
levels, such type of inheritance is called Multilevel Inheritance.
Hierarchical Inheritance: When a class has more than one child classes (subclasses)
or in other words, more than one child classes have the same parent class, then such
kind of inheritance is known as hierarchical.
Hybrid Inheritance: Hybrid inheritance is a combination of two or more types of
inheritance.
[Link] is method overloading? In Method Overriding, the subclass has the same method
with the same name and exactly the same number and type of parameters and same return type as a
superclass.
Method Overriding is to “Change” existing behaviour of the method.
It is a run time polymorphism.
The methods must have the same signature.
It always requires inheritance in Method Overriding.
[Link] is method overriding? In Method Overloading, Methods of the same class shares the
same name but each method must have a different number of parameters or parameters having
different types and order.
Method Overloading is to “add” or “extend” more to the method’s behaviour.
It is a compile-time polymorphism.
The methods must have a different signature.
It may or may not need inheritance in Method Overloading.
17. Name some Linux Distros? There are various Linux distros but the following
are the most commonly used:
Ubuntu
Debian
CentOS
Fedora
RedHat
18. Define the basic components of Linux? Majorly there are five basic components
of Linux:
Kernel: Linux kernel is a core part of the operating system that works as a
bridge between hardware and software.
Shell: Shell is an interface between a kernel and a user.
GUI: Offers different way to interact with the system, known as the
graphical user interface (GUI).
Application programs: It is designed to perform a bundle of tasks
through a bundle of functions.
System Utilities: It is the software functions through which users manage
the system.
[Link] all the file permission in Linux.
There are three types of file permissions in Linux :
Read: Users open and read files with this permission.
Write: Users can open and modify the files.
Execute: Users can run the file
19. Describe CLI and GUI in Linux? CLI, i.e., command line interface. It takes
input as a command and runs the tasks of the system. The term GUI refers to
the Graphical User Interface or the human-computer interface. It uses icons,
images, menus, and windows, which can be manipulated through the mouse.
20. What is the difference between hard links and soft links?
Hard Links Soft Links
It includes original content. It includes the original file location.
Hard links are faster as compared
Soft links are slower.
to soft links.
It shares similar inode numbers. It shares different inode numbers.
There is no relative path for hard
Relative paths are used for soft links.
links.
Hard Links Soft Links
It didn’t link the directories. It links the directories.
Any change in this link reflects Every change in this link reflects its hard link
other files directly. and the actual file directly.
It uses less memory. It uses more memory.
21. What is root account? The root is like the user’s name or system administrator
account in Linux. The root account provides complete system control, which
an ordinary user cannot do.
22. What is shell in Linux? In Linux, five Shells are used:
csh (C Shell): This shell offers job control and spell checking and is
similar to C syntax.]
ksh (Korn Shell): A high-level shell for programming languages.
ssh (Z Shell): This shell has a unique nature, such as closing comments,
startup files, file name generating, and observing logout/login watching.
bash (Bourne Again Shell): This is the default shell for Linux.
Fish (Friendly Interactive Shell): This shell provides auto-suggestion,
web-based configuration, etc.