C Programming
C Programming
C Programming
Question 2: What is the difference between procedural and object oriented programming? [Infosys]
Answer:
Procedural – follows a step-by-step approach to break down a task into a collection of variables and
routines (or subroutines) through a sequence of instructions. Each step is carried out in order in a systematic
manner so that a computer can understand what to do. The program is divided into small parts called
functions and then it follows a series of computational steps to be carried out in order. It follows a top-down
approach to actually solve a problem, hence the name. Procedures correspond to functions and each function
has its own purpose. Dividing the program into functions is the key to procedural programming. So a number
of different functions are written in order to accomplish the tasks.
Object Oriented – OOP is a high-level programming language where a program is divided into small
chunks called objects using the object-oriented model, hence the name. This paradigm is based on objects
and classes.
Object – An object is basically a self-contained entity that accumulates both data and procedures to
manipulate the data. Objects are merely instances of classes.
Class – A class, in simple terms, is a blueprint of an object which defines all the common properties of one
or more objects that are associated with it. A class can be used to define multiple objects within a program.
The OOP paradigm mainly eyes on the data rather than the algorithm to create modules by dividing a
program into data and functions that are bundled within the objects. The modules cannot be modified when a
new object is added restricting any non-member function access to the data. Methods are the only way to
assess the data.
Question 8: What is the difference between primary key and unique constraints? [Infosys, TCS]
Answer: Primary key cannot have NULL value, the unique constraints can have NULL values. There is only
one primary key in a table, but there can be multiple unique constrains.
Question 11: What is Unique key constraint?(90% asked in Interview Questions for TCS)
Answer: The UNIQUE Constraint uniquely identifies each record in a database table. The UNIQUE and
PRIMARY KEY Constraints both provide a guarantee for Uniqueness for a column or set of columns. A
PRIMARY KEY Constraint automatically has a UNIQUE Constraint defined on it.
Note: You can have many UNIQUE Constraints per table, but only one PRIMARY KEY Constraint per
table is allowed.
Question 12: How to select first 5 characters from First name in Employee table?
Answer: Oracle Query:
Select Substr(0,5) from Employee;
Question 13: How to fetch all the records from Employee whose joining year is 2017?
Answer: Oracle:
select * from Employee where To_char(Joining_date,’YYYY’)=’2017′;
Question 14: What is mean by Sequence in database?(80 % asked in Interview Questions for TCS)
Answer:
Use the CREATE SEQUENCE statement to create a sequence, which is a database object from which
multiple users may generate unique integers. You can use sequences to automatically generate primary key
values. When a sequence number is generated, the sequence is incremented, independent of the transaction
committing or rolling back.
Once a sequence is created, you can access its values in SQL statements with the CURRVAL Pseudo
Column, which returns the current value of the sequence, or the NEXTVAL Pseudo Column, which
increments the sequence and returns the new value.
Question 14: What is join in SQL?(100% asked in Interview Questions for TCS)
Answer:
The most used concept in real life scenarios are nothing but SQL Joins.Although in reporting,stand alone
applications development,Web application development the concept of join is really important. Joins are
nothing but combining the records from two or more tables.
There are following 2 types of joins:
1. Joins using Operators -> Equi Join,Non Equi Join
2. Joins using Concept-> Inner Join,Outer Join,Cross Join,Self Join.
Question 19: Write an SQL SELECT statement to count the number of rows in STUDENT table and display
the result with the label NumStudents.
Answer:
SELECT COUNT(*) AS NumStudents FROM STUDENT;
Question 21: What does it mean when we say that a relation is in Boyce-Codd Normal Form (BCNF)?
Answer:
A relation is in BCNF when every determinant in the relation is a candidate key. This means that any
possible primary key can determine all other attributes in the relation. Attributes may not be determined by
non-candidate key attributes or part of a composite candidate key.
Question 23: Explain what we mean by an ACID transaction. [Infosys, TCS, Wipro]
Answer:
An ACID transaction is one that is atomic, consistent, isolated, and durable. Durable means that database
changes are permanent. Consistency can mean either statement level or transaction level consistency. With
transaction level consistency, a transaction may not see its own changes. There are four transaction isolation
levels: read committed, read uncommitted, repeatable read and serialization. Atomic means it is performed as
a unit.
Question 24: Briefly describe the four JDBC driver types that Sun defines. [Infosys, TCS, LG Soft]
Answer:
Type 1 drivers provide a bridge between Java and ODBC. Types 2-4 drivers are written entirely in Java, but
differ as to how they connect to the DBMS. Type 2 drivers rely on the DBMS product for inter machine
communication, if any. Type 3 drivers translate JDBC calls into a DBMS-independent network protocol.
Type 4 drivers translate JDBC calls into a DBMS-dependent network protocol.
Question 26: Describe the difference between embedded and dynamic SQL.
Answer:
Embedded SQL is the process of including hard coded SQL statements. These statements do not change
unless the source code is modified. Dynamic SQL is the process of generating SQL on the fly. The
statements generated do not have to be the same each time.
Question 27: Write Sql query to display the second highest salary of the employee.
Answer:
SELECT sal FROM emp ORDER BY sal DESC LIMIT 1, 1;
Question 28: Get employee details from employee table whose first name starts with 'J'.
Answer:
Select * from EMPLOYEE where FIRST_NAME like 'J%'
Answer: Data structure refers to methods of organizing units of data within larger data sets. Achieving and
maintaining specific data structures help improve data access and value. Data structures also help
programmers implement various programming tasks.
Question 2: List out the areas in which data structures are applied extensively?
a. Compiler Design
b. Operating System
c. Database Management System
d. Statistical
e. Analysis Package
f. Numerical Analysis
g. Graphics
h. Artificial Intelligence
Question 3: What are linear and Non Linear data Structures?
Answer:
Linear Data Structures: Those data structures where the data elements are organized in some sequence is
called linear data structure. Examples of linear data structures are array, stacks, queue, and linked list.
Non Linear Data Structures: When the data elements are organized in some arbitrary function without any
sequence, such data structures are called non-linear data structures. Examples of such type are trees, graphs.
Question 4: What are the major data structures used in the following areas: RDBMS, Network data model
and Hierarchical data model?
Question 5: If you are using C language to implement the heterogeneous linked list, what pointer type will
you use?
Answer: The heterogeneous linked list contains different data types in its nodes and we need a link, pointer
to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is
capable of storing pointer to any type as it is a generic pointer type.
Answer: Minimum number of queues needed to implement priority queue is two. One queue is used for the
actual storing of data, and the other one is used for storing the priorities.
Question 7: What is the data structures used to perform recursion? [Infosys, TCS,Webkul]
Answer: Stack has the LIFO (Last In First Out) property; it remembers it's ‘caller’. Therefore, it knows to
whom it should return when the function has to return. On the other hand, recursion makes use of the system
stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent
iterative procedures are written explicit, stack is to be used.
Question 8: What are the notations used in Evaluation of Arithmetic Expressions using prefix and
postfix forms?
Question 9: Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and Postfix
notations.
Postfix Notation: AB + C * DE – – FG + ^
Question 10: Sorting is not possible by using which of the following methods? (Insertion, Selection,
Exchange, Deletion)
Answer: Sorting is not possible in Deletion. Using insertion we can perform insertion sort, using selection
we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting
methods). But no sorting method can be done just using deletion.
Question 11: What are the methods available in storing sequential files?
Answer: Straight merging, Natural merging, Polyphase sort, and Distribution of Initial runs.
Answer: The manipulation of Arithmetic expression, Symbol Table construction, Syntax analysis.
Question 13: List out few of the applications that make use of Multilinked Structures?
Question 14: In tree construction which is the suitable efficient data structure? (Array, Linked list,
Stack, Queue)
Question 15: What is the type of the algorithm used in solving the 8 Queens problem?
Answer: Backtracking.
Answer: If the 'pivotal value' (or the 'Height factor') is greater than 1 or less than -1.
Question 17: What is the bucket size, when the overlapping and collision occur at same time?
Answer: One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to
accommodate the colliding value. This results in the overlapping of values.
Question 18: Classify the Hashing Functions based on the various methods by which the key value is
found.
Answer: Direct method, Subtraction method, Modulo-Division method, Digit-Extraction method, Mid-
Square method, Folding method, and Pseudo-random method.
Question 19: What are the types of Collision Resolution Techniques and the methods used in each of
the type?
Answer:
Open addressing (closed hashing), The methods used include: Overflow block.
Closed addressing (open hashing), The methods used include: Linked list, Binary tree.
Question 20: In RDBMS, what is the efficient data structure used in the internal storage
representation?
Answer:
B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This
corresponds to the records that shall be stored in leaf nodes.
Question 21: What is a spanning Tree?
Answer: A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree
once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is
minimized.
Question 22: Does the minimum spanning tree of a graph give the shortest distance between any 2 specified
nodes?
Answer: No. The Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But
it doesn't mean that the distance between any two nodes involved in the minimum-spanning tree is minimum.
Question 23: Which is the simplest file structure? (Sequential, Indexed, Random)
Answer: According to Access strategies Linked list is a linear one. According to Storage Linked List is a
Non-linear one.
Question 25: What are the various operations that can be performed on different Data Structures?
1. Traversing
2. Searching
3. Inserting
4. Deleting
5. Sorting
6. Merging
1. Traversing- It is used to access each data item exactly once so that it can be
processed.
2. Searching- It is used to find out the location of the data item if it exists in the given
3. Inserting- It is used to add a new data item in the given collection of data items.
4. Deleting- It is used to delete an existing data item from the given collection of data
items.
5. Sorting- It is used to arrange the data items in some order i.e. in ascending or
alphanumeric data.
6. Merging- It is used to combine the data items of two sorted files into single file in
the sorted form.
Answer: 1) The size of the arrays is fixed: So we must know the upper limit on the number of
elements in advance. Also, generally, the allocated memory is equal to the upper limit
irrespective of the usage, and in practical uses, upper limit is rarely reached.
(2) Inserting a new element in an array of elements is expensive, because room has to be
created for the new elements and to create room existing elements have to shifted.
Deletion is also expensive with arrays until unless some special techniques are used. For
1) Dynamic size
2) Ease of insertion/deletion
Answer: A stack is defined by having a LIFO (Last In First Out) ordering principle. The first element added
to a stack is the last to be removed. Equivalently, the last element added to a stack is the first to be removed.
Operations that act on a stack have a unique terminology:
Uses of Stack - undo\redo operation in word processors, Expression evaluation and syntax
Question 28: What is a Queue, how it is different from stack and how is it implemented?
Answer: Stack and Queue both are the non-primitive data structures. The main differences between stack
and queue are that stack uses LIFO (last in first out) method to access and add data elements whereas Queue
uses FIFO (First in first out) method to access and add data elements.
Stack has only one end open for pushing and popping the data elements on the other hand Queue has both
ends open for enqueuing and dequeuing the data elements. Stack and queue are the data structures used for
storing data elements and are actually based on some real world equivalent. For example, the stack is a stack
of CD’s where you can take out and put in CD through the top of the stack of CDs. Similarly, The queue is a
queue for Theatre tickets where the person standing in the first place, i.e., front of the queue will be served
first and the new person arriving will appear in the back of the queue (rear end of the queue).
Operators are written in-between their operands. This is the usual way we write expressions
Postfix notation (also known as "Reverse Polish notation"): X Y + Operators are written after their operands.
Prefix notation (also known as "Polish notation"): + X Y Operators are written before their operands.
Question 30: What is a Linked List and what are its types?
Answer: A Linked List is a linear data structure made up of multiple node elements that are linked together
using pointers. This allows the elements to be stored in different locations, allowing for a more optimal
storage of information. Linked Lists can be dynamic in size, and have more optimal insertion and deletion
than arrays. There are three common types of Linked List.
Question 31: Which data structures are used for BFS and DFS of a graph?
Answer: DFS uses stack to search through the data structures, whereas BFS uses queue.
Question 32: Can doubly linked be implemented using a single pointer variable in every node?
Answer: Yes, a doubly linked list can be implemented using a single pointer variable in every node. This
type of list is called a XOR Linked List or Memory Efficient. This is because it is called bitwise XOR
operation to save space for one address. In the XOR linked list, instead of storing actual memory addresses,
every node stores the XOR of addresses of previous and next nodes.
Answer: In push operation, the new element is always enqueued to q1. In pop() operation, if q2 is empty
then all the elements except the last, are moved to q2. Finally the last element is dequeued from q1 and
returned.
Enqueue:
Dequeue:
• If outbox is empty, refill it by popping each element from inbox and pushing it onto
outbox
Using this method, each element will be in each stack exactly once - meaning each element will be pushed
twice and popped twice, giving amortized constant time operations.
Question 35: Which Data Structure should be used for implementing LRU cache?
Answer: Queue which is implemented using a doubly linked list. The maximum size of the queue will be
equal to the total number of frames available (cache size).The most recently used pages will be near front
end and least recently pages will be near rear end. A Hash with page number as key and address of the
corresponding queue node as value.
Answer: A binary search tree (BST) is a node based binary tree data structure which has the following
properties.
• The left subtree of a node contains only nodes with keys less than the node’s key.
• The right subtree of a node contains only nodes with keys greater than the node’s key.
• Both the left and right subtrees must also be binary search trees.
Question 37: What's the major distinction in between Storage structure and file structure and how?
Answer: The representation of a particular data structure in the memory of a computer is called a storage
structure whereas a storage structure representation in auxiliary memory is often called a file structure.
Question 38: What are the applications of binary tree? [Infosys, TCS]
Answer: Binary Search Tree - Used in many search applications where data is constantly entering/leaving,
such as the map and set objects in many languages' libraries.
• Binary Space Partition - Used in almost every 3D video game to determine what objects need to be
rendered.
• Binary Tries - Used in almost every high-bandwidth router for storing router-tables.
• Hash Trees - used in p2p programs and specialized image-signatures in which a hash needs to be verified,
but the whole file is not available.
• Heaps - Used in implementing efficient priority-queues, which in turn are used for
• Huffman Coding Tree (Chip Uni) - used in compression algorithms, such as those used by the .jpeg and
.mp3 file-formats.
Answer: In computer science, divide and conquer is an algorithm design paradigm based on multi-branched
recursion. A divide and conquer algorithm works by recursively breaking down a problem into two or more
sub-problems of the same or related type, until these become simple enough to be solved directly.
Answer: Object Oriented Programming System is the programming technique to write programs based on
the real world objects. The states and behaviors of an object are represented as the member variables and
methods. In OOPS programming programs are organized around objects and data rather than actions and
logic.
1. Simplicity: OOPS programming objects model real world objects, so the complexity is reduced and
the program structure is clear.
2. Modularity: Each object forms a separate entity whose internal workings are decoupled from other
parts of the system.
3. Modifiability: It is easy to make minor changes in the data representation or the procedures in an
OO program. Changes inside a class do not affect any other part of a program, since the only public
interface that the external world has to a class is through the use of methods.
4. Extensibility: Adding new features or responding to changing operating environments can be solved
by introducing a few new objects and modifying some existing ones.
5. Maintainability: Objects can be maintained separately, making locating and fixing problems easier.
6. Reusability: Objects can be reused in different programs.
Question 3: What is the difference between Procedural programming and OOPS? [Infosys, TCS]
Answer:
1. Procedural language is based on functions but object oriented language is based on real world
objects.
2. Procedural language gives importance on the sequence of function execution but object oriented
language gives importance on states and behaviors of the objects.
3. Procedural language exposes the data to the entire program but object oriented language
encapsulates the data.
4. Procedural language follows top down programming paradigm but object oriented language follows
bottom up programming paradigm.
5. Procedural language is complex in nature so it is difficult to modify, extend and maintain but object
oriented language is less complex in nature so it is easier to modify, extend and maintain.
6. Procedural language provides less scope of code reuse but object oriented language provides more
scope of code reuse.
Answer:
1. Abstraction
2. Encapsulation
3. Polymorphism
4. Inheritance
5. Composition
6. Association
7. Aggregation
Question 5: What is Abstraction?
Answer: Abstraction is an OOPS concept to construct the structure of the real world objects. During this
construction only the general states and behaviors are taken and more specific states and behaviors are left
aside for the implementers.
Answer: Encapsulation is an OOPS concept to create and define the permissions and restrictions of an object
and its member variables and methods. A very simple example to explain the concept is to make the member
variables of a class private and providing public getter and setter methods. Java provides four types of access
level modifiers: public, protected, no modifier and private.
Question 7: What is the difference between Abstraction and Encapsulation? [Infosys, TCS, Wipro]
Answer:
1. “Program to interfaces, not implementations” is the principle for Abstraction and “Encapsulate what
varies” is the OO principle for Encapsulation.
2. Abstraction provides a general structure of a class and leaves the details for the implementers.
Encapsulation is to create and define the permissions and restrictions of an object and its member
variables and methods.
3. Abstraction is implemented in Java using interface and abstract class while Encapsulation is
implemented using four types of access level modifiers: public, protected, no modifier and private.
Answer:
Polymorphism is the occurrence of something in various forms. Java supports various forms of
polymorphism like polymorphic reference variables, polymorphic method, polymorphic return types and
polymorphic argument types.
Answer:
A subclass can inherit the states and behaviors of it’s super class is known as inheritance.
Answer:
A child class inheriting states and behaviors from multiple parent classes is known as multiple inheritance.
Answer: In case of multiple inheritance, suppose class A has two subclasses B and C, and a class D has two
super classes B and C.If a method present in A is overridden by both B and C but not by D then from which
class D will inherit that method B or C? This problem is known as diamond problem.
Question 12: Why Java does not support multiple inheritance? [Infosys, TCS, Mphasis]
Answer: Java was designed to be a simple language and multiple inheritance introduces complexities like
diamond problem. Inheriting states or behaviors from two different type of classes is a case which in reality
very rare and it can be achieved easily through an object association.
Answer: Static or early binding is resolved at compile time. Method overloading is an example of static
binding.
Dynamic or late or virtual binding is resolved at run time. Method overriding is an example of dynamic
binding.
Answer: “IS-A” relationship implies inheritance. A sub class object is said to have “IS-A” relationship with
the super class or interface. If class A extends B then A “IS-A” B. It is transitive, that is, if class A extends B
and class B extends C then A “IS-A” C. The “instanceof” operator in java determines the “IS-A”
relationship.
When a class A has a member reference variable of type B then A “HAS-A” B. It is also known as
Aggregation.
Answer: Aggregation is also known as “HAS-A” relationship. When class Car has a member reference
variable of type Wheel then the relationship between the classes Car and Wheel is known as Aggregation.
Aggregation can be understood as “whole to its parts” relationship.
Car is the whole and Wheel is part. Wheel can exist without the Car. Aggregation is a weak association.
Answer: Composition is a special form of Aggregation where the part cannot exist without the whole.
Composition is a strong Association. Composition relationship is represented like aggregation with one
difference that the diamond shape is filled.
Answer: When one class depends on another because it uses that at some point in time then this relationship
is known as Dependency. One class depends on another if the independent class is a parameter variable or
local variable of a method of the dependent class. A Dependency is drawn as a dotted line from the
dependent class to the independent class with an open arrowhead pointing to the independent class.
Answer: The main difference between Association and Dependency is in case of Association one class has
an attribute or member variable of the other class type but in case of Dependency a method takes an
argument of the other class type or a method has a local variable of the other class type.
Answer: An object is an instance of a class. It has its own state, behavior, and identity.
Java
Answer:
Structure Class
A struct is a value type. A class is a reference type.
Structures are stored as a stack on memory. class are stored as heap on memory.
Members of struct are public by default Members of a class are private by default
A structure can contain only data members A class can contain data members and member
functions.
Sizeof operator can be used with structure Sizeof operator can’t be used with class
Structure type variable can be created without using Class type variable (object) cannot be created
the new keyword. without using the new keyword
The member variable cannot be initialized directly The member variable can be initialized directly
Answer: Polymorphism is derived from 2 greek words: poly and morphs. The word "poly" means many
and "morphs" means forms. So polymorphism means many forms.
Example: Suppose if you are in class room that time you behave like a student, when you are in market at
that time you behave like a customer, when you at your home at that time you behave like a son or daughter,
Here one person present in different-different behaviors.
Answer: Inheritance is a concept where one class shares the structure and behavior defined in another class.
If inheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is
called multiple Inheritance.
Answer: A constructor is a method used to initialize the state of an object, and it gets invoked at the time of
object creation. Rules for constructor are:
Answer: A destructor is a method which is automatically called when the object is made of scope or
destroyed. Destructor name is also same as class name but with the tilde symbol before the name.
Answer: An inline function is a technique used by the compilers and instructs to insert complete body of the
function wherever that function is used in the program source code.
Answer: A virtual function is a member function of a class, and its functionality can be overridden in its
derived class. This function can be implemented by using a keyword called virtual, and it can be given
during function declaration.
Answer: A friend function is a friend of a class that is allowed to access to Public, private or protected data
in that same class. If the function is defined outside the class cannot access such information.
Answer: Function overloading an as a normal function, but it can perform different tasks. It allows the
creation of several methods with the same name which differ from each other by the type of input and output
of the function.
Example:
void add(int& a, int& b);
void add(double& a, double& b);
Answer: Operator overloading is a function where different operators are applied and depends on the
arguments. Operator,-,* can be used to pass through the function, and it has their own precedence to execute
Answer: An abstract class is a class which cannot be instantiated. Creation of an object is not possible with
an abstract class, but it can be inherited. An abstract class can contain only Abstract method. Java allows only
abstract method in abstract class while for other languages allow non-abstract method as well.
Answer: Finalize method helps to perform cleanup operations on the resources which are not currently
used. Finalize method is protected, and it is accessible only through this class or by a derived class.
Question 14: What is the super keyword?
Answer: Super keyword is used to invoke the overridden method which overrides one of its superclass
methods. This keyword allows to access overridden methods and also to access hidden members of the
superclass.
Answer:
Call by Value – Value passed will get modified only inside the function, and it returns the same value
whatever it is passed it into the function.
Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the
same or different value.
Answer: Method overriding is a feature that allows a subclass to provide the implementation of a method
that overrides in the main class. This will overrides the implementation in the superclass by providing the
same method name, same parameter and same return type.
Answer: An interface is a collection of an abstract method. If the class implements an inheritance, and then
thereby inherits all the abstract methods of an interface.
Answer: An exception is an event that occurs during the execution of a program. Exceptions can be of any
type – Runtime exception, Error exceptions. Those exceptions are adequately handled through exception
handling mechanism like try, catch and throw keywords.
Question 19: Differentiate between Overloading and Overriding ? [Infosys, TCS, Mphasis]
Answer: Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but
the same method with different arguments, and it may or may not return the same value in the same class
itself.
Overriding is the same method names with same arguments and return types associated with the class and its
child class.
Answer: An object is an instance of a class. Objects hold multiple information, but classes don’t have any
information. Definition of properties and functions can be done in class and can be used by the object.
Question 21: What are access modifiers in Java? [Infosys, TCS, Mphasis]
Answer: Access modifiers determine the scope of the method or variables that can be accessed from other
various objects or classes.
• Private.
• Protected.
• Public.
• Default
Question 22: How can we call the base method without creating an instance?
Answer: Yes, it is possible to call the base method without creating an instance. And that method should be
“Static method”.
Doing inheritance from that class.-Use Base Keyword from a derived class.
Answer: Early binding refers to the assignment of values to variables during design time whereas late
binding refers to the assignment of values to variables during run time.
Answer: “this” pointer refers to the current object of a class. THIS keyword is used as a pointer which
differentiates between the current object with the global object. Basically, it refers to the current object.
Answer: This is a special constructor for creating a new object as a copy of an existing object. There will
always be only one copy constructor that can be either defined by the user or the system.
Question 26: What is a base class, sub class, and super class?
Answer: The base class is the most generalized class, and it is said to be a root class.
A Sub class is a class that inherits from one or more base classes.
The superclass is the parent class from which another class inherits.
Answer: he ability to make different objects act on a platform is enabled with the concept of
Multithreading.Multithreading in Java gives the ability to execute code by different threads to perform
tasks in parallel or as a separate task without waiting for other to complete.
Answer: Java Database Connectivity (JDBC) is an application programming interface (API) for the
programming language Java, which defines how a client may access a database. It is a Java-based data
access technology used for Java database connectivity.
Question 29: Explain the meaning of public static void main() in Java ? [Infosys, TCS, Mphasis]
Answer:
public: It is an Access Modifier, which defines who can access this Method. public means that this method
will be accessible by any Class(If other Classes can access this Class.)
static: It is a keyword which identifies the class related thing. It means the given Method or variable is not
instance related but Class related. It can be accessed without creating the instance of a Class.
void: Is used to define the Return Type of the Method. It defines what the method can return. Void means the
Method will not return any value.
main() :It is the name of the Method. This Method name is searched by JVM as a starting point for an
application with a particular signature only.
String args[]: It is the parameter to the main Method. Argument name could be anything.
Subject: Operating Systems
• The operating system shares the Computer's memory and sharing of the central processing unit time
by various applications and peripheral devices.
• An operating system provides a user interface, i.e., graphical user interface and command line.
• An operating system includes functionality for booting the computer.
• Perform some basic tasks, i.e., managing the peripheral devices.
• It provides file management which refers to the way that operating system stores, retrieves,
manipulates, and saves data.
Answer: A thread is a lightweight sub-process, the smallest unit of processing. It is a separate path of
execution. Threads are independent that means if there is an exception in one thread, it doesn't affect other
threads. It uses a shared memory area.
The process is heavyweight and can consists of multiple threads. It is a small part of a program.
Question 3: What are the advantages of a thread? How does the multithreading look like?
Answer:
Answer:
Multitasking: As the name indicates multiple tasks run on a single CPU. We use multitasking to utilize the
CPU.
Multithreading: As the name indicates multiple threads run concurrently. A thread is a lightweight sub-
process, the smallest unit of processing.
Question 5: When is a thread created and started, what is its initial state?
Answer: A thread is created and started with its Initial state called "ready" state where a thread is ready to
run.
Answer: The entire task can't execute simultaneously so that a scheduler assign priorities to all tasks for its
execution. Priorities can be high or low depending on the task's importance, and the integer values determine
it. Higher priority gets CPU for execution first.
Answer:
Answer:
Answer: An Internet Protocol address (IP address) is a numerical label assigned to each device connected to
a computer network that uses the Internet Protocol for communication. An IP address serves two principal
functions: host or network interface identification and location addressing.
Answer:
Qu
esti
on
6:
Wh
at
are
diff
ere
nt
clas
ses
of
IP?
An
swe
r:
Answer: A port number is a way to identify a specific process to which an Internet or other network message
is to be forwarded when it arrives at a server. Port operates with Transport layer of OSI. For the
Transmission Control Protocol and the User Datagram Protocol, a port number is a 16-bit integer that is put
in the header appended to a message unit. This port number is passed logically between client and server
transport layers and physically between the transport layer and the Internet Protocol layer and forwarded on.
Answer: A socket is one endpoint of a two-way communication link between two programs running on the
network. A socket is bound to a port number so that the TCP layer can identify the application that data is
destined to be sent to. An endpoint is a combination of an IP address and a port number.
Answer: FTP is an acronym for File Transfer Protocol. As the name suggests, FTP is used to transfer files
between computers on a network. You can use FTP to exchange files between computer accounts, transfer
files between an account and a desktop computer, or access online software archives.
Answer: Telnet is a protocol that allows you to connect to remote computers (called hosts) over a TCP/IP
network (such as the internet). Using telnet client software on your computer, you can make a connection to
a telnet server (i.e., the remote host).
1. Hash Message Authentication Code (HMAC): It is a secret-key algorithm. It provides data integrity and
origin authentication through a digital signature that a keyed hash function produces.
2. Message Digest version (MD5): The MD5 algorithm is a hash function that can produce a 128-bit value.
3. Secure Hash Algorithm (SHA) for authentication: SHA is a hash function that can produce a 160-bit value
4. Data Encryption Standard (DES): It is an encryption algorithm that the US government defines and
endorses as an official standard. DES breaks a message into 64-bit cipher blocks and uses a 40-bit or 56-bit
key to encrypt each block.
5. DES-Cipher Block Chaining (CBC), and Triple DES (3DES) for encryption: When DES works under the
CBC mode (i.e., DES-CBC), DES applies an exclusive OR operation to each 64-bit plain-text block with the
previous cipher block before encrypting the block with the DES key. DES-CBC is more secure than DES. In
3DES, DES encrypts each cipher block three times, making 3DES far more secure than DES. The more
secure the algorithm IPSec uses, the more processing time the algorithm requires.
Answer: Digital Signature is a process that guarantees that the contents of a message have not been altered
in transit. When you, the server, digitally sign a document, you add a one-way hash (encryption) of the
message content using your public and private key pair.Your client can still read it, but the process creates a
"signature" that only the server's public key can decrypt. The client, using the server's public key, can then
validate the sender as well as the integrity of message contents.
Answer:
Introduction of IT companies, Personalities and Latest technologies
Answer:
Ashok Arora
Achievements: Infosys is the second-largest Indian IT company by 2017 revenues and 596th largest public
company in the world in terms of revenue. (Apple Inc. was the largest IT company in 2017)
Key persons: Nandan Nilekani (Chairman) Salil S. Parekh (CEO & MD)
Answer:
1. Satya Nadela: An Indian American Business Executive (Chief Executive Officer of Microsoft)
2. Bill Gates: William Henry Gates III (born October 28, 1955) is an American business magnate,
principal foundar of Microsoft Corporation
4. Steve Jobs: American businessman, co-founder, chairman, and CEO of Apple Inc.
7. Cyrus Mistry: An Irish businessman of Indian origin who was the chairman of Tata Group,
8. Nandan Nilekani: An Indian entrepreneur, bureaucrat and politician. He co-founded Infosys and is the
non executive chairman of Infosys
10. Vijay Shekhar Sharma: An Indian entrepreneur, founder of the company Paytm
Answer:
1. Machine Learning: Machine learning is an application of artificial intelligence (AI) that provides systems
the ability to automatically learn and improve from experience without being explicitly programmed.
Machine learning focuses on the development of computer programs that can access data and use it learn for
themselves.
1) Anomaly detection is the process of sifting through mountains of data and learning to identify
instances that deviate from recognized patterns. This technology enables credit card companies to
instantly identify potentially fraudulent transactions. It’s also used by email programs like Gmail
and Outlook to identify and filter out spam.
2) Natural language processing (NLP) enables computers to make sense of human language, whether
written or spoken. Turning unstructured language into structured data allows aggregators like Google
News to automatically sort news articles by subject. Consumer analytics companies use it to gauge
customer satisfaction, and legal tech companies are able to create searchable, organized databases of
legal opinions. When applied to human speech, NLP enables virtual assistants like Siri or Microsoft
Cortana to understand and respond to spoken requests.
3) Recommendation engines gather and analyze data about users’ behaviors and preferences to make
predictions about what users might like based on their similarity to other users. Services as diverse as
Amazon, Netflix, Spotify, and Tinder rely on recommendation engines to suggest new products,
movies, music, and dates to their users.
4) Named entity recognition is the ability to identify specific entities (like names, titles, actions,
addresses, etc.) in documents. This technology allows Apple’s Messages app to automatically
identify phone numbers and dates so that you can call a friend or save a date to your calendar with
just a tap.
5) Image recognition allows computers to extract meaning from still images and videos. This
technology enables the U.S. Postal Service to decipher handwritten addresses and Facebook and
other photo apps to detect and identify human faces. The startup Enlitic uses this technology to
analyze medical images like X-rays, CT scans, and MRIs to spot trends and anomalies.
2. Deep Learning (DL): Deep Learning, as a branch of Machine Learning, employs algorithms to process
data and imitate the thinking process, or to develop abstractions. Deep Learning (DL) uses layers of
algorithms to process data, understand human speech, and visually recognize objects. Information is passed
through each layer, with the output of the previous layer providing input for the next layer.
Common Applications of Deep Learning: Colorization of Black and White Images, Adding Sounds To
Silent Movies, Automatic Machine Translation, Object Classification in Photographs,
Automatic Handwriting Generation, Character Text Generation, Image Caption Generation, Automatic Game
Playing
3. Bitcoin: It is a peer-to-peer payment system and digital currency introduced as open source software in
2009 by pseudonymous developer Satoshi Nakamoto. It is a cryptocurrency, so-called because it uses
cryptography to control the creation and transfer of money. Users send payments by broadcasting digitally
signed messages to the network. Participants known as miners verify and timestamp transactions into a
shared public database called the block chain, for which they are rewarded with transaction fees and newly
minted bitcoins. Conventionally "Bitcoin" capitalized refers to the technology and network whereas
"bitcoins" lowercase refers to the currency itself. Bitcoins can be obtained by mining or in exchange for
products, services, or other currencies.
4. Blockchain: It is a distributed database system. This means, instead of storing files on a single computer,
information is stored across millions of computers all over the globe.
Consider this example: When we login to Facebook, all the content that we and our friends share on
Facebook are stored in Facebook’s central server. Facebook technically owns all of that data (even though
they claim that they don’t own our data); they use that data to target ads. Blockchain technology disrupts this
and gives end users the power to control their personally identifiable information.
Blockchain as the name suggests is a chain of blocks that are linked together one after the other. All nodes on
the network have the full replication of all transactions that have taken place on the blockchain ever since the
genesis block is mined. The ledger is open and the transaction between accounts will be displayed on the
ledger for the whole world to see. The transactions are cryptographically encrypted and the digital signature
of one block is used to encrypt the next block. This is a perpetual system and to modify one transaction in the
ledger is impossible. If an attack is tried, cryptographically encrypting all future blocks is computationally
and economically a very expensive task.
5. Industrial IOT: IIoT is the advanced form of IoT and it is used in industrial applications such as agriculture
and manufacturing. It can be used as a tool for predictive maintenance. In simplest of words, IIoT can tell an
Oil and Gas company how to minimise impending damage and disruption before a leakage occurs in a gas
pipeline, whereas in IoT, home users are informed when to feed their pets on time.
With the help of highly calibrated sensors, big data analytics, cheaper connectivity and the development in
machine learning, industries have started to implement predictive maintenance, much much of it supported
by IIoT. This allows the optimum time for maintenance procedures to be predicted then scheduled, so
lowering the cost of maintenance, which in turn helps the industry to become more efficient and deliver
faster.
6. Augmented Reality (AR): It is a general term for a collection of technologies used to blend computer
generated information with the viewer’s natural senses.
A simple example of AR is using a spatial display (digital projector) to augment a real world object (a wall)
for a presentation. As you can see, it’s not a new idea, but a real revolution has come with advances in
mobile personal computing such as tablets and smartphones.
Since mobile ‘smart’ devices have become ubiquitous, ‘Augmented Reality Browsers’ have been developed
to run on them. AR browsers utilise the device’s sensors (camera input, GPS, compass, et al) and
superimpose useful information in a layer on top of the image from the camera which, in turn, is viewed on
the device’s screen.
AR Browsers can retrieve and display graphics, 3D objects, text, audio, video, etc., and use geospatial or
visual ‘triggers’ (typically images, QR codes, point cloud data) in the environment to initiate the display.
7. Virtual Reality (VR): It is a technology which allows a user to interact with a computer -simulated
environment, whether that environment is a simulation of the real world or an imaginary world. It is the key
to experiencing, feeling and touching the past, present and the future. It is the medium of creating our own
world, our own customized reality. It could range from creating a video game to having a virtual stroll
around the universe, from walking through our own dream house to experiencing a walk on an alien planet.
W ith virtual reality,
We can experience the most intimidating and gruelling situations by playing safe and with a learning
perspective.
8. Hadoop: It is an Apache open source framework written in java that allows distributed processing of large
datasets across clusters of computers using simple programming models. A Hadoop frame-worked
application works in an environment that provides distributed storage and computation across clusters of
computers. Hadoop is designed to scale up from single server to thousands of machines, each offering local
computation and storage.
9. MapReduce: Hadoop MapReduce is a software framework for easily writing applications which process
big amounts of data in-parallel on large clusters (thousands of nodes) of commodity hardware in a reliable,
fault-tolerant manner.
The term MapReduce actually refers to the following two different tasks that Hadoop programs perform:
• The Map Task: This is the first task, which takes input data and converts it into a set of data, where
individual elements are broken down into tuples (key/value pairs).
• The Reduce Task: This task takes the output from a map task as input and combines those data
tuples into a smaller set of tuples. The reduce task is always performed after the map task.
10. NOSQL: It is a non-relational database management systems, different from traditional relational
database management systems in some significant ways. It is designed for distributed data stores where very
large scale of data storing needs (for example Google or Facebook which collects terabits of data every day
for their users). These type of data storing may not require fixed schema, avoid join operations and typically
scale horizontally.
In today’s time data is becoming easier to access and capture through third parties such as Facebook,
Google+ and others. Personal user information, social graphs, geo location data, user-generated content and
machine logging data are just a few examples where the data has been increasing exponentially. To avail the
above service properly, it is required to process huge amount of data. Which SQL databases were never
designed. The evolution of NoSql databases is to handle these huge data properly.
11. MongoDB: It is a NoSQL database which stores the data in form of key-value pairs. It is an Open
Source, Document Database which provides high performance and scalability along with data modelling
and data management of huge sets of data in an enterprise application.
MongoDB also provides the feature of Auto-Scaling. Since, MongoDB is a cross platform database and can
be installed across different platforms like Windows, Linux etc.
Like other NoSQL databases, MongoDB supports dynamic schema design, allowing the documents in a
collection to have different fields and structures. The database uses a document storage and data interchange
format called BSON, which provides a binary representation of JSON-like documents.
MongoDB was created by Dwight Merriman and Eliot Horowitz, who had encountered development and
scalability issues with traditional relational database approaches while building Web applications at
DoubleClick, an Internet advertising company that is now owned by Google Inc. According to Merriman, the
name of the database was derived from the word humongous to represent the idea of supporting large
amounts of data. Merriman and Horowitz helped form 10Gen Inc. in 2007 to commercialize MongoDB and
related software. The company was renamed MongoDB Inc. in 2013.
12. JSON: short for JavaScript Object Notation — is a format for sharing data. As its name suggests,
JSON is derived from the JavaScript programming language, but it’s available for use by many languages
including Python, Ruby, PHP, and Java. JSON is usually pronounced like the name “Jason.”
JSON uses the .json extension when it stands alone. When it’s defined in another file format (as in .html), it
can appear inside of quotes as a JSON string, or it can be an object assigned to a variable. This format is easy
to transmit between web server and client or browser.
Very readable and lightweight, JSON offers a good alternative to XML and requires much less formatting.
This informational guide will get you up to speed with the data you can use in JSON files, and the general
structure and syntax of this format.
13. Mahout: It is such a data mining framework that normally runs coupled with the Hadoop infrastructure
at its background to manage huge volumes of data. A mahout is one who drives an elephant as its master. The
name comes from its close association with Apache Hadoop which uses an elephant as its logo.
Hadoop is an open-source framework from Apache that allows to store and process big data in a distributed
environment across clusters of computers using simple programming models.
Apache Mahout is an open source project that is primarily used for creating scalable machine learning
algorithms. It implements popular machine learning techniques such as: Recommendation, Classification,
Clustering
14. Big Data: The term Big Data refers to all the data that is being generated across the globe at an
unprecedented rate. This data could be either structured or unstructured. Today’s business enterprises owe a
huge part of their success to an economy that is firmly knowledge-oriented. Data drives the modern
organizations of the world and hence making sense of this data and unravelling the various patterns and
revealing unseen connections within the vast sea of data becomes critical and a hugely rewarding endeavour
indeed. There is a need to convert Big Data into Business Intelligence that enterprises can readily deploy.
Better data leads to better decision making and an improved way to strategize for organizations regardless of
their size, geography, market share, customer segmentation and such other categorizations. Hadoop is the
platform of choice for working with extremely large volumes of data. The most successful enterprises of
tomorrow will be the ones that can make sense of all that data at extremely high volumes and speeds in order
to capture newer markets and customer base.
Big Data has certain characteristics and hence is defined using 4Vs namely:
Variety:the data that is generated is completely heterogeneous in the sense that it could be in various formats
like video, text, database, numeric, sensor dataand so on and hence understanding the type of Big Data is a
key factor to unlocking its value.
Veracity: knowing whether the data that is available is coming from a credible source is of utmost
importance before deciphering and implementing Big Data for business needs.
15. Spark: Apache Spark is a lightning-fast cluster computing technology, designed for fast computation. It
is based on Hadoop MapReduce and it extends the MapReduce model to efficiently use it for more types of
computations, which includes interactive queries and stream processing. The main feature of Spark is its in-
memory cluster computing that increases the processing speed of an application.
Spark is designed to cover a wide range of workloads such as batch applications, iterative algorithms,
interactive queries and streaming. Apart from supporting all these workload in a respective system, it reduces
the management burden of maintaining separate tools.
Spark Components:
Spark SQL
Spark SQL is a component on top of Spark Core that introduces a new data abstraction called SchemaRDD,
which provides support for structured and semi-structured data.
Spark Streaming
Spark Streaming leverages Spark Core's fast scheduling capability to perform streaming analytics. It ingests
data in mini-batches and performs RDD (Resilient Distributed Datasets) transformations on those mini-
batches of data.
MLlib (Machine Learning Library)
MLlib is a distributed machine learning framework above Spark because of the distributed memory-based
Spark architecture. It is, according to benchmarks, done by the MLlib developers against the Alternating
Least Squares (ALS) implementations. Spark MLlib is nine times as fast as the Hadoop disk-based version of
Apache Mahout (before Mahout gained a Spark interface).
GraphX
GraphX is a distributed graph-processing framework on top of Spark. It provides an API for expressing
graph computation that can model the user-defined graphs by using Pregel abstraction API. It also provides
an optimized runtime for this abstraction.
HR Questions
Prepare a very good resume and have a review with someone if possible.
1. Have all the other docs\marksheet with you (as you have to enter the each and every semester marks
before your written test)
2. Dress up well, a good formal dress, with fully trimmed, nicely combed (as everyone expect that)
3. Be Confident, Clear and Loud in the HR round (Don’t confuse them\Don’t make them to ask you for
your answers once again)
4. Have a firm handshake with the HR
5. Greet the HR with the Smile
6. Say Thank you while leaving if the HR appreciates you at anytime
7. Have faith in God as everything is possible in this world