Top 10 Mahindra-Comviva Interview Questions

Want to work for Mahindra-Comviva? Here we discuss some of the commonly asked interview questions in Online Placement Preparation Program.

What is normalization of table in DBMS?

Normalization is a process of organizing the data in database to avoid data redundancy, insertion anomaly, update anomaly & deletion anomaly. Let’s discuss about anomalies first then we will discuss normal forms with examples.

Anomalies in DBMS

There are three types of anomalies that occur when the database is not normalized. These are – Insertion, update and deletion anomaly. Let’s take an example to understand this.

Example: Suppose a textile company stores the employee details in a table named employee that has four attributes: emp_id for storing employee’s id, emp_name for storing employee’s name, emp_address for storing employee’s address and emp_dept for storing the department details in which the employee works. At some point of time the table looks like this:

emp_idemp_nameemp_addressemp_dept
101KrishnaDelhiD001
101KrishnaDelhiD002
123AshaAgraD890
166NishaChennaiD900
166NishaChennaiD004

The above table is not normalized. We will see the problems that we face when a table is not normalized.

Update anomaly: In the above table we have two rows for employee Krisha as he belongs to two departments of the company. If we want to update the address of Krisha then we have to update the same in two rows or the data will become inconsistent. If somehow, the correct address gets updated in one department but not in other then as per the database, Krishna would be having two different addresses, which is not correct and would lead to inconsistent data.

Insert anomaly: Suppose a new employee joins the company, who is under training and currently not assigned to any department then we would not be able to insert the data into the table if emp_dept field doesn’t allow nulls.

Delete anomaly: Suppose, if at a point of time the company closes the department D890 then deleting the rows that are having emp_dept as D890 would also delete the information of employee Maggie since she is assigned only to this department.

Explain OSI model and its layers

OSI stands for Open Systems Interconnection. It is a 7 layer architecture with each layer having specific functionality to performed. The Open Systems Interconnection (OSI) Model is a conceptual and logical layout that defines network communication used by systems to communicate with other systems.

There are 7 OSI layers: Physical Layer, Data Link Layer, Network Layer, Transport Layer, Session Layer, Presentation Layer and Application Layer.

Functions of Different Layers:
Layer 1: Physical layer

  • Physical layer coordinates the functions required to transmit a bit stream over physical medium
  • It activates, maintains and deactivates the physical connection.
  • It is responsible for transmission and reception of the unstructured raw data over network.
  • Voltages and data rates needed for transmission is defined in the physical layer.
  • It converts the digital/analog bits into electrical signal or optical signals.
  • Data encoding is also done in this layer.

Layer 2: Data Link Layer

  • The Data Link Layer transforms the physical layer, a raw transmission facility, to a reliable link and is responsible for node to node delivery
  • Transmitting and receiving data frames sequentially is managed by this layer.
  • This layer sends and expects acknowledgements for frames received and sent respectively. Resending of non-acknowledgement received frames is also handled by this layer.
  • This layer establishes a logical layer between two nodes and also manages the Frame traffic control over the network. It signals the transmitting node to stop, when the frame buffers are full.

Layer 3:Network Layer

  • The network layer is responsible for the source-to-destination delivery of packet possibly across multiple networks (links).
  • It acts as a network controller. It manages the Subnet traffic.
  • It decides by which route data should take.
  • It divides the outgoing messages into packets and assembles the incoming packets into messages for higher levels.

Layer 4:Transport Layer

  • The transport layer is responsible for source-to destination delivery of entire message.
  • It decides if data transmission should be on parallel path or single path.
  • Functions such as Multiplexing, Segmenting or Splitting on the data are done by this layer
  • It receives messages from the Session layer above it, convert the message into smaller units and passes it on to the Network layer.
  • Transport layer can be very complex, depending upon the network requirements.

Layer 5: Session Layer

  • The session layer is the network dialog Controller. It establishes, maintains and synchronizes the interaction between communication system.

Layer 6: Presentation Layer

  • The presentation layer is concerned with the syntax and semantics of information exchanged between two systems.
  • Presentation layer takes care that the data is sent in such a way that the receiver will understand the information (data) and will be able to use the data.
  • While receiving the data, presentation layer transforms the data to be ready for the application layer.
  • Languages (syntax) can be different of the two communicating systems. Under this condition presentation layer plays a role of translator.
  • It performs Data compression, Data encryption, Data conversion etc.

Layer7 : Application Layer

  • The application layer enables the user, whether human or software, to access the network. It provides user interfaces and support for services such as e-mail,
    shared database management and other types of distributed information services.
  • Transferring of files disturbing the results to the user is also done in this layer. Mail services, directory services, network resource etc are services provided by application layer.
  • This layer mainly holds application programs to act upon the received and to be sent data.

Write the code for calculating factorial of a number

C program to find factorial of given number using recursion

// function to find factorial of given number
 int factorial(int n) {
   if (n == 0)
     return 1;
   return n * factorial(n - 1);
 }
 int main() {
   int num = 5;
   printf("Factorial of %d is %d", num, factorial(num));
   return 0;
 }

What is the use of ‘protected’ access modifier in Java

The protected modifier specifies that the member can only be accessed within its own package (as with package-private) and, in addition, by a subclass of its class in another package.
Protected is member level access modifier.It cannot be applied to classes and interface

Example for explaining protected access

/**Addition.java **/
 package abcpackage;
 public class Addition {
 protected int addTwoNumbers(int a, int b) {
     return a + b;
   }
 }
 /Test.java/
 package xyzpackage;
 import abcpackage.*;
 class Test extends Addition {
   public static void main(String args[]) {
     Test obj = new Test();
     System.out.println(obj.addTwoNumbers(11, 22)); //protected method can be accessed from child class in different package
   }
 }

What is deadlock in operating System?

In a multiprogramming environment, several processes may compete for a finite number of resources. A process requests resources, if the resources are not available at that time, the process enters a waiting state.

Sometimes a waiting process is never again able to change state, because the resources it has requested are held by other waiting processes. This situation is called deadlock

What are joins in SQL?

SQL Join is used to fetch data from two or more tables, which is joined to appear as single set of data. It is used for combining column from two or more tables by using values common to both tables.

Here are the different types of the JOINs in SQL:

  • (INNER) JOIN: Returns records that have matching values in both tables
  • LEFT (OUTER) JOIN: Return all records from the left table, and the matched records from the right table
  • RIGHT (OUTER) JOIN: Return all records from the right table, and the matched records from the left table
  • FULL (OUTER) JOIN: Return all records when there is a match in either left or right table

What is Inheritance in Java. Does Java support multiple Inheritances ?

The idea behind inheritance is that you create new classes that built on existing classes.When you inherit from an existing class, you reuse(or inherit) its methods and you can add new methods and fields to adapt your new class to new requirements.

For example “Delivery Order” class inherits from an “Order” class. The specialized “Delivery Order” has specialized method for delivering the order and computing shipping charges , but its other methods such as adding items and billing are inherited from Order class. In general , if class A extends B, class A inherits methods from class B but has more capabilities than class B.

class DeliveryOrder extends Order {
  //methods and fields
}

The keyword extends indicates that you are making a new class that derives from an existing class. The existing class is called Superclass, base class or parent class. The new class is called the subclass, derived class or child class.

No Java does not support Multiple Inheritance

What are inline functions in C++?

Inline function is one of the important feature of C++. Sometimes, the execution time of function is less than the switching time from the caller function to called function . Inline functions is used to reduce the function call overhead. If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.

To inline a function, place the keyword inline before the function name and define the function before any calls are made to the function.The compiler can ignore the inline qualifier in below mentioned cases:

  • If a function contains a loop. (for, while, do-while)
  • If a function contains static variables.
  • If a function is recursive.
  • If a function return type is other than void, and the return statement doesn’t exist in function body.
  • If a function contains switch or goto statement.

Syntax for defining the function inline is:

inline return -type
function -name(parameters) {
  // function code
}

All the functions defined inside the class are implicitly inline.

What is virtual function in C++?

C++ virtual function is a member function in base class that you redefine in a derived class. It is declared using the virtual keyword. It is used to tell the compiler to perform dynamic linkage or late binding on the function.
In late binding function call is resolved during runtime. Therefore compiler determines the type of object at runtime, and then binds the function call. Virtual functions are mainly used to achieve Runtime polymorphism
Example of Virtual Function:

class base {
  public:
    virtual void print() {
      cout << “print base class” < print();

      // Non-virtual function, binded at compile time
      bptr - > show();
    }

Output:
print derived class
show base class

What are the differences between TCP and UDP

TCP(Transmission Control Protocol): It is a reliable connection-oriented protocol which handles byte-stream from source to destination without error and flow control.

UDP(User-Datagram Protocol): It is an unreliable connection-less protocol that do not want TCPs, sequencing and flow control. Eg: One-shot request-reply kind of service.

Previous post Top 10 Cognizant Interview Questions
Next post How to prepare for an interview?

Leave a Reply

Your email address will not be published. Required fields are marked *