Home / Computer Science / Interview Stuff / Questions & Answers for Interviews

Questions & Answers for Interviews

Q1).State the different types of linked lists?

ANS). The different types of linked list includes, single linked list, double linked list and circular linked list.

Q2).List the basic operations carried out in a linked list?

ANS). The basic operation carried out in a linked list includes

*creation of a list
*insertions of a node
*declaration of a node
*modification of a node
*traversal of the list.

Q3). State the contents of a data field and a linked field in a linked list?

ANS). The data field contains the information and the link field or the next address field contains the address of the next node in the list.

Q4). Define a stack?

ANS) A stack is an ordered collection of elements in which insertions and deletions are restricted to one end. The end from which elements are added and/or removed is referred to as top of the stack. Stacks are also referred as “piles” and “push-down lists.

Q5) Define a queue?

ANS). a queue is an ordered collection of elements in which insertions and deletions are restricted to one end. The end from which elements are added and /or removed is referred to as to as the rear end, the end from which deletions are made is referred to as the front end.

Q6) State the differences between arrays and linked list?

ANS) Arrays: Size of any array is fixed . it is necessary to specify the number of elements in an array during declaration.
Insertion and deletions are difficult in an array.
It occupies less memory than a linked. List for the same number of elements.

Linked Lists:

Size of list is variable .it is not necessary to specify the number of elements in during declaration.
Insertions and deletions are carried out easily.
It occupies more memory.

Q7) State the difference between stacks and linked lists?

ANS) The difference between stacks and linked lists is that insertions and deletions may occur any where in a linked list but only at the top of the stack.

Q8) State the difference between queues and linked lists.

ANS) The difference between queues and linked lists in insertions and deletions may occur any where in a linked lists but queues insertions can be made only in the rear end and deletions can be made only in the front end.

Q9)State the difference between a structure in C and C++?

ANS).C Language structure: It can have only variables as members.
They do not permit data hiding. They do not allow the datatype to be treated as built in types.

C++structure : It can have both variables and functions as members. They permit data hiding.
They allow the structure data type to be treated as built-in types.

Q10)State the difference between a structure and class in c++?

The only difference between a structure and class in c++ is that by default , the members of a class are private while , by default the members of a structure are public.

Q11)State the difference between procedural and object oriented programming?

ANS) Procedural programming focus on functions and data separately whereas object oriented programming ties data and functions to gather into object FOCUSES ON the interaction among the objects.

Q12).what does the following preprocessor directive #includedo ?

ANS)It causes the contents of the iostream .h file to be substituted for this directive before final compilation.

Q13)What are member variables?

ANS) Variables of a class are called as member variables or data members.

Q14) What are member function?

ANS) The functions declared inside a class are called as number functions.

Q15). Can member data and member functions can be private?

ANS) Yes both member data and members functions can be private.

Q16) State the difference between a public and a private member of a class?

ANS)A public member is accessible from outside the class where as a private member cannot be accessed from outside the class.

Q17) What is the dot operator, and what is used for ?

The operator is the period operator, which is used to access the member of the class.

Q18) What is meant by data hiding?

Insulation of data from direct access by the program is called data hiding.

Q19)What is encapsulation?

ANS)The process of combining data and functions in a single unit is called as encapsulation.

’Q20)Which member functions are created automatically if they are not including in the class definition?

ANS),There are four class member functions that are created automatically .

they are

Default constructor

Copy constructors

Overload assignment operator

Destructor

Q21)What is the main use of constructors?

ANS)Constructors are used for initializing member data in class.

Q22). What is the main use of destructors?

ANS)Destructors are used for reinitializing the objects which are initialized by constructors.

About Santosh Kumar Gadagamma

I'm Santosh Gadagamma, an Experienced Software Engineer passionate about sharing knowledge in technologies like Java, C/C++, DBMS/RDBMS, Bootstrap, Big Data, Javascript, Android, Spring, Hibernate, Struts, and all levels of software design, development, deployment, and maintenance. I believe computers are essential for the world's functioning, and I'm committed to helping others learn the skills they need to succeed in tech. My website is a valuable learning tool to help you reach greater heights in your education and career, and I believe that education has no end points.

Check Also

DAX Interview Questions

These are the mostly asked DAX Interview questions in and Power BI developer Interviews for …