0% found this document useful (0 votes)
12 views5 pages

Data Structures and OOP Concepts Explained

Uploaded by

Shravan Madnur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

Data Structures and OOP Concepts Explained

Uploaded by

Shravan Madnur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. What is data structure?

Ans: a data structure is a specialized format for organizing and storing data
2. What are primitive data structures?
Ans: integer, floating point, character and pointer
3. Define an array
Ans: array is a collection of homogeneous data items under the same name
4. What is traversal?
Ans: the process of accessing each data item exactly once to perform some operation is called
traversing
5. What is searching? Mention any two searching techniques
Ans: the process of finding the location of a data item from the given collection of data items is called
searching
Ex: linear search and binary search
6. What is sorting?
Ans: the process of arrangement of data items in ascending or descending order is called sorting
7. What is merging?
Ans: the process of combining the data items of two structures to form a single structure is called
merging
8. What is stack?
Ans: a stack is an ordered collection of items where the addition of new items and the removal of
existing items always take place at the same end. This technique uses LIFO principle
9. What are the applications of stacks?
Ans: - stack is used to reverse a word
- It is used in “undo” mechanism in text editors
- Used in backtracking
- Used in conversion of decimal number into binary
- To solve tower of Hanoi
- Conversion of infix into prefix and postfix expression
10. What are prefix and postfix expressions?
Ans: if an operator precedes two operands, it is called prefix expression
Ex: +ab
If an operator follows two operands it is called post fix expression
Ex: ab+
11. .What is queue?
Ans: a queue is an ordered collection of items where an item is inserted at one end called the rear and
the existing item is removed at the other end called the front. Queues maintain a FIFO principle
12. Specify the types of queues
Ans: - Simple queue
- Circular queue
- Priority queue
- Dequeue or double ended queue
13. What is linked list?
Ans: a linked list is a linear collection of data elements called nodes and the
linear order is given by means of pointers. Each node contains two parts
fields: the data and reference to the next node.
14. Mention the types of linked lists
Ans: Singly linked list(SLL), Doubly linked list(DLL) and Circular linked
list(CLL)
15. What is garbage collection?
Ans: if a node is added from the linked list or if a linked list is deleted, we
require the space to be available for future use. The memory space of the
deleted nodes is immediately reinserted into the free storage list. The
operating system of the computer periodically collects all the deleted space
into the free-storage list. This technique of collecting deleted space into
free-storage list is called as garbage collection
16. What is graph?
Ans: a graph is a collection of nodes called vertices and the connections
between them called edges
17. List the types of graphs
Ans: directed and undirected graphs
18. What are the basic concepts of OOPs? OR what are the major characteristics of
OOPs?
Ans: - Objects -Classes -Data abstraction -Data encapsulation
- Inheritance -Overloading -Polymorphism -Dynamic binding
- Message passing
19. What is object?
Ans: object is an entity which has physical existence in the real world. An object is a collection of
data members and associated member functions. Each object is identified by a unique name
20. What is class?
Ans: a class is a collection of object of similar type that share some common properties among them
21. What is data abstraction?
Ans: data abstraction permits the user to use an object without knowing its internal working
22. What do you mean by data encapsulation?
Ans: data encapsulation will prevent direct access to data. The data can be accessed only through
functions present inside the class.
23. What is inheritance?
Ans: inheritance is a process of acquiring properties from parent class to child class
24. What is overloading?
Ans: two or more functions having the same name but differ in the number of arguments or data type
of arguments is called overloading.
25. What is polymorphism?
Ans: a function can take multiple forms based on the type of arguments, number of arguments and
data type of return value
26. What is Dynamic binding?
Ans: it is a process of connecting one program to another at the time of its execution is called
dynamic binding
27. What is a base class?
Ans: the class that inherit its property to another class is called base class or parent class or super
class
28. What is a derived class?
Ans: a class that get inherited by the other class is called derived class or child class or sub class
29. What is message passing?
Ans: a message for an object is request for execution of procedure. Message passing involves
specifying the name of object, name of the function and the information to be sent
30. What are the applications of OOP?
Ans: - Computer graphic applications
- CAD/CAM software
- Object oriented data base
- User interface design such as windows
- Real time systems
- Simulation and modeling
- Artificial intelligence and expert systems
31. Write the syntax of class
Ans: class class_name
{
private: data member;
function member;
protected: data member;
function member;
public: data member;
function member;
};
32. What are the access specifiers? Mention their types
Ans: access specifiers are the keywords in C++ that allows access permission of the members of
the class.
There are three types of access specifiers
- private -protected -public
33. Where member functions can be defined?
Ans: member functions can be defined inside the class definition and outside the class definition
using scope resolution operator (::)
34. What are the two types of members referenced in a class?
Ans: data members and function members
35. Which type of members is accessible outside the class?
Ans: public
36. Which access specifier is implicitly used in a class?
Ans: private
37. What is meant by an array of objects?
Ans: it is a collection of object of same class type are called array of objects
38. Mention the restrictions on overloaded functions
Ans: - each function in a set of overloaded function must have different argument list
- If typedef is used for naming functions, then the function is not considered as different type
39. What are inline functions?
Ans: inline function makes the compiler to replace a function call with the body of the function
40. What are the advantages of inline function?
Ans: - they are compact function calls
- The size of the object code is considerably reduced
- The speed of the program execution increases
- Efficient code can be generated
- The readability of the program increases
41. What is the disadvantage of inline function?
Ans: as the body of inline function is substituted in place of a function call, the size of the executable
file increases and more memory is needed
42. When inline function may not work?
Ans: inline function may not work when it is too long or complicated, when it is recursive, when it
has looping constructs and when it has a switch or goto statements
43. What is friend function?
Ans: a friend function is a non-member function that is a friend of a class. The friend function is
declared within a class with the prefix friend. This function is used to access private and protected
members of the class
44. What is a constructor?
Ans: constructor is a special member function used to initialize the data members of the class
45. What are the rules for writing constructors?
Ans: - a constructor name is same as that of the class name
- There is no return type, not even void
- A constructor should be declared in public section
- A constructor is invoked automatically when objects are created
46. Mention the types of constructors
Ans: - Default constructor
- Parameterized constructor
- Copy constructor
47. What are parameterized constructors?
Ans: a constructor that takes one or more arguments is called parameterized constructor
48. What is copy constructor?
Ans: A copy constructor in which one object can be copied to another object
49. What is destructor?
Ans: A destructor is a special member function that will be executed automatically when an object is
destroyed. It is having same name as that of the class but preceded by a tilde (~).
50. What are the advantages of inheritance?
Ans: - Reusing the existing code
- Faster development time
- Easy to maintain
- Easy to extend
- Memory utilization
51. Mention the types of inheritance
Ans: - Single inheritance
- Multilevel inheritance
- Multiple inheritance
- Hierarchical inheritance
- Hybrid inheritance
52. What are virtual base classes?
Ans: When two or more objects are derived from a common base class, we can prevent multiple
copies of the base class being present in an object derived from those objects by declaring the base
class as virtual when it is being inherited. Such a base class is known as virtual base class. This can be
achieved by preceding the base class name with the word virtual.
53. What is a pointer?
Ans: pointer is a special variable that hold the address of another variable
54. How do you declare and initialize pointer?
Ans:
Declaration:
data type *pointer_variable, common_variable_name;
Initialization:
Pointer_variable=Address_operator common_ variable_name;
Ex: int *ptr,a;
ptr=&a;
55. What are the operators that are used with pointers?
Ans: - the address of operator (&) and pointer operator (*)
56. What is memory leak?
Ans: if the objects that are allocated memory dynamically are not deleted using delete, the memory
block remains occupied even at the end of the program. These memory blocks increase in number;
bring adverse effect on the system. This situation is called memory leak
57. What is static memory?
Ans: it is a memory allocated to the variable during its declaration
58. What is dynamic memory?
Ans: it is a memory allocated to the variable during execution of a program
59. What is free store?
Ans: free store is a pool of unallocated memory heap given to a program that is used by the program
for dynamic allocation during execution
60. What are DDL commands?
Ans: CREATE, ALTER AND DROP
61. What are DML commands?
Ans: INSERT, UPDATE AND DELETE
62. What are the operators used in SQL?
Ans: - Arithmetic operator
- Comparison operator
- Logical operator
- Operators used to negate conditions
63. What is SQL primary key?
Ans: a column or combination of columns which uniquely identifies each row in the table
64. What is foreign key? OR what is referential integrity?
Ans: this constraint identifies any column referencing the primary key in another table
65. What is unique key?
Ans: this constraint ensures that a column or a group of columns in each row have a distinct value. A
column(s) can have a null value but the values cannot be duplicated
66. What are DCL commands?
Ans: GRANT and REVOKE
67. Expand SQL
Ans: Structured Query Language
68. What is the use of commit and revoke command?
Ans: commit command is used to save the document permanently and it is used to save changes
whereas revoke command is used to undone the changes made
69. Expand HTML
Ans: HyperText Markup Language
70. Name any four tags
Ans: <html>, <body>, <b>, <head>, <p>, <title> etc
71. What is web browser?
Ans: Web browser is application software that interprets the tags written in html
72. What are the types of listing?
Ans: Ordered List (<OL>) and Unordered List (<UL>)
73. What is the tag used to get hyperlink?
Ans: Anchor tag <a>
74. How to write comment line in HTML?
Ans: <! Text here>
75. What is the extension of hypertext markup language file?
Ans: . (dot) html
76. What is XML?
Ans: eXtended Markup Langauage (XML) for documents containing structured information
77. What is DHTML?
Ans: Dynamic HyperText Markup Language
78. Expand URL
Ans: Uniform Resource Locator
79. Expand HTTP.
Ans: HyperText Tranfer Protocol.

You might also like