0% found this document useful (0 votes)
8 views76 pages

Interview Questionss

The document is a compilation of important interview questions for campus placement in Computer Science and Engineering fields, focusing on topics related to the C programming language. It covers fundamental concepts such as the features of C, memory management, functions, pointers, data structures, and dynamic memory allocation. The document serves as a study guide for students preparing for technical interviews.
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)
8 views76 pages

Interview Questionss

The document is a compilation of important interview questions for campus placement in Computer Science and Engineering fields, focusing on topics related to the C programming language. It covers fundamental concepts such as the features of C, memory management, functions, pointers, data structures, and dynamic memory allocation. The document serves as a study guide for students preparing for technical interviews.
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
You are on page 1/ 76

Department of

Computer Science & Engineering


Asansol Engineering College
Present

Most Important
Interview Questions
for
“Campus Placement”
Applicable for: CSE, IT, ECE, AEIE, CSBS, AIML.

Compiled by:

Sourav Kairi (CSE 2018-22)

*Selected for: Cognizant- GenC Pro, GS Lab- JDS, Kiwi InfoTech- SE.

*Internship: TCS, GPET.


COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

What is C language?
C is a mid-level and procedural programming language. The Procedural programming language is
also known as the structured programming language is a technique in which large programs are
broken down into smaller modules, and each module uses structured code. This technique minimizes
error and misinterpretation. More details.

Why is C known as a mother language?


C is known as a mother language because most of the compilers and JVMs are written in C language.
Most of the languages which are developed after C language has borrowed heavily from it like C++,
Python, Rust, javascript, etc. It introduces new core concepts like arrays, functions, file handling which
are used in these languages.

Why is C called a mid-level programming language?


C is called a mid-level programming language because it binds the low level and high -level
programming language. We can use C language as a System programming to develop the operating
system as well as an Application programming to generate menu driven customer driven billing
system

Who is the founder of C language?


Dennis Ritchie. More details.

What are the features of the C language?


The main features of C language are given below:

o Simple: C is a simple language because it follows the structured approach, i.e., a program is
broken into parts

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Portable: C is highly portable means that once the program is written can be run on any
machine with little or no modifications.
o Mid Level: C is a mid-level programming language as it combines the low- level language
with the features of the high-level language.
o Structured: C is a structured language as the C program is broken into parts.
o Fast Speed: C language is very fast as it uses a powerful set of data types and operators.
o Memory Management: C provides an inbuilt memory function that saves the memory and
improves the efficiency of our program.
o Extensible: C is an extensible language as it can adopt new features in the future.

What is the use of printf() and scanf() functions?


printf(): The printf() function is used to print the integer, character, float and string values on to the
screen.

scanf(): The scanf() function is used to take input from the user.

What is the difference between the local variable and global variable in C?
Following are the differences between a local variable and global variable:

Basis for Local variable Global variable


comparison

Declaration A variable which is declared inside function or A variable which is declared outside
block is known as a local variable. function or block is known as a global
variable.

Scope The scope of a variable is available within a The scope of a variable is available
function in which they are declared. throughout the program.

Access Variables can be accessed only by those Any statement in the entire program can
statements inside a function in which they are access variables.
declared.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Life Life of a variable is created when the function Life of a variable exists until the program
block is entered and destroyed on its exit. is executing.

Storage Variables are stored in a stack unless The compiler decides the storage
specified. location of a variable.

What is the use of a static variable in C?


Following are the uses of a static variable:

o A variable which is declared as static is known as a static variable. The static variable retains
its value between multiple function calls.
o Static variables are used because the scope of the static variable is available in the entire
program. So, we can access a static variable anywhere in the program.
o The static variable is initially initialized to zero. If we update the value of a variable, then the
updated value is assigned.
o The static variable is used as a common value which is shared by all the methods.
o The static variable is initialized only once in the memory heap to reduce the memory usage.

What is the use of the function in C?


Uses of C function are:

o C functions are used to avoid the rewriting the same code again and again in our program.
o C functions can be called any number of times from any place of our program.
o When a program is divided into functions, then any part of our program can easily be tracked.
o C functions provide the reusability concept, i.e., it breaks the big task into smaller tasks so
that it makes the C program more understandable.

What is the difference between call by value and call by reference in C?


Following are the differences between a call by value and call by reference are:

Call by value Call by reference

Description When a copy of the value is passed to the function, then When a copy of the value is passed to
the original value is not modified. then the original value is modified.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Memory Actual arguments and formal arguments are created in Actual arguments and formal argument
location separate memory locations. in the same memory location.

Safety In this case, actual arguments remain safe as they In this case, actual arguments are not rel
cannot be modified. are modified.

Arguments The copies of the actual arguments are passed to the The addresses of actual arguments are pa
formal arguments. respective formal arguments.

What is recursion in C?
When a function calls itself, and this process is known as recursion. The function that calls itself is
known as a recursive function.

Recursive function comes in two phases:

1. Winding phase
2. Unwinding phase

Winding phase: When the recursive function calls itself, and this phase ends when the condition is
reached.

Unwinding phase: Unwinding phase starts when the condition is reached, and the control returns
to the original call.

What is an array in C?
An Array is a group of similar types of elements. It has a contiguous memory location. It makes the
code optimized, easy to traverse and easy to sort. The size and type of arrays cannot be changed
after its declaration.

Arrays are of two types:

o One-dimensional array: One-dimensional array is an array that stores the elements one after
the another.
o Multidimensional array: Multidimensional array is an array that contains more than one
array.

What is a pointer in C?

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

A pointer is a variable that refers to the address of a value. It makes the code optimized and makes
the performance fast. Whenever a variable is declared inside a program, then the system allocates
some memory to a variable. The memory contains some address number. The variables that hold
this address number is known as the pointer variable.

What is the usage of the pointer in C?

o Accessing array elements: Pointers are used in traversing through an array of integers and
strings. The string is an array of characters which is terminated by a null character '\0'.
o Dynamic memory allocation: Pointers are used in allocation and deallocation of memory
during the execution of a program.
o Call by Reference: The pointers are used to pass a reference of a variable to other function.
o Data Structures like a tree, graph, linked list, etc.: The pointers are used to construct
different data structures like tree, graph, linked list, etc.

What is a NULL pointer in C?


A pointer that doesn't refer to any address of value but NULL is known as a NULL pointer. When we
assign a '0' value to a pointer of any type, then it becomes a Null pointer.

What is a far pointer in C?


A pointer which can access all the 16 segments (whole residence memory) of RAM is known as far
pointer. A far pointer is a 32-bit pointer that obtains information outside the memory in a given
section.

What is dangling pointer in C?

o If a pointer is pointing any memory location, but meanwhile another pointer deletes the
memory occupied by the first pointer while the first pointer still points to that memory
location, the first pointer will be known as a dangling pointer. This problem is known as a
dangling pointer problem.
o Dangling pointer arises when an object is deleted without modifying the value of the pointer.
The pointer points to the deallocated memory.

What is pointer to pointer in C?


In case of a pointer to pointer concept, one pointer refers to the address of another pointer. The
pointer to pointer is a chain of pointers. Generally, the pointer contains the address of a variable.
The pointer to pointer contains the address of a first pointer. Let's understand this concept through
an example:

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

What is static memory allocation?

o In case of static memory allocation, memory is allocated at compile time, and memory can't
be increased while executing the program. It is used in the array.
o The lifetime of a variable in static memory is the lifetime of a program.
o The static memory is allocated using static keyword.
o The static memory is implemented using stacks or heap.
o The pointer is required to access the variable present in the static memory.
o The static memory is faster than dynamic memory.
o In static memory, more memory space is required to store the variable.

What is dynamic memory allocation?

o In case of dynamic memory allocation, memory is allocated at runtime and memory can be
increased while executing the program. It is used in the linked list.
o The malloc() or calloc() function is required to allocate the memory at the runtime.
o An allocation or deallocation of memory is done at the execution time of a program.
o No dynamic pointers are required to access the memory.
o The dynamic memory is implemented using data segments.
o Less memory space is required to store the variable.

What functions are used for dynamic memory allocation in C language?

1. malloc()
o The malloc() function is used to allocate the memory during the execution of the
program.
o It does not initialize the memory but carries the garbage value.
o It returns a null pointer if it could not be able to allocate the requested space.

Syntax

1. ptr = (cast-type*) malloc(byte-


size) // allocating the memory using malloc() function.

2. calloc()
o The calloc() is same as malloc() function, but the difference only is that it initializes the
memory with zero value.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Syntax

1. ptr = (cast-type*)calloc(n, element-


size);// allocating the memory using calloc() function.

2. realloc()
o The realloc() function is used to reallocate the memory to the new size.
o If sufficient space is not available in the memory, then the new block is allocated to
accommodate the existing data.

Syntax

1. ptr = realloc(ptr, newsize); // updating the memory size using realloc() function.

In the above syntax, ptr is allocated to a new size.

2. free():The free() function releases the memory allocated by either calloc() or malloc() function.

Syntax

1. free(ptr); // memory is released using free() function.

The above syntax releases the memory from a pointer variable ptr.

What is the difference between malloc() and calloc()?

calloc() malloc()

Description The malloc() function allocates a single block of The calloc() function allocates multipl
requested memory. requested memory.

Initialization It initializes the content of the memory to zero. It does not initialize the content of m
carries the garbage value.

Number of It consists of two arguments. It consists of only one argument.


arguments

Return value It returns a pointer pointing to the allocated It returns a pointer pointing to the allocat
memory.

What is the structure?


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o The structure is a user-defined data type that allows storing multiple types of data in a single
unit. It occupies the sum of the memory of all members.
o The structure members can be accessed only through structure variables.
o Structure variables accessing the same structure but the memory allocated for each variable
will be different.

What is a union?

o The union is a user-defined data type that allows storing multiple types of data in a single
unit. However, it doesn't occupy the sum of the memory of all members. It holds the memory
of the largest member only.
o In union, we can access only one variable at a time as it allocates one common space for all
the members of a union.

What is an auto keyword in C?


In C, every local variable of a function is known as an automatic (auto) variable. Variables which are
declared inside the function block are known as a local variable. The local variables are also known
as an auto variable. It is optional to use an auto keyword before the data type of a variable. If no
value is stored in the local variable, then it consists of a garbage value.

What is the purpose of sprintf() function?


The sprintf() stands for "string print." The sprintf() function does not print the output on the console
screen. It transfers the data to the buffer. It returns the total number of characters present in the
string.

Can we compile a program without main() function?


Yes, we can compile, but it can't be executed.

But, if we use #define, we can compile and run a C program without using the main() function. For
example:

1. #include<stdio.h>
2. #define start main
3. void start() {
4. printf("Hello");
5. }

What is command line argument?


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

The argument passed to the main() function while executing the program is known as command line
argument. For example:

1. main(int count, char *args[]){


2. //code to be executed
3. }

What is the difference between getch() and getche()?


The getch() function reads a single character from the keyboard. It doesn't use any buffer, so
entered data will not be displayed on the output screen.

The getche() function reads a single character from the keyword, but data is displayed on the output
screen. Press Alt+f5 to see the entered character.

What is the maximum length of an identifier?


It is 32 characters ideally but implementation specific.

What is typecasting?
The typecasting is a process of converting one data type into another is known as typecasting. If we
want to store the floating type value to an int type, then we will convert the data type into another
data type explicitly.

Can we access the array using a pointer in C language?


Yes, by holding the base address of array into a pointer, we can access the array using a pointer.

What is an infinite loop?


A loop running continuously for an indefinite number of times is called the infinite loop.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

1) What is Data Structure? Explain.


The data structure is a way that specifies how to organize and manipulate the data. It also defines
the relationship between them. Some examples of Data Structures are arrays, Linked List, Stack,
Queue, etc. Data Structures are the central part of many computer science algorithms as they enable
the programmers to handle the data in an efficient way

1) What is Data Structure? Explain.


The data structure is a way that specifies how to organize and manipulate the data. It also defines
the relationship between them. Some examples of Data Structures are arrays, Linked List, Stack,
Queue, etc. Data Structures are the central part of many computer science algorithms as they enable
the programmers to handle the data in an efficient way

2) Describe the types of Data Structures?


Data Structures are mainly classified into two types:

Linear Data Structure: A data structure is called linear if all of its elements are arranged in the
sequential order. In linear data structures, the elements are stored in a non-hierarchical way where
each item has the successors and predecessors except the first and last element.Difference between
JDK, JRE, and JVM

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Non-Linear Data Structure: The Non-linear data structure does not form a sequence i.e. each item
or element is connected with two or more other items in a non-linear arrangement. The data
elements are not arranged in the sequential structure.

3) List the area of applications of Data Structure.


Data structures are applied extensively in the following areas of computer science:

o Compiler Design,
o Operating System,
o Database Management System,
o Statistical analysis package,
o Numerical Analysis,
o Graphics,
o Artificial Intelligence,
o Simulation

4) What is the difference between file structure and storage structure?


Difference between file structure and storage structure:

The main difference between file structure and storage structure is based on memory area that is
being accessed.

Storage structure: It is the representation of the data structure in the computer memory.

File structure: It is the representation of the storage structure in the auxiliary memory.

5) List the data structures which are used in RDBMS, Network Data Modal,
and Hierarchical Data Model.

o RDBMS uses Array data structure


o Network data model uses Graph
o Hierarchal data model uses Trees

6) Which data structure is used to perform recursion?


Stack data structure is used in recursion due to its last in first out nature. Operating system maintains
the stack in order to save the iteration variables at each function call
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

7) What is a Stack?
Stack is an ordered list in which, insertion and deletion can be performed only at one end that is
called the top. It is a recursive data structure having pointer to its top element. The stack is
sometimes called as Last-In-First-Out (LIFO) list i.e. the element which is inserted first in the stack
will be deleted last from the stack.

8) List the area of applications where stack data structure can be used?

o Expression evaluation
o Backtracking
o Memory Management
o Function calling and return

9) What are the operations that can be performed on a stack?

o Push Operations
o Pop Operations
o Peek Operations

10) Write the stack overflow condition.


Overflow occurs when top = Maxsize -1

11) What is the difference between PUSH and POP?


PUSH and POP operations specify how data is stored and retrieved in a stack.

PUSH: PUSH specifies that data is being "inserted" into the stack.

POP: POP specifies data retrieval. It means that data is being deleted from the stack.

12) Write the steps involved in the insertion and deletion of an element in
the stack.
Push:

o Increment the variable top so that it can refer to the next memory allocation
o Copy the item to the at the array index value equal to the top
o Repeat step 1 and 2 until stack overflows
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Pop:

o Store the topmost element into the an another variable


o Decrement the value of the top
o Return the topmost element

13) What is a postfix expression?


An expression in which operators follow the operands is known as postfix expression. The main
benefit of this form is that there is no need to group sub-expressions in parentheses or to consider
operator precedence.

The expression "a + b" will be represented as "ab+" in postfix notation

14)Write the postfix form of the expression: (A + B) * (C - D)


AB+CD-*

)15) Which notations are used in Evaluation of Arithmetic Expressions


using prefix and postfix forms?
Polish and Reverse Polish notations.

16)What is an array?
Arrays are defined as the collection of similar types of data items stored at contiguous memory
locations. It is the simplest data structure in which each data element can be randomly accessed by
using its index number.

17) How to reference all the elements in a one-dimension array?


It can be done by using an indexed loop such that the counter runs from 0 to the array size minus
one. In this manner, you can reference all the elements in sequence by using the loop counter as the
array subscript.

18) What is a multidimensional array?


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

The multidimensional array can be defined as the array of arrays in which, the data is stored in tabular
form consists of rows and columns. 2D arrays are created to implement a relational database
lookalike data structure. It provides ease of holding the bulk of data at once which can be passed to
any number of functions wherever required.

19) How are the elements of a 2D array are stored in the memory?
There are two techniques by using which, the elements of a 2D array can be stored in the memory.

o Row-Major Order: In row-major ordering, all the rows of the 2D array are stored into the
memory contiguously. First, the 1st row of the array is stored into the memory completely,
then the 2nd row of the array is stored into the memory completely and so on till the last
row.
o Column-Major Order: In column-major ordering, all the columns of the 2D array are stored
into the memory contiguously. first, the 1st column of the array is stored into the memory
completely, then the 2nd row of the array is stored into the memory completely and so on till
the last column of the array.

20) Calculate the address of a random element present in a 2D array, given


base address as BA.
Row-Major Order: If array is declared as a[m][n] where m is the number of rows while n is the
number of columns, then address of an element a[i][j] of the array stored in row major order is
calculated as,

Address(a[i][j]) = B. A. + (i * n + j) * size

Column-Major Order: If array is declared as a[m][n] where m is the number of rows while n is the
number of columns, then address of an element a[i][j] of the array stored in column major order is
calculated as

Address(a[i][j]) = ((j*m)+i)*Size + BA.

21) Define Linked List Data structure.


Linked List is the collection of randomly stored data objects called nodes. In Linked List, each node
is linked to its adjacent node through a pointer. A node contains two fields, i.e. Data Field and Link
Field.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

22) Are linked lists considered linear or non-linear data structures?


A linked list is considered both linear and non-linear data structure depending upon the situation.

o On the basis of data storage, it is considered as a non-linear data structure.


o On the basis of the access strategy, it is considered as a linear data-structure.

23) What are the advantages of Linked List over an array?

o The size of a linked list can be incremented at runtime which is impossible in the case of the
array.
o The List is not required to be contiguously present in the main memory, if the contiguous
space is not available, the nodes can be stored anywhere in the memory connected through
the links.
o The List is dynamically stored in the main memory and grows as per the program demand
while the array is statically stored in the main memory, size of which must be declared at
compile time.
o The number of elements in the linked list are limited to the available memory space while the
number of elements in the array is limited to the size of an array.

25) If you are using C language to implement the heterogeneous linked list,
what pointer type should be used?
The heterogeneous linked list contains different data types, so it is not possible to use ordinary
pointers for this. For this purpose, you have to use a generic pointer type like void pointer because
the void pointer is capable of storing a pointer to any type.

26) What is doubly linked list?


The doubly linked list is a complex type of linked list in which a node contains a pointer to the
previous as well as the next node in the sequence. In a doubly linked list, a node consists of three
parts:

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o node data
o pointer to the next node in sequence (next pointer)
o pointer to the previous node (previous pointer).

28) Define the queue data structure.


A queue can be defined as an ordered list which enables insert operations to be performed at one
end called REAR and delete operations to be performed at another end called FRONT.

29) List some applications of queue data structure.


The Applications of the queue is given as follows:

o Queues are widely used as waiting lists for a single shared resource like a printer, disk, CPU.
o Queues are used in the asynchronous transfer of data (where data is not being transferred at
the same rate between two processes) for eg. pipes, file IO, sockets.
o Queues are used as buffers in most of the applications like MP3 media player, CD player, etc.
o Queues are used to maintain the playlist in media players to add and remove the songs from
the play-list.
o Queues are used in operating systems for handling interrupts.

30) What are the drawbacks of array implementation of Queue?

o Memory Wastage: The space of the array, which is used to store queue elements, can never
be reused to store the elements of that queue because the elements can only be inserted at
front end and the value of front might be so high so that, all the space before that, can never
be filled.
o Array Size: There might be situations in which, we may need to extend the queue to insert
more elements if we use an array to implement queue, It will almost be impossible to extend
the array size, therefore deciding the correct array size is always a problem in array
implementation of queue.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

31) What are the scenarios in which an element can be inserted into the
circular queue?

o If (rear + 1)%maxsize = front, the queue is full. In that case, overflow occurs and therefore,
insertion can not be performed in the queue.
o If rear != max - 1, the rear will be incremented to the mod(maxsize) and the new value will be
inserted at the rear end of the queue.
o If front != 0 and rear = max - 1, it means that queue is not full therefore, set the value of rear
to 0 and insert the new element there.

32) What is a dequeue?


Dequeue (also known as double-ended queue) can be defined as an ordered set of elements in
which the insertion and deletion can be performed at both the ends, i.e. front and rear.

33) What is the minimum number of queues that can be used to implement
a priority queue?
Two queues are needed. One queue is used to store the data elements, and another is used for
storing priorities.

34) Define the tree data structure.


The Tree is a recursive data structure containing the set of one or more data nodes where one node
is designated as the root of the tree while the remaining nodes are called as the children of the root.
The nodes other than the root node are partitioned into the nonempty sets where each one of them
is to be called sub-tree.

35) List the types of tree.


There are six types of tree given as follows.

o General Tree
o Forests
o Binary Tree
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Binary Search Tree


o Expression Tree
o Tournament Tree

36) What are Binary trees?


A binary Tree is a special type of generic tree in which, each node can have at most two children.
Binary tree is generally partitioned into three disjoint subsets, i.e. the root of the node, left sub-tree
and Right binary sub-tree.

38) What is the maximum number of nodes in a binary tree of height k?


2k+1-1 where k >= 1

39) Which data structure suits the most in the tree construction?
Queue data structure

40) Which data structure suits the most in the tree construction?
Queue data structure

43) How can AVL Tree be useful in all the operations as compared to
Binary search tree?
AVL tree controls the height of the binary search tree by not letting it be skewed. The time taken for
all operations in a binary search tree of height h is O(h). However, it can be extended to O(n) if the
BST becomes skewed (i.e. worst case). By limiting this height to log n, AVL tree imposes an upper
bound on each operation to be O(log n) where n is the number of nodes.

44) State the properties of B Tree.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

A B tree of order m contains all the properties of an M way tree. In addition, it contains the following
properties.

o Every node in a B-Tree contains at most m children.


o Every node in a B-Tree except the root node and the leaf node contain at least m/2 children.
o The root nodes must have at least 2 nodes.
o All leaf nodes must be at the same level.

45) What are the differences between B tree and B+ tree?

SN B Tree B+ Tree

1 Search keys cannot repeatedly be stored. Redundant search keys can be present.

2 Data can be stored in leaf nodes as well as Data can only be stored on the leaf nodes.
internal nodes

3 Searching for some data is a slower process Searching is comparatively faster as data
since data can be found on internal nodes as can only be found on the leaf nodes.
well as on the leaf nodes.

4 Deletion of internal nodes is so complicated Deletion will never be a complexed


and time-consuming. process since element will always be
deleted from the leaf nodes.

5 Leaf nodes cannot be linked together. Leaf nodes are linked together to make
the search operations more efficient.

46) List some applications of Tree-data structure?


Applications of Tree- data structure:

o The manipulation of Arithmetic expression,


o Symbol Table construction,
o Syntax analysis
o Hierarchal data model

47) Define the graph data structure?


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

A graph G can be defined as an ordered set G(V, E) where V(G) represents the set of vertices and
E(G) represents the set of edges which are used to connect these vertices. A graph can be seen as a
cyclic tree, where the vertices (Nodes) maintain any complex relationship among them instead of
having parent-child relations.

48) Differentiate among cycle, path, and circuit?

o Path: A Path is the sequence of adjacent vertices connected by the edges with no restrictions.
o Cycle: A Cycle can be defined as the closed path where the initial vertex is identical to the
end vertex. Any vertex in the path can not be visited twice
o Circuit: A Circuit can be defined as the closed path where the intial vertex is identical to the
end vertex. Any vertex may be repeated.

49) Mention the data structures which are used in graph implementation.
For the graph implementation, following data structures are used.

o In sequential representation, Adjacency matrix is used.


o In Linked representation, Adjacency list is used.

50) Which data structures are used in BFS and DFS algorithm?

o In BFS algorithm, Queue data structure is used.


o In DFS algorithm, Stack data structure is used.

51) What are the applications of Graph data structure?


The graph has the following applications:

Graphs are used in circuit networks where points of connection are drawn as vertices and component
wires become the edges of the graph.

o Graphs are used in transport networks where stations are drawn as vertices and routes
become the edges of the graph.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Graphs are used in maps that draw cities/states/regions as vertices and adjacency relations
as edges.
o Graphs are used in program flow analysis where procedures or modules are treated as vertices
and calls to these procedures are drawn as edges of the graph.

54) In what scenario, Binary Search can be used?


Binary Search algorithm is used to search an already sorted list. The algorithm follows divide and
conqer approach

52) What are the advantages of Binary search over linear search?
There are relatively less number of comparisons in binary search than that in linear search. In average
case, linear search takes O(n) time to search a list of n elements while Binary search takes O(log n)
time to search a list of n elements.

53) What are the advantages of Selecetion Sort?

o It is simple and easy to implement.


o It can be used for small data sets.
o It is 60 per cent more efficient than bubble sort.

55) List Some Applications of Multilinked Structures?

o Sparse matrix,
o Index generation.

56) What is the difference between NULL and VOID?

o Null is actually a value, whereas Void is a data type identifier.


o A null variable simply indicates an empty value, whereas void is used to identify pointers as
having no initial size.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

1) What is Java?
Java is the high-level, object-oriented, robust, secure programming language, platform-
independent, high performance, Multithreaded, and portable programming language. It was
developed by James Gosling in June 1991. It can also be known as the platform as it provides its
own JRE and API.

2) What are the differences between C++ and Java?


The differences between C++ and Java are given in the following table.

29.9M

605

HTML Tutorial

Comparison C++ Java


Index

Platform- C++ is platform-dependent. Java is platform-independent.


independent

Mainly used for C++ is mainly used for system Java is mainly used for application
programming. programming. It is widely used in window,
web-based, enterprise and mobile
applications.

Design Goal C++ was designed for systems and Java was designed and created as an
applications programming. It was interpreter for printing systems but later
an extension of C programming extended as a support network computing.
language. It was designed with a goal of being easy to
use and accessible to a broader audience.

Goto C++ supports the goto statement. Java doesn't support the goto statement.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Multiple C++ supports multiple Java doesn't support multiple inheritance


inheritance inheritance. through class. It can be achieved
by interfaces in java.

Operator C++ supports operator Java doesn't support operator overloading.


Overloading overloading.

Pointers C++ supports pointers. You can Java supports pointer internally. However,
write pointer program in C++. you can't write the pointer program in java.
It means java has restricted pointer support
in Java.

Compiler and C++ uses compiler only. C++ is Java uses compiler and interpreter both.
Interpreter compiled and run using the Java source code is converted into bytecode
compiler which converts source at compilation time. The interpreter
code into machine code so, C++ is executes this bytecode at runtime and
platform dependent. produces output. Java is interpreted that is
why it is platform independent.

Call by Value and C++ supports both call by value Java supports call by value only. There is no
Call by reference and call by reference. call by reference in java.

Structure and C++ supports structures and Java doesn't support structures and unions.
Union unions.

Thread Support C++ doesn't have built-in support Java has built-in thread support.
for threads. It relies on third-party
libraries for thread support.

Documentation C++ doesn't support Java supports documentation comment (/**


comment documentation comment. ... */) to create documentation for java
source code.

Virtual Keyword C++ supports virtual keyword so Java has no virtual keyword. We can override
that we can decide whether or not all non-static methods by default. In other
override a function. words, non-static methods are virtual by
default.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

unsigned right C++ doesn't support >>> Java supports unsigned right shift >>>
shift >>> operator. operator that fills zero at the top for the
negative numbers. For positive numbers, it
works same like >> operator.

Inheritance Tree C++ creates a new inheritance tree Java uses a single inheritance tree always
always. because all classes are the child of Object
class in java. The object class is the root of
the inheritance tree in java.

Hardware C++ is nearer to hardware. Java is not so interactive with hardware.

Object-oriented C++ is an object-oriented Java is also an object-oriented language.


language. However, in C language, However, everything (except fundamental
single root hierarchy is not types) is an object in Java. It is a single root
possible. hierarchy as everything gets derived from
java.lang.Object.

3) List the features of Java Programming language.


There are the following features in Java Programming Language.

o Simple: Java is easy to learn. The syntax of Java is based on C++ which makes easier to write the
program in it.

o Object-Oriented: Java follows the object-oriented paradigm which allows us to maintain our code as
the combination of different type of objects that incorporates both data and behavior.

o Portable: Java supports read-once-write-anywhere approach. We can execute the Java program on
every machine. Java program (.java) is converted to bytecode (.class) which can be easily run on every
machine.

o Platform Independent: Java is a platform independent programming language. It is different from


other programming languages like C and C++ which needs a platform to be executed. Java comes

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

with its platform on which its code is executed. Java doesn't depend upon the operating system to be
executed.

o Secured: Java is secured because it doesn't use explicit pointers. Java also provides the concept of
ByteCode and Exception handling which makes it more secured.

o Robust: Java is a strong programming language as it uses strong memory management. The concepts
like Automatic garbage collection, Exception handling, etc. make it more robust.

o Architecture Neutral: Java is architectural neutral as it is not dependent on the architecture. In C, the
size of data types may vary according to the architecture (32 bit or 64 bit) which doesn't exist in Java.

o Interpreted: Java uses the Just-in-time (JIT) interpreter along with the compiler for the program
execution.

o High Performance: Java is faster than other traditional interpreted programming languages because
Java bytecode is "close" to native code. It is still a little bit slower than a compiled language (e.g., C++).

o Multithreaded: We can write Java programs that deal with many tasks at once by defining multiple
threads. The main advantage of multi-threading is that it doesn't occupy memory for each thread. It
shares a common memory area. Threads are important for multi-media, Web applications, etc.

o Distributed: Java is distributed because it facilitates users to create distributed applications in Java.
RMI and EJB are used for creating distributed applications. This feature of Java makes us able to access
files by calling the methods from any machine on the internet.

o Dynamic: Java is a dynamic language. It supports dynamic loading of classes. It means classes are
loaded on demand. It also supports functions from its native languages, i.e., C and C++.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

4) What do you understand by Java virtual machine?


Java Virtual Machine is a virtual machine that enables the computer to run the Java program. JVM
acts like a run-time engine which calls the main method present in the Java code. JVM is the
specification which must be implemented in the computer system. The Java code is compiled by
JVM to be a Bytecode which is machine independent and close to the native code.

5) What is the difference between JDK, JRE, and JVM?


JVM

JVM is an acronym for Java Virtual Machine; it is an abstract machine which provides the runtime
environment in which Java bytecode can be executed. It is a specification which specifies the working
of Java Virtual Machine. Its implementation has been provided by Oracle and other companies. Its
implementation is known as JRE.

JVMs are available for many hardware and software platforms (so JVM is platform dependent). It is
a runtime instance which is created when we run the Java class. There are three notions of the JVM:
specification, implementation, and instance.

JRE

JRE stands for Java Runtime Environment. It is the implementation of JVM. The Java Runtime
Environment is a set of software tools which are used for developing Java applications. It is used to
provide the runtime environment. It is the implementation of JVM. It physically exists. It contains a
set of libraries + other files that JVM uses at runtime.

JDK

JDK is an acronym for Java Development Kit. It is a software development environment which is used
to develop Java applications and applets. It physically exists. It contains JRE + development tools.
JDK is an implementation of any one of the below given Java Platforms released by Oracle
Corporation:

o Standard Edition Java Platform


o Enterprise Edition Java Platform
o Micro Edition Java Platform

6) How many types of memory areas are allocated by JVM?

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Many types:

1. Class(Method) Area: Class Area stores per-class structures such as the runtime constant pool, field,
method data, and the code for methods.
2. Heap: It is the runtime data area in which the memory is allocated to the objects
3. Stack: Java Stack stores frames. It holds local variables and partial results, and plays a part in method
invocation and return. Each thread has a private JVM stack, created at the same time as the thread. A
new frame is created each time a method is invoked. A frame is destroyed when its method invocation
completes.
4. Program Counter Register: PC (program counter) register contains the address of the Java virtual
machine instruction currently being executed.
5. Native Method Stack: It contains all the native methods used in the application.

7) What is JIT compiler?


Just-In-Time(JIT) compiler: It is used to improve the performance. JIT compiles parts of the
bytecode that have similar functionality at the same time, and hence reduces the amount of time
needed for compilation. Here the term “compiler” refers to a translator from the instruction set of a
Java virtual machine (JVM) to the instruction set of a specific CPU.

8) What is the platform?


A platform is the hardware or software environment in which a piece of software is executed. There
are two types of platforms, software-based and hardware-based. Java provides the software-based
platform.

9) What are the main differences between the Java platform and other
platforms?
There are the following differences between the Java platform and other platforms.

o Java is the software-based platform whereas other platforms may be the hardware platforms or
software-based platforms.
o Java is executed on the top of other hardware platforms whereas other platforms can only have the
hardware components.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

10) What gives Java its 'write once and run anywhere' nature?
The bytecode. Java compiler converts the Java programs into the class file (Byte Code) which is the
intermediate language between source code and machine code. This bytecode is not platform
specific and can be executed on any computer.

11) What is classloader?


Classloader is a subsystem of JVM which is used to load class files. Whenever we run the java
program, it is loaded first by the classloader. There are three built-in classloaders in Java.

1. Bootstrap ClassLoader: This is the first classloader which is the superclass of Extension classloader. It
loads the rt.jar file which contains all class files of Java Standard Edition like java.lang package classes,
java.net package classes, java.util package classes, java.io package classes, java.sql package classes,
etc.
2. Extension ClassLoader: This is the child classloader of Bootstrap and parent classloader of System
classloader. It loads the jar files located inside $JAVA_HOME/jre/lib/ext directory.
3. System/Application ClassLoader: This is the child classloader of Extension classloader. It loads the
class files from the classpath. By default, the classpath is set to the current directory. You can change
the classpath using "-cp" or "-classpath" switch. It is also known as Application classloader.

12) Is Empty .java file name a valid source file name?


Yes, Java allows to save our java file by .java only, we need to compile it by javac .java and run
by java classname Let's take a simple example:

13) Is delete, next, main, exit or null keyword in java?


No.

14) If I don't provide any arguments on the command line, then what will
the value stored in the String array passed into the main() method, empty
or NULL?
It is empty, but not null.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

15) What if I write static public void instead of public static void?
The program compiles and runs correctly because the order of specifiers doesn't matter in Java.

16) What is the default value of the local variables?


The local variables are not initialized to any default value, neither primitives nor object references.

17) What are the various access specifiers in Java?


In Java, access specifiers are the keywords which are used to define the access scope of the method,
class, or a variable. In Java, there are four access specifiers given below.

o Public The classes, methods, or variables which are defined as public, can be accessed by any class or
method.
o Protected Protected can be accessed by the class of the same package, or by the sub-class of this
class, or within the same class.
o Default Default are accessible within the package only. By default, all the classes, methods, and
variables are of default scope.
o Private The private class, methods, or variables defined as private can be accessed within the class
only.

18) What is the purpose of static methods and variables?


The methods or variables defined as static are shared among all the objects of the class. The static
is the part of the class and not of the object. The static variables are stored in the class area, and we
do not need to create the object to access such variables. Therefore, static is used in the case, where
we need to define variables or methods which are common to all the objects of the class.

For example, In the class simulating the collection of the students in a college, the name of the
college is the common attribute to all the students. Therefore, the college name will be defined
as static.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

19) What are the advantages of Packages in Java?


There are various advantages of defining packages in Java.

o Packages avoid the name clashes.


o The Package provides easier access control.
o We can also have the hidden classes that are not visible outside and used by the package.
o It is easier to locate the related classes

23) What is object-oriented paradigm?


It is a programming paradigm based on objects having data and methods defined in the class to
which it belongs. Object-oriented paradigm aims to incorporate the advantages of modularity and
reusability. Objects are the instances of classes which interacts with one another to design
applications and programs. There are the following features of the object-oriented paradigm.

o Follows the bottom-up approach in program design.


o Focus on data with methods to operate upon the object's data
o Includes the concept like Encapsulation and abstraction which hides the complexities from the user
and show only functionality.
o Implements the real-time approach like inheritance, abstraction, etc.
o The examples of the object-oriented paradigm are C++, Simula, Smalltalk, Python, C#, etc.

24) What is an object?


The Object is the real-time entity having some state and behavior. In Java, Object is an instance of
the class having the instance variables as the state of the object and the methods as the behavior of
the object. The object of a class can be created by using the new keyword.

25) What is the difference between an object-oriented programming


language and object-based programming language?
There are the following basic differences between the object-oriented language and object-based
language.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Object-oriented languages follow all the concepts of OOPs whereas, the object-based language
doesn't follow all the concepts of OOPs like inheritance and polymorphism.
o Object-oriented languages do not have the inbuilt objects whereas Object-based languages have the
inbuilt objects, for example, JavaScript has window object.
o Examples of object-oriented programming are Java, C#, Smalltalk, etc. whereas the examples of
object-based languages are JavaScript, VBScript, etc.

26) What will be the initial value of an object reference which is defined as
an instance variable?
All object references are initialized to null in Java.

27) What is the constructor?


The constructor can be defined as the special type of method that is used to initialize the state of an
object. It is invoked when the class is instantiated, and the memory is allocated for the object. Every
time, an object is created using the new keyword, the default constructor of the class is called. The
name of the constructor must be similar to the class name. The constructor must not have an explicit
return type.

28) How many types of constructors are used in Java?


Based on the parameters passed in the constructors, there are two types of constructors in Java.

o Default Constructor: default constructor is the one which does not accept any value. The default
constructor is mainly used to initialize the instance variable with the default values. It can also be used
for performing some useful task on object creation. A default constructor is invoked implicitly by the
compiler if there is no constructor defined in the class.
o Parameterized Constructor: The parameterized constructor is the one which can initialize the
instance variables with the given values. In other words, we can say that the constructors which can
accept the arguments are called parameterized constructors.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

29) What is the purpose of a default constructor?


The purpose of the default constructor is to assign the default value to the objects. The java compiler
creates a default constructor implicitly if there is no constructor in the class.

30) Does constructor return any value?


Ans: yes, The constructor implicitly returns the current instance of the class (You can't use an explicit
return type with the constructor).

31)Is constructor inherited?


No, The constructor is not inherited.

32) Can you make a constructor final?


No, the constructor can't be final.

33) Can we overload the constructors?


Yes, the constructors can be overloaded by changing the number of arguments accepted by the
constructor or by changing the data type of the parameters. Consider the following example.

34) What do you understand by copy constructor in Java?


There is no copy constructor in java. However, we can copy the values from one object to another
like copy constructor in C++.

There are many ways to copy the values of one object into another in java. They are:

o By constructor
o By assigning the values of one object into another
o By clone() method of Object class

In this example, we are going to copy the values of one object into another using java constructor.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

35) What are the differences between the constructors and methods?
There are many differences between constructors and methods. They are given below.

Java Constructor Java Method

A constructor is used to initialize the state of an object. A method is used to expose the behavior
of an object.

A constructor must not have a return type. A method must have a return type.

The constructor is invoked implicitly. The method is invoked explicitly.

The Java compiler provides a default constructor if you don't The method is not provided by the
have any constructor in a class. compiler in any case.

The constructor name must be same as the class name. The method name may or may not be
same as class name.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

39) What is the static variable?


The static variable is used to refer to the common property of all objects (that is not unique for each
object), e.g., The company name of employees, college name of students, etc. Static variable gets
memory only once in the class area at the time of class loading. Using a static variable makes your
program more memory efficient (it saves memory). Static variable belongs to the class rather than
the object.

40) What is the static method?

o A static method belongs to the class rather than the object.


o There is no need to create the object to call the static methods.
o A static method can access and change the value of the static variable.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

41) What are the restrictions that are applied to the Java static methods?
Two main restrictions are applied to the static methods.

o The static method can not use non-static data member or call the non-static method directly.
o this and super cannot be used in static context as they are non-static.

42) Why is the main method static?


Because the object is not required to call the static method. If we make the main method non-static,
JVM will have to create its object first and then call main() method which will lead to the extra
memory allocation. More Details.

43) Can we override the static methods?


No, we can't override static methods.

44) What is the static block?


Static block is used to initialize the static data member. It is executed before the main method, at
the time of classloading.

45) Can we execute a program without main() method?


Ans) No, It was possible before JDK 1.7 using the static block. Since JDK 1.7, it is not possible. More
Details.

46) What if the static modifier is removed from the signature of the main
method?
Program compiles. However, at runtime, It throws an error "NoSuchMethodError."

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

47) What is the difference between static (class) method and instance
method?

static or class method instance method

1)A method that is declared as static is known as the static A method that is not declared as static
method. is known as the instance method.

2)We don't need to create the objects to call the static methods. The object is required to call the
instance methods.

3)Non-static (instance) members cannot be accessed in the Static and non-static variables both
static context (static method, static block, and static nested class) can be accessed in instance methods.
directly.

4)For example: public static int cube(int n){ return n*n*n;} For example: public void msg(){...}.

48) Can we make constructors static?


As we know that the static context (method, block, or variable) belongs to the class, not the object.
Since Constructors are invoked only when the object is created, there is no sense to make the
constructors static. However, if you try to do so, the compiler will show the compiler error.

49) Can we make the abstract methods static in Java?


In Java, if we make the abstract methods static, It will become the part of the class, and we can
directly call it which is unnecessary. Calling an undefined method is completely useless therefore it
is not allowed.

50) Can we declare the static variables and methods in an abstract class?
Yes, we can declare static variables and methods in an abstract method. As we know that there is no
requirement to make the object to access the static context, therefore, we can access the static
context declared inside the abstract class by using the name of the abstract class. Consider the
following example.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

51) What is this keyword in java?


The this keyword is a reference variable that refers to the current object. There are the various uses
of this keyword in Java. It can be used to refer to current class properties such as instance methods,
variable, constructors, etc. It can also be passed as an argument into the methods or constructors. It
can also be returned from the method as the current class instance.

52) What are the main uses of this keyword?


There are the following uses of this keyword.

o this can be used to refer to the current class instance variable.


o this can be used to invoke current class method (implicitly)
o this() can be used to invoke the current class constructor.
o this can be passed as an argument in the method call.
o this can be passed as an argument in the constructor call.
o this can be used to return the current class instance from the method.

53) Can we assign the reference to this variable?


No, this cannot be assigned to any value because it always points to the current class object and this
is the final reference in Java. However, if we try to do so, the compiler error will be shown. Consider
the following example.

54) Can this keyword be used to refer static members?


Yes, It is possible to use this keyword to refer static members because this is just a reference variable
which refers to the current class object. However, as we know that, it is unnecessary to access static
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

variables through objects, therefore, it is not the best practice to use this to refer static members.
Consider the following example.

55) How can constructor chaining be done using this keyword?


Constructor chaining enables us to call one constructor from another constructor of the class with
respect to the current class object. We can use this keyword to perform constructor chaining within
the same class. Consider the following example which illustrates how can we use this keyword to
achieve constructor chaining.

56) What are the advantages of passing this into a method instead of the
current class object itself?
As we know, that this refers to the current class object, therefore, it must be similar to the current
class object. However, there can be two main advantages of passing this into a method instead of
the current class object.

o this is a final variable. Therefore, this cannot be assigned to any new value whereas the current class
object might not be final and can be changed.
o this can be used in the synchronized block.

57) What is the Inheritance?


Inheritance is a mechanism by which one object acquires all the properties and behavior of another
object of another class. It is used for Code Reusability and Method Overriding. The idea behind
inheritance in Java is that you can create new classes that are built upon existing classes. When you
inherit 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. Inheritance represents the IS-A
relationship which is also known as a parent-child relationship.

There are five types of inheritance in Java.

o Single-level inheritance
o Multi-level inheritance
o Multiple Inheritance
o Hierarchical Inheritance
o Hybrid Inheritance

Multiple inheritance is not supported in Java through class.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

58) Why is Inheritance used in Java?


There are various advantages of using inheritance in Java that is given below.

o Inheritance provides code reusability. The derived class does not need to redefine the method of base
class unless it needs to provide the specific implementation of the method.
o Runtime polymorphism cannot be achieved without using inheritance.
o We can simulate the inheritance of classes with the real-time objects which makes OOPs more realistic.
o Inheritance provides data hiding. The base class can hide some data from the derived class by making
it private.
o Method overriding cannot be achieved without inheritance. By method overriding, we can give a
specific implementation of some basic method contained by the base class.

59) Which class is the superclass for all the classes?


The object class is the superclass of all other classes in Java.

60) Why is multiple inheritance not supported in java?


To reduce the complexity and simplify the language, multiple inheritance is not supported in java.
Consider a scenario where A, B, and C are three classes. The C class inherits A and B classes. 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.

Since the compile-time errors are better than runtime errors, Java renders compile-time error if you
inherit 2 classes. So whether you have the same method or different, there will be a compile time
error.

61) What is aggregation?


Aggregation can be defined as the relationship between two classes where the aggregate class
contains a reference to the class it owns. Aggregation is best described as a has-a relationship. For
example, The aggregate class Employee having various fields such as age, name, and salary also
contains an object of Address class having various fields such as Address-Line 1, City, State, and pin-
code. In other words, we can say that Employee (class) has an object of Address class. Consider the
following example.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

62) What is composition?


Holding the reference of a class within some other class is known as composition. When an object
contains the other object, if the contained object cannot exist without the existence of container
object, then it is called composition. In other words, we can say that composition is the particular
case of aggregation which represents a stronger relationship between two objects. Example: A class
contains students. A student cannot exist without a class. There exists composition between class
and students.

63) What is the difference between aggregation and composition?


Aggregation represents the weak relationship whereas composition represents the strong
relationship. For example, the bike has an indicator (aggregation), but the bike has an engine
(composition).

64) Why does Java not support pointers?


The pointer is a variable that refers to the memory address. They are not used in Java because they
are unsafe(unsecured) and complex to understand.

65) What is super in java?


The super keyword in Java is a reference variable that is used to refer to the immediate parent class
object. Whenever you create the instance of the subclass, an instance of the parent class is created
implicitly which is referred by super reference variable. The super() is called in the class constructor
implicitly by the compiler if there is no super or this.

67) What are the main uses of the super keyword?


There are the following uses of super keyword.

o super can be used to refer to the immediate parent class instance variable.
o super can be used to invoke the immediate parent class method.
o super() can be used to invoke immediate parent class constructor.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

68) What are the differences between this and super keyword?
There are the following differences between this and super keyword.

o The super keyword always points to the parent class contexts whereas this keyword always points to
the current class context.
o The super keyword is primarily used for initializing the base class variables within the derived class
constructor whereas this keyword primarily used to differentiate between local and instance variables
when passed in the class constructor.
o The super and this must be the first statement inside constructor otherwise the compiler will throw an
error.

70) Can you use this() and super() both in a constructor?


No, because this() and super() must be the first statement in the class constructor.

71)What is object cloning?


The object cloning is used to create the exact copy of an object. The clone() method of the Object
class is used to clone an object. The java.lang.Cloneable interface must be implemented by the
class whose object clone we want to create. If we don't implement Cloneable interface, clone()
method generates CloneNotSupportedException.

1. protected Object clone() throws CloneNotSupportedException


2.

72) What is method overloading?


Method overloading is the polymorphism technique which allows us to create multiple methods
with the same name but different signature. We can achieve method overloading in two ways.

o By Changing the number of arguments


o By Changing the data type of arguments

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Method overloading increases the readability of the program. Method overloading is performed to
figure out the program quickly.

73) Why is method overloading not possible by changing the return type in
java?
In Java, method overloading is not possible by changing the return type of the program due to avoid
the ambiguity.

74) Can we overload the methods by making them static?


No, We cannot overload the methods by just applying the static keyword to them(number of
parameters and types are the same). Consider the following example.

75) Can we overload the main() method?


Yes, we can have any number of main methods in a Java program by using method overloading.

76) What is method overloading with type promotion?


By Type promotion is method overloading, we mean that one data type can be promoted to another
implicitly if no exact matching is found.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

As displayed in the above diagram, the byte can be promoted to short, int, long, float or double. The
short datatype can be promoted to int, long, float or double. The char datatype can be promoted to
int, long, float or double and so on. Consider the following example.

78) What is method overriding:


If a subclass provides a specific implementation of a method that is already provided by its parent
class, it is known as Method Overriding. It is used for runtime polymorphism and to implement the
interface methods.

Rules for Method overriding

o The method must have the same name as in the parent class.
o The method must have the same signature as in the parent class.
o Two classes must have an IS-A relationship between them.

More Details.

79) Can we override the static method?


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

No, you can't override the static method because they are the part of the class, not the object.

80) Why can we not override static method?


It is because the static method is the part of the class, and it is bound with class whereas instance
method is bound with the object, and static gets memory in class area, and instance gets memory
in a heap.

81) Can we override the overloaded method?


Yes.

82) Difference between method Overloading and Overriding.

Method Overloading Method Overriding

1) Method overloading increases the Method overriding provides the specific implementation of
readability of the program. the method that is already provided by its superclass.

2) Method overloading occurs within Method overriding occurs in two classes that have IS-A
the class. relationship between them.

3) In this case, the parameters must In this case, the parameters must be the same.
be different.

83) Can we override the private methods?


No, we cannot override the private methods because the scope of private methods is limited to the
class and we cannot access them outside of the class.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

84) Can we change the scope of the overridden method in the subclass?
Yes, we can change the scope of the overridden method in the subclass. However, we must notice
that we cannot decrease the accessibility of the method. The following point must be taken care of
while changing the accessibility of the method.

o The private can be changed to protected, public, or default.


o The protected can be changed to public or default.
o The default can be changed to public.
o The public will always remain public.

85) Can we modify the throws clause of the superclass method while
overriding it in the subclass?
Yes, we can modify the throws clause of the superclass method while overriding it in the subclass.
However, there are some rules which are to be followed while overriding in case of exception
handling.

o If the superclass method does not declare an exception, subclass overridden method cannot declare
the checked exception, but it can declare the unchecked exception.
o If the superclass method declares an exception, subclass overridden method can declare same,
subclass exception or no exception but cannot declare parent exception.

87) Can you have virtual functions in Java?


Yes, all functions in Java are virtual by default.

88) What is covariant return type?

Now, since java5, it is possible to override any method by changing the return type if the
return type of the subclass overriding method is subclass type. It is known as covariant
return type. The covariant return type specifies that the return type may vary in the same
direction as the subclass.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

90) What is the final variable?


In Java, the final variable is used to restrict the user from updating it. If we initialize the final variable,
we can't change its value. In other words, we can say that the final variable once assigned to a value,
can never be changed after that. The final variable which is not assigned to any value can only be
assigned through the class constructor.

93) What is the final blank variable?


A final variable, not initialized at the time of declaration, is known as the final blank variable. We
can't initialize the final blank variable directly. Instead, we have to initialize it by using the class
constructor. It is useful in the case when the user has some data which must not be changed by
others, for example, PAN Number. Consider the following example:

94) Can we initialize the final blank variable?


Yes, if it is not static, we can initialize it in the constructor. If it is static blank final variable, it can be
initialized only in the static block. More Details.

95) Can you declare the main method as final?


Yes, We can declare the main method as public static final void main(String[] args){}.

98) Can we declare a constructor as final?


The constructor can never be declared as final because it is never inherited. Constructors are not
ordinary methods; therefore, there is no sense to declare constructors as final. However, if you try to
do so, The compiler will throw an error.

99) Can we declare an interface as final?

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

No, we cannot declare an interface as final because the interface must be implemented by some
class to provide its definition. Therefore, there is no sense to make an interface final. However, if you
try to do so, the compiler will show an error.

100) What is the difference between the final method and abstract method?
The main difference between the final method and abstract method is that the abstract method
cannot be final as we need to override them in the subclass to give its definition.

1) What is DBMS?
DBMS is a collection of programs that facilitates users to create and maintain a database. In other
words, DBMS provides us an interface or tool for performing different operations such as the
creation of a database, inserting data into it, deleting data from it, updating the data, etc. DBMS is
a software in which data is stored in a more secure way as compared to the file-based system. Using
DBMS, we can overcome many problems such as- data redundancy, data inconsistency, easy access,
more organized and understandable, and so on. There is the name of some popular Database
Management System- MySQL, Oracle, SQL Server, Amazon simple DB (Cloud-based), etc.

Working of DBMS is defined in the figure below.

2) What is a database?
A Database is a logical, consistent and organized collection of data that it can easily be accessed,
managed and updated. Databases, also known as electronic databases are structured to provide the
facility of creation, insertion, updating of the data efficiently and are stored in the form of a file or
set of files, on the magnetic disk, tapes and another sort of secondary devices. Database mostly
consists of the objects (tables), and tables include of the records and fields. Fields are the basic units
of data storage, which contain the information about a particular aspect or attribute of the entity
described by the database. DBMS is used for extraction of data from the database in the form of the
queries.

3) What is a database system?

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

The collection of database and DBMS software together is known as a database system. Through
the database system, we can perform many activities such as-

The data can be stored in the database with ease, and there are no issues of data redundancy and
data inconsistency.

The data will be extracted from the database using DBMS software whenever required. So, the
combination of database and DBMS software enables one to store, retrieve and access data with
considerate accuracy and security.

4) What are the advantages of DBMS?

o Redundancy control
o Restriction for unauthorized access
o Provides multiple user interfaces
o Provides backup and recovery
o Enforces integrity constraints
o Ensure data consistency
o Easy accessibility
o Easy data extraction and data processing due to the use of queries

5) What is a checkpoint in DBMS?


The Checkpoint is a type of mechanism where all the previous logs are removed from the system
and permanently stored in the storage disk.

There are two ways which can help the DBMS in recovering and maintaining the ACID properties,
and they are- maintaining the log of each transaction and maintaining shadow pages. So, when it
comes to log based recovery system, checkpoints come into existence. Checkpoints are those points
to which the database engine can recover after a crash as a specified minimal point from where the
transaction log record can be used to recover all the committed data up to the point of the crash.

6) When does checkpoint occur in DBMS?


A checkpoint is like a snapshot of the DBMS state. Using checkpoints, the DBMS can reduce the
amount of work to be done during a restart in the event of subsequent crashes. Checkpoints are

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

used for the recovery of the database after the system crash. Checkpoints are used in the log-based
recovery system. When due to a system crash we need to restart the system then at that point we
use checkpoints. So that, we don't have to perform the transactions from the very starting.

7) What do you mean by transparent DBMS?


The transparent DBMS is a type of DBMS which keeps its physical structure hidden from users.
Physical structure or physical storage structure implies to the memory manager of the DBMS, and it
describes how the data stored on disk.

8) What are the unary operations in Relational Algebra?


PROJECTION and SELECTION are the unary operations in relational algebra. Unary operations are
those operations which use single operands. Unary operations are SELECTION, PROJECTION, and
RENAME.

As in SELECTION relational operators are used for example - =,<=,>=, etc.

9) What is RDBMS?
RDBMS stands for Relational Database Management Systems. It is used to maintain the data records
and indices in tables. RDBMS is the form of DBMS which uses the structure to identify and access
data concerning the other piece of data in the database. RDBMS is the system that enables you to
perform different operations such as- update, insert, delete, manipulate and administer a relational
database with minimal difficulties. Most of the time RDBMS use SQL language because it is easily
understandable and is used for often.

10) How many types of database languages are?


There are four types of database languages:

o Data Definition Language (DDL) e.g., CREATE, ALTER, DROP, TRUNCATE, RENAME, etc. All these
commands are used for updating the data that?s why they are known as Data Definition Language.
o Data Manipulation Language (DML) e.g., SELECT, UPDATE, INSERT, DELETE, etc. These commands
are used for the manipulation of already updated data that's why they are the part of Data
Manipulation Language.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o DATA Control Language (DCL) e.g., GRANT and REVOKE. These commands are used for giving and
removing the user access on the database. So, they are the part of Data Control Language.
o Transaction Control Language (TCL) e.g., COMMIT, ROLLBACK, and SAVEPOINT. These are the
commands used for managing transactions in the database. TCL is used for managing the changes
made by DML.

Database language implies the queries that are used for the update, modify and manipulate the
data.

11) What do you understand by Data Model?


The Data model is specified as a collection of conceptual tools for describing data, data relationships,
data semantics and constraints. These models are used to describe the relationship between the
entities and their attributes.

There is the number of data models:

o Hierarchical data model


o network model
o relational model
o Entity-Relationship model and so on.

12) Define a Relation Schema and a Relation.


A Relation Schema is specified as a set of attributes. It is also known as table schema. It defines what
the name of the table is. Relation schema is known as the blueprint with the help of which we can
explain that how the data is organized into tables. This blueprint contains no data.

A relation is specified as a set of tuples. A relation is the set of related attributes with identifying key
attributes

See this example:

Let r be the relation which contains set tuples (t1, t2, t3, ..., tn). Each tuple is an ordered list of n-
values t=(v1,v2, ...., vn).

13) What is a degree of Relation?


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

The degree of relation is a number of attribute of its relation schema. A degree of relation is also
known as Cardinality it is defined as the number of occurrence of one entity which is connected to
the number of occurrence of other entity. There are three degree of relation they are one-to-
one(1:1), one-to-many(1:M), many-to-one(M:M).

14) What is the Relationship?


The Relationship is defined as an association among two or more entities. There are three type of
relationships in DBMS-

One-To-One: Here one record of any object can be related to one record of another object.

One-To-Many (many-to-one): Here one record of any object can be related to many records of
other object and vice versa.

Many-to-many: Here more than one records of an object can be related to n number of records of
another object.

15) What are the disadvantages of file processing systems?

o Inconsistent
o Not secure
o Data redundancy
o Difficult in accessing data
o Data isolation
o Data integrity
o Concurrent access is not possible
o Limited data sharing
o Atomicity problem

16) What is data abstraction in DBMS?


Data abstraction in DBMS is a process of hiding irrelevant details from users. Because database
systems are made of complex data structures so, it makes accessible the user interaction with the
database.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

For example: We know that most of the users prefer those systems which have a simple GUI that
means no complex processing. So, to keep the user tuned and for making the access to the data
easy, it is necessary to do data abstraction. In addition to it, data abstraction divides the system in
different layers to make the work specified and well defined.

17) What are the three levels of data abstraction?


Following are three levels of data abstraction:

Physical level: It is the lowest level of abstraction. It describes how data are stored.

Logical level: It is the next higher level of abstraction. It describes what data are stored in the
database and what the relationship among those data is.

View level: It is the highest level of data abstraction. It describes only part of the entire database.

For example- User interacts with the system using the GUI and fill the required details, but the user
doesn't have any idea how the data is being used. So, the abstraction level is entirely high in VIEW
LEVEL.

Then, the next level is for PROGRAMMERS as in this level the fields and records are visible and the
programmers have the knowledge of this layer. So, the level of abstraction here is a little low in VIEW
LEVEL.

And lastly, physical level in which storage blocks are described.

18) What is DDL (Data Definition Language)?


Data Definition Language (DDL) is a standard for commands which defines the different structures
in a database. Most commonly DDL statements are CREATE, ALTER, and DROP. These commands
are used for updating data into the database.

19) What is DML (Data Manipulation Language)?


DData Manipulation Language (DML) is a language that enables the user to access or manipulate
data as organized by the appropriate data model. For example- SELECT, UPDATE, INSERT, DELETE.

There is two type of DML:

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Procedural DML or Low level DML: It requires a user to specify what data are needed and how to
get those data.

Non-Procedural DML or High level DML:It requires a user to specify what data are needed without
specifying how to get those data.

20) Explain the functionality of DML Compiler.


The DML Compiler translates DML statements in a query language that the query evaluation engine
can understand. DML Compiler is required because the DML is the family of syntax element which
is very similar to the other programming language which requires compilation. So, it is essential to
compile the code in the language which query evaluation engine can understand and then work on
those queries with proper output.

21) What is Relational Algebra?


Relational Algebra is a Procedural Query Language which contains a set of operations that take one
or two relations as input and produce a new relationship. Relational algebra is the basic set of
operations for the relational model. The decisive point of relational algebra is that it is similar to the
algebra which operates on the number.

There are few fundamental operations of relational algebra:

o select
o project
o set difference
o union
o rename,etc.

22) What is Relational Calculus?


Relational Calculus is a Non-procedural Query Language which uses mathematical predicate calculus
instead of algebra. Relational calculus doesn't work on mathematics fundamentals such as algebra,
differential, integration, etc. That's why it is also known as predicate calculus.

There is two type of relational calculus:

o Tuple relational calculus


CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Domain relational calculus

23) What do you understand by query optimization?


The term query optimization specifies an efficient execution plan for evaluating a query that has the
least estimated cost. The concept of query optimization came into the frame when there were a
number of methods, and algorithms existed for the same task then the question arose that which
one is more efficient and the process of determining the efficient way is known as query
optimization.

There are many benefits of query optimization:

o It reduces the time and space complexity.


o More queries can be performed as due to optimization every query comparatively takes less time.
o User satisfaction as it will provide output fast

24) What do you mean by durability in DBMS?


Once the DBMS informs the user that a transaction has completed successfully, its effect should
persist even if the system crashes before all its changes are reflected on disk. This property is called
durability. Durability ensures that once the transaction is committed into the database, it will be
stored in the non-volatile memory and after that system failure cannot affect that data anymore.

25) What is normalization?


Normalization is a process of analysing the given relation schemas according to their functional
dependencies. It is used to minimize redundancy and also used to minimize insertion, deletion and
update distractions. Normalization is considered as an essential process as it is used to avoid data
redundancy, insertion anomaly, updation anomaly, deletion anomaly.

There most commonly used normal forms are:

o First Normal Form(1NF)


o Second Normal Form(2NF)
o Third Normal Form(3NF)
o Boyce & Codd Normal Form(BCNF)

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

26) What is Denormalization?


Denormalization is the process of boosting up database performance and adding of redundant data
which helps to get rid of complex data. Denormalization is a part of database optimization technique.
This process is used to avoid the use of complex and costly joins. Denormalization doesn't refer to
the thought of not to normalize instead of that denormalization takes place after normalization. In
this process, firstly the redundancy of the data will be removed using normalization process than
through denormalization process we will add redundant data as per the requirement so that we can
easily avoid the costly joins.

27) What is functional Dependency?


Functional Dependency is the starting point of normalization. It exists when a relation between two
attributes allow you to determine the corresponding attribute's value uniquely. The functional
dependency is also known as database dependency and defines as the relationship which occurs
when one attribute in a relation uniquely determines another attribute. It is written as A->B which
means B is functionally dependent on A.

28) What is the E-R model?


E-R model is a short name for the Entity-Relationship model. This model is based on the real world.
It contains necessary objects (known as entities) and the relationship among these objects. Here the
primary objects are the entity, attribute of that entity, relationship set, an attribute of that
relationship set can be mapped in the form of E-R diagram.

In E-R diagram, entities are represented by rectangles, relationships are represented by diamonds,
attributes are the characteristics of entities and represented by ellipses, and data flow is represented
through a straight line.

29) What is an entity?


The Entity is a set of attributes in a database. An entity can be a real-world object which physically
exists in this world. All the entities have their attribute which in the real world considered as the
characteristics of the object.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

For example: In the employee database of a company, the employee, department, and the
designation can be considered as the entities. These entities have some characteristics which will be
the attributes of the corresponding entity.

30) What is an Entity type?


An entity type is specified as a collection of entities, having the same attributes. Entity type typically
corresponds to one or several related tables in the database. A characteristic or trait which defines
or uniquely identifies the entity is called entity type.

For example, a student has student_id, department, and course as its characteristics.

31) What is an Entity set?


The entity set specifies the collection of all entities of a particular entity type in the database. An
entity set is known as the set of all the entities which share the same properties.

For example, a set of people, a set of students, a set of companies, etc.

32) What is an Extension of entity type?


An extension of an entity type is specified as a collection of entities of a particular entity type that
are grouped into an entity set.

33) What is Weak Entity set?


An entity set that doesn't have sufficient attributes to form a primary key is referred to as a weak
entity set. The member of a weak entity set is known as a subordinate entity. Weak entity set does
not have a primary key, but we need a mean to differentiate among all those entries in the entity set
that depend on one particular strong entity set.

34) What is an attribute?


An attribute refers to a database component. It is used to describe the property of an entity. An
attribute can be defined as the characteristics of the entity. Entities can be uniquely identified using
the attributes. Attributes represent the instances in the row of the database.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

For example: If a student is an entity in the table then age will be the attribute of that student.

35) What are the integrity rules in DBMS?


Data integrity is one significant aspect while maintaining the database. So, data integrity is enforced
in the database system by imposing a series of rules. Those set of integrity is known as the integrity
rules.

There are two integrity rules in DBMS:

Entity Integrity : It specifies that "Primary key cannot have a NULL value."

Referential Integrity: It specifies that "Foreign Key can be either a NULL value or should be the
Primary Key value of other relation

36) What do you mean by extension and intension?


Extension: The Extension is the number of tuples present in a table at any instance. It changes as
the tuples are created, updated and destroyed. The actual data in the database change quite
frequently. So, the data in the database at a particular moment in time is known as extension or
database state or snapshot. It is time dependent.

Intension: Intension is also known as Data Schema and defined as the description of the database,
which is specified during database design and is expected to remain unchanged. The Intension is a
constant value that gives the name, structure of tables and the constraints laid on it.

37) What is System R? How many of its two major subsystems?


System R was designed and developed from 1974 to 1979 at IBM San Jose Research Centre. System
R is the first implementation of SQL, which is the standard relational data query language, and it was
also the first to demonstrate that RDBMS could provide better transaction processing performance.
It is a prototype which is formed to show that it is possible to build a Relational System that can be
used in a real-life environment to solve real-life problems.

Following are two major subsystems of System R:

o Research Storage
o System Relational Data System

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

38) What is Data Independence?


Data independence specifies that "the application is independent of the storage structure and access
strategy of data." It makes you able to modify the schema definition at one level without altering
the schema definition in the next higher level.

It makes you able to modify the schema definition in one level should not affect the schema
definition in the next higher level.

There are two types of Data Independence:

Physical Data Independence: Physical data is the data stored in the database. It is in the bit-format.
Modification in physical level should not affect the logical level.

For example: If we want to manipulate the data inside any table that should not change the format
of the table.

Logical Data Independence: Logical data in the data about the database. It basically defines the
structure. Such as tables stored in the database. Modification in logical level should not affect the
view level.

For example: If we need to modify the format of any table, that modification should not affect the
data inside it.

39) What are the three levels of data abstraction?


Following are three levels of data abstraction:

Physical level: It is the lowest level of abstraction. It describes how data are stored.

Logical level: It is the next higher level of abstraction. It describes what data are stored in the
database and what relationship among those data.

View level: It is the highest level of data abstraction. It describes only part of the entire database.

For example- User interact with the system using the GUI and fill the required details, but the user
doesn't have any idea how the data is being used. So, the abstraction level is absolutely high in VIEW
LEVEL.

Then, the next level is for PROGRAMMERS as in this level the fields and records are visible and the
programmer has the knowledge of this layer. So, the level of abstraction here is a little low in VIEW
LEVEL.
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

And lastly, physical level in which storage blocks are described.

40) What is Join?


The Join operation is one of the most useful activities in relational algebra. It is most commonly used
way to combine information from two or more relations. A Join is always performed on the basis of
the same or related column. Most complex queries of SQL involve JOIN command.

There are following types of join:

o Inner joins: Inner join is of 3 categories. They are:


o Theta join
o Natural join
o Equi join
o Outer joins: Outer join have three types. They are:
o Left outer join
o Right outer join
o Full outer join

41) What is 1NF?


1NF is the First Normal Form. It is the simplest type of normalization that you can implement in a
database. The primary objectives of 1NF are to:

o Every column must have atomic (single value)


o To Remove duplicate columns from the same table
o Create separate tables for each group of related data and identify each row with a unique column

42) What is 2NF?


2NF is the Second Normal Form. A table is said to be 2NF if it follows the following conditions:

o The table is in 1NF, i.e., firstly it is necessary that the table should follow the rules of 1NF.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Every non-prime attribute is fully functionally dependent on the primary key, i.e., every non-key
attribute should be dependent on the primary key in such a way that if any key element is deleted,
then even the non_key element will still be saved in the database.

43) What is 3NF?


3NF stands for Third Normal Form. A database is called in 3NF if it satisfies the following
conditions:

o It is in second normal form.


o There is no transitive functional dependency.
o For example: X->Z

44) What is BCNF?


BCMF stands for Boyce-Codd Normal Form. It is an advanced version of 3NF, so it is also referred
to as 3.5NF. BCNF is stricter than 3NF.

A table complies with BCNF if it satisfies the following conditions:

o It is in 3NF.
o For every functional dependency X->Y, X should be the super key of the table. It merely means that X
cannot be a non-prime attribute if Y is a prime attribute.

45) Explain ACID properties


ACID properties are some basic rules, which has to be satisfied by every transaction to preserve the
integrity. These properties and rules are:

ATOMICITY: Atomicity is more generally known as ?all or nothing rule.' Which implies all are
considered as one unit, and they either run to completion or not executed at all.

CONSISTENCY: This property refers to the uniformity of the data. Consistency implies that the
database is consistent before and after the transaction.

ISOLATION: This property states that the number of the transaction can be executed concurrently
without leading to the inconsistency of the database state.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

DURABILITY: This property ensures that once the transaction is committed it will be stored in the
non-volatile memory and system crash can also not affect it anymore.

46) What is stored procedure?


A stored procedure is a group of SQL statements that have been created and stored in the database.
The stored procedure increases the reusability as here the code or the procedure is stored into the
system and used again and again that makes the work easy, takes less time in processing and
decreases the complexity of the system. So, if you have a code which you need to use again and
again then save that code and call that code whenever it is required.

47) What is the difference between a DELETE command and TRUNCATE


command?
DELETE command: DELETE command is used to delete rows from a table based on the condition
that we provide in a WHERE clause.

o DELETE command delete only those rows which are specified with the WHERE clause.
o DELETE command can be rolled back.
o DELETE command maintain a log, that's why it is slow.
o DELETE use row lock while performing DELETE function.

TRUNCATE command: TRUNCATE command is used to remove all rows (complete data) from a
table. It is similar to the DELETE command with no WHERE clause.

o The TRUNCATE command removes all the rows from the table.
o The TRUNCATE command cannot be rolled back.
o The TRUNCATE command doesn't maintain a log. That's why it is fast.
o TRUNCATE use table log while performing the TRUNCATE function.

48) What is 2-Tier architecture?


The 2-Tier architecture is the same as basic client-server. In the two-tier architecture, applications
on the client end can directly communicate with the database at the server side.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

49) What is the 3-Tier architecture?


The 3-Tier architecture contains another layer between the client and server. Introduction of 3-tier
architecture is for the ease of the users as it provides the GUI, which, make the system secure and
much more accessible. In this architecture, the application on the client-end interacts with an
application on the server which further communicates with the database system.

50) How do you communicate with an RDBMS?


You have to use Structured Query Language (SQL) to communicate with the RDBMS. Using queries
of SQL, we can give the input to the database and then after processing of the queries database will
provide us the required output.

51) What is the difference between a shared lock and exclusive lock?
Shared lock: Shared lock is required for reading a data item. In the shared lock, many transactions
may hold a lock on the same data item. When more than one transaction is allowed to read the data
items then that is known as the shared lock.

Exclusive lock: When any transaction is about to perform the write operation, then the lock on the
data item is an exclusive lock. Because, if we allow more than one transaction then that will lead to
the inconsistency in the database.

52) Describe the types of keys?


There are following types of keys:

Primary key: The Primary key is an attribute in a table that can uniquely identify each record in a
table. It is compulsory for every table.

Candidate key: The Candidate key is an attribute or set of an attribute which can uniquely identify
a tuple. The Primary key can be selected from these attributes.

Super key: The Super key is a set of attributes which can uniquely identify a tuple. Super key is a
superset of the candidate key.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Foreign key: The Foreign key is a primary key from one table, which has a relationship with another
table. It acts as a cross-reference between tables.

1) What is Software Engineering?


Software engineering is defined as the function of the systematic, disciplined, quantified approach
to the development, operations, and maintenance of software.

2) What are the elements to be considered in the System Model


Construction?
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Elements to be considered in the System Model Construction are:

o Assumption
o Simplification
o Limitation
o Constraints
o Preferences

3) What does a System Engineering Model accomplish?


System Engineering Model accomplishes the following:

o Define Processes that serve needs of view


o Represent behavior of process and assumption
o Explicitly define Exogenous and Endogenous Input
o It represents all Linkages that enable an engineer to understand aspect better.

4) Define Framework.
A framework is the Code Skeleton that can be fleshed out with particular classes or functionality and
designed to address the specific problem at hand.

5) What are the characteristics of the software?


Characteristics of the software are:

o Software is engineered, not manufactured.


o Software does not wear out.
o Most software is custom-built rather than being assembled from components.

6) What are the various categories of software?


The various categories of software are:

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o System software Application.


o Software Engineering / Scientific.
o Software Embedded software.
o Web Applications.
o Artificial Intelligence software.

7) What are the challenges in software?


The challenges in the software are:

o Copying with legacy systems.


o Heterogeneity challenge.
o Delivery times challenge.

8) Define Software process.


A software process is defined as the structured set of activities that are required to develop the
software system.

9) What are the internal milestones?


They are the significant and quantifiable attributes of progress. They are the standard methods in
the project which provide that we are on the right track. They are under the authority of the project
manager.

10) What is the limitation of RAD Model?


Limitation of RAD Model are:

o It requires a sufficient number of Human Resources to create enough number of teams.


o Developers and Users are not committed,the system fails.
o It is not Properly Modularized building component may be Problematic.
o It is not applicable when there is more possibility for Technical Risk.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

11) What are the disadvantages of classic life cycle model?


Disadvantages of the classic life cycle model are:

o Real projects rarely follow the sequential flow. Iteration always occurs and creates a problem.
o Challenging for the customer to state all requirements.
o The working version of the program is not available. So the customer must have patience.

12) What are the merits of the incremental model?


The merits of the incremental model are:

o The incremental model can be accepted when there is less number of people include in the
project.
o Technical risks can be handle with each increment.
o For a minimal period, at least the core product can be delivered to the user.

13) What is the disadvantage of the spiral model?


The disadvantage of the spiral model are:

1. It is based on user communication. If the interface is not proper, then the software product
which gets created will not be the up to the mark.
2. It demands a vast risk assessment. If the risk assessment is completed correctly, then only the
successful product can be obtained.

14) Name the Evolutionary process Models.


Evolutionary powers models are:

o Incremental model
o Spiral model
o WIN-WIN spiral model

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Concurrent Development

15) Define Software Prototyping.


Software prototyping is represented as rapid software development for validating the requirements.

16) What are the benefits of prototyping?


The benefits of prototyping are:

o Prototype services as a basis for developing system specification.


o Design quality can be revised.
o The system can be managed easily.
o Development efforts may get decreased.
o System usability can be upgraded.

17) What are the prototyping methods in software process?


The prototyping methods in the software process are:

o Evolutionary prototyping: In this method of system development, the initial prototype is


arranged, and it is then precise through the number of phases to the final stage.
o Throw-away prototyping: Using this method, a rough practical implementation of the
system is produced. The requirement issues can be identified from this implementation. It is
then rejected. System is then developed using some various engineering paradigm.

18) What are the advantages of evolutionary prototyping?


The advantages of evolutionary prototyping are:

o Fast delivery of the working system.


o User is contained while developing the system.
o The more useful system can be delivered.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

o Specification, design and implementation work in equivalent manner.

19) What are the various Rapid prototyping techniques?


The various rapid prototyping techniques are:

o Dynamic high-level language development.


o Database programming.
o Component and application assembly.

20) What are the uses of User-Interface Prototyping?


This prototyping is used to pre-specify the looks and effectively feel of customer interface.

21) What is the principle of the prototype model?


A prototype is built to quickly determine to the user what the product would look like. The only
minimal functionality of the actual product is supported during the prototyping phase.

22) Define System Context Diagram (SCD)?


System Context Diagram (SCD):

o Establish data boundary between System being implemented and Environment in which
system operates.
o Describes all external producers, external consumers, and entities that communicate through
the customer interface.

23) Define Quality Function Deployment (QFD)?


Quality Function Deployment (QFD) is a method that translates the needs of the user into a technical
requirement. It concentrates on maximizing user satisfaction from the software engineering process.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

24) What is Requirement Engineering?


Requirement engineering is the process of establishing services which the user required from the
system and constraint under which it operates and is developed.

25) What is ERD?


Entity Relationship Diagram is the graphical description of the object relationship pair. It is primarily
used in the database application.

26) What is DFD?


Data Flow Diagram depicts the data flow and the transforms which are applied to the data as it
moves from input to output.

27) What is a state transition diagram?


State transition diagram is a collection of states and events. The events cause the operation to
change its state. It also describes what actions are to be taken on the occurrence of particular events.

28) What is Software Quality Assurance?


Software Quality Assurance is a set of auditing and documenting functions that assess the
effectiveness and completeness of quality control activities.

29) What is the use of CMM?


Software Quality means Conformance to state functional explicitly and performance requirements,
explicitly documented development standards, inherent characteristics expected for professionally
developed software.

30) What is coupling?

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Coupling is the significant measure of the degree to which classes are linked to one another.
Coupling should be kept as low as possible.

31) What is cohesion?


Cohesion is the indication of the relative functional strength of a module. It is a natural extension of
Information Hiding and Performs a single task, requiring little integration with other components.

32) Define Refactoring.


Refactoring means changing a software system in a way that does not alter the external behavior of
code.

33) What is Software Architecture?


Software Architecture means the overall structure of the software and how that software provides
conceptual integrity for the system.

34) Define Stamp coupling.


When a portion of the data structure is passed via the module interface, then it is called as stamp
coupling.

35) Define common coupling.


When several modules reference a global data area, then the coupling is called common coupling.

36) Define temporal cohesion.


When a module contains tasks that are related by the fact that all must be executed within the same
period, then it is termed as temporal cohesion.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

37) Define metrics.


Metrics are defined as the degree to which a system component or process possesses a given
attribute.

38) What is COCOMO model?


Constructive Cost Model is a cost model, which gives the estimate of several staff-months it will take
to develop the software product.

39) What is the purpose of the timeline chart?


The objective of the timeline chart is to emphasize the scope of the individual task. Hence set of
functions are given as input to the timeline chart.

40) Define Smoke Testing?


Smoke testing is Integration Testing and frequently used when software products are being
developed.

41) What are the benefits of Smoke Testing?


Benefits of doing Smoke Testing are:

o Integration Risk is minimized.


o Quality of end-product is improved.
o Error diagnosis and Correction are simplified.
o Progress is easy to assess.

42) What is Equivalence Partition?


Equivalence Partitions Derives an input domain of a program into classes of data from which test
cases are derived. It is a Set of Objects have linked by relationships as Symmetric, Transitive, and
Reflexive an equivalence class is present.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

43) What are the steps followed in testing?


The steps followed in testing are:

o Unit testing: The individual elements are tested in this type of testing.
o Module testing: Related group of independent items is tested.
o Sub-system testing: This is a type of integration testing. Different modules are integrated
into a sub-system, and the entire subsystem is tested.
o System testing: The entire system is tested in this system.
o Acceptance testing: This type of testing contains testing of the system with user data if the
system behaves as per client need, then it is accepted.

44) Distinguish between Alpha and Beta testing.


Alpha and Beta testings are the two types of acceptance testing.

o Alpha test: The alpha testing is attesting in which the customer tests the version of complete
software under the supervision of the developer. This testing is implement at the developer's
site.
o Beta test: The beta testing is a testing in which the customer tests the version of the software
without the developer being present. This testing is performed at the customer's site.

45) What are the types of Static Testing tools?


There are the three types of static testing tools.

o Code-based testing tools: These tools take source code as input and generate test cases.
o Specialized testing tools: Using this language, the detailed test specification can be written
for each test case.
o Requirement-based testing tools: These tools help in designing as per user requirements.

46) Define maintenance.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

Maintenance is described as the process in which changes are implemented by either modifying the
existing system?s architecture or by adding new components to the system.

47) What are the types of software maintenance?


Types of software maintenance are:

Corrective Maintenance: It means the maintenance for correcting the software faults.

Adaptive maintenance: It means maintenance for adapting the change in environment.

Perfective maintenance: It means modifying or enhancing the system to meet the new
requirements.

Preventive maintenance: It means changes made to improve future maintainability.

48) What is CASE Tools?


CASE Tools stands for Computer-Aided Software Engineering. It is system software that provides
automated support for software process activities. It contains program used to support software
process operations such as Requirement Analysis, System Modeling. Debugging and Testing.

49) What is Risk management?


Risk management is the phase of anticipating hurdles in carrying out the original plan and providing
alternate methods so that the impact on the anticipated initially outcome is minimal.

CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

• Tell me about yourself?


• What do you know about this organization?
• Why should we hire you?
• What are your achievements in life?
• What is your objective in life?
• What are your strengths?
• What are your weaknesses?
• What are your hobbies?
• Explain, how would you be an asset to this organization?
• How do you get to know about our company?
CONTACT @ CS.KAIRI_SRV
COMPUTER SCIENCE & ENGINEERING- ASANSOL ENGINEERING COLLEGE

• What does success mean to you?


• Describe yourself in one word?
• How do you handle stress, pressure, and anxiety?
• What is the disappointment in your life?
• What makes you angry?
• What was the most difficult decision you have made in your past life?
• How do you deal with an angry or irritated customer?
• What are your expectations from the company?

CONTACT @ CS.KAIRI_SRV

You might also like