Igate Technical Placement Papers - Igate Technical Interview Questions and Answers updated on 19.Mar.2024

Finalize method is implicitly called by GarbageCollector to delete the object if it is no longer in use whereas Dispose method is explicitly called inside a class through IDisposible interface to forcefully remove the object and its references.

In the .NET framework, the Types are of either Value type or reference type depending on, how they stored the value.

@Value type: if the data-type stores the value into its own memory space, it is called as a Value type. In value type, we can directly provide the values to the variable. Datatypes such as int, char, float, double, enum, struct, etc., are of value type.

 @Reference type: Reference type does not store value directly in the variable. It stores a pointer to another memory location, which stores the data. As reference type stores the address of the data, not actual data, so if we change in an address it will create another copy for the reference which will point to the same data. Example are objects, array, Classes, Interfaces, etc.

Delegate is an object that holds the reference to methods in c#. It is same as a function pointer in C.

There are some built-in DBMS packages provided by Oracle. With the help of Oracle DBMS packages, we can create various Oracle applications.

Following are some basic packages provided by Oracle:

Oracle dbms_alert

Oracle dbms_application_info

Oracle dbms_aqadm

Oracle dbms_crypto

Oracle dbms_fga

Oracle dbms_job

Oracle dbms_job.submit

Oracle dbms_lob

Oracle dbms_metadata

Oracle dbms_monitor

  • Serialization in Java is a process of converting the state of an object into a byte stream that can be sent across a network, or it can be saved as a file.
  • The reverse process is called as deserialization that me converting a byte stream into an object.
  • The byte stream in the process is platform independent or JVM independent.
  • We can use java.io.Serializable interface to create an object serializable. This interface is a marker interface, which does not contain any data member or method.
  • The two classes ObjectInputStream and ObjectOutputStream implement serialization in Java.

  • An Interface contains Methods with only signatures and no body.
  • An Abstract class contains method signatures with or without body.
  • A class can implement several interfaces inside it.A class can inherit from a single Abstract class.
  • By default, interface has public access modifiers.It cannot use any other access modifiers. An Abstract class can have any access modifiers.
  • No variables and constants can be defined in a class.An abstract class can have variables and constants.

A Linked list is a linear data structure similar to an array, which is used to store the data in an organized way.

In Linked list data elements are not stored in contiguous blocks.

 Applications of the Linked list:

  • A linked list can be used for implementations of stacks and queues.
  • Implementation of graphs can be done using the linked list
  • A linked list can be used for dynamic memory allocation
  • A linked list can be used for implementation of graph
  • It can be used for performing arithmetic operations on long integers.
  • A linked list can be used with the music player for playing the songs.

  • Daemon threads are the low priority thread for JVM. Which work as a service provider for the user threads.
  • Daemon threads are background programs, which perform tasks such as garbage collection.
  • Daemon threads cannot prevent JVM from exiting if all user thread has finished their execution.
  • If the program has only daemon thread and it is executing, still it will terminate the thread and will shut down itself.
  • The lifetime of daemon thread totally depends on user threads.

Methods for daemon thread:

1.public void setDaemon(boolean status): This method sets the current thread as user thread or daemon thread.

2.Boolean isDaemon(): This method checks whether the current thread is daemon or not. It returns the true or false Boolean value.

The itoa() function in C language used to convert an integer value to its equivalent null-terminated String. It stores the result in an array.

Syntax:

1.char *  itoa ( int value, char * str, int base );  

Parameters:

value: A value which needs to be converted

str: A parameter which stores the converted value as an array

base: It represents the numerical value, which is used to give the conversion base, as base 2 for binary, base 10 for decimal.

A postback is a request sent from a client to server from the same page user is already working with. When we refresh our page or we submit some page, then the data of the current page is send back to the server.

The C pre-processor is used to scan and modify a source code before its compilation. The line starting with the symbol # followed by the directive name, in the source code, is known as pre-processor directive. Pre-processor directive invoked by the compiler to process some code before the compilation process.

Each line in code can have a single pre-processor directive

Pre-processor directive does not include a semicolon at the end.

Header files are the files which contain macro definitions and functions definition. It used with pre-processor directives with a file extension of ".h."

There are two types of header files in C:

System header files: These header files come with the compiler

User-created header files: These files are written by the programmer.

Following are some mainly used header files in C

#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

#include<string.h>

#include<math.h>, and many more.

To create an interface in Java, we can use the keyword "interface" followed by the interface name.

Example

interface Employee {   

int empid = 23;  

String empname="John";  

}  

We can implement an interface in a class by using keyword "implement" and can use abstract methods.

In UML (Unified Modeling Language) there are various types of relationships for the object-oriented system. Association and Aggregation are also a type of relationship in UML.

Aggregation: Aggregation is a specific type of association between two or more objects. In Aggregation, objects can have their lifecycle with ownership. It is a one-directional association. If we destroy one object, it will not affect another one. It is also called as HAS-A relationship.

Association: Association is a relation between two objects with their own lifetime and without any ownership. An association relationship can be represented by the following type:

  • One-to-one
  • One-to-many
  • Many-to-many

The aggregation and composition are the part of the association.

The term encapsulation, Inheritance, and abstraction are the features of object-oriented programming. These features provide the facility to deal with the objects.

Encapsulation: Encapsulation is one of the primary features of OOPs concept. The process of binding the data and methods in a single unit is called as encapsulation.

With the help of encapsulation, we can hide the data members from other classes, and it is only accessible by its current class.

There are two ways to achieve encapsulation:

  • Modify the class variable as private.
  • Using public Setter and getter method to set and get the values.

Inheritance: - Inheritance in Java is a process by which on class can inherit the properties (methods and fields) of another class. It increases the reusability of methods and fields. We can use inherited methods and also can add new methods. Inheritance shows parent-child relationship also known as IS-A relationship.

There are the following terms used in inheritance:

Child class/Subclass: Child class or sub-class is one who inherits the other class.

Superclass/ Parent class: Superclass or Parent class is on which got inherited by another class. It is also known as base class. For inheriting one class, into another class we use extends keyword in Java.

Syntax for inheritance:

@class A extends B   

@{    

@   //methods and fields    

@}    

Where class A is child class, and class B is Parent class.

Abstraction: Abstraction is a one of the important Feature of OOPs concept, which helps a user to show only the functionality not the implementation details of the object. In Java languages we can achieve abstraction in two ways:

By using the abstract class (0 to 100%): A class which is declared using 'abstract' keyword is considered as an abstract class. An abstract class can have an abstract method as well as non-abstract methods.

Syntax:

1.abstract class A{  }  

By using interface (100%): An interface in Java is the same as a class in java, it can have abstract methods and variables. But it cannot have a method body. we can declare it by using the interface keyword

Syntax:

1.Interface Interface_Name{  

2.//Methods    }  

Organization of data in the computer can be done with the help of data structure so that data can be accessed easily and efficiently. There are different types of data structure used in computer, and two of them are Stack and Queue data Structure.

Stack: A stack is a type of linear-data structure, which logically represents and arrange the data in the form of a stack. As a real-life example of a stack is "plates arranged in the form of the stack." In a stack structure, any operation can be performed on data items from one end only.

A Stack structure follows a particular order for operation on data items, and that order can be LIFO (Last in First Out) or FILO (First in Last Out). A stack can be represented in the form of an array.

Types of Operations performed on Stack:

@Push: Push is an operation that can be performed, to add an element in the stack.

 As in the above diagram, the top element was 93 (before addition of a new element), and after performing PUSH operation, a top element is @Now pointer will point at the top of the stack.

@Pop: If we try to remove or delete an element from the Stack, then it is called as Pop operation.

 As in the above diagram, if we want to delete an element from the top of the Stack, then it can be done by the Pop operation.

@isEmpty: If we wanted to check whether the stack is empty or not, then we can perform an isEmpty operation. It will return three values: If we will perform a Pop operation on empty Stack, then it is called underflow condition.

 Empty     -1

Single element present 0

Stack is full N-1

Stack overflow N

@Peek or Top: If we perform Peek operation it checks all the elements of the stack and returns the top element.

Queue: A Queue is an ordered collection of data elements same as a stack, but it enables insertion operation from one end called as REAR end and deletion operation from other end called as a FRONT end.

A Queue structure follows an order of FIFO (First in First Out) for insertion and deletion of the data element.

Real life example of a queue is people waiting to buy a movie ticket in a line.

Types of Operations performed on Stack: The two main operations which can be performed

On Stack are Enqueue and Dequeue.

Enqueue:

This operation is performed to add an element in the queue at the rear end. After adding an element in a queue, the count of Rear pointer increased by @Below is the Array representation of queue with Enqueue operation.

Dequeue:

This operation is performed to remove an element from the queue at the front end. After removing an element from the queue, the count of Front pointer gets decremented by @Below is the diagram which shows the removal of the data element from a queue.

Other operations performed on the queue are:

Peek: This operation is used to get all the data elements of queue without deletion of an element, at the front end.

Isfull: This operation is performed to check whether a queue is full or not.

Isempty: This operation is performed to check whether a queue is empty or not.

The smallest package in Java API is java. applet package.

An interface is not a class but an object with a set of methods. The method inside an interface has only method definitions without ant body. An interface is used to implement multiple inheritance in code. This feature of an interface is quite different from that of abstract classes because a class cannot derive the features of more than one class but can easily implement multiple interfaces. Variables in interface must be declared as public, static, and final while methods must be public and abstract.

Session is more secure than View State as it is stored in server side memory and creates a unique session id for each session.

  • Value type contain variable and reference type does not containing any direct value. 
  • Memory is allocated in managed heap in reference type and in value type memory allocated in stack.
  • Example for Reference type –class, for value type-struct, enumeration

There two types of connection in Ado.Net.They are connected Architecture and disconnected architecture:

  • In connected architecture, we don't have to open and close the connection manually. A data-reader is used in connected architecture to read the data from the database row by row. This reduces the performance efficiency as we have to each time hit the server each time and the traffic for the server also increases.
  • In disconnected architecture, we have to manually open and close the connection. A data-set or data-table is used in disconnected architecture to read the data from the database at a time and store it in memory.

An assembly exists as a .DLL or .EXE that contains MSIL code that is executed by CLR. An assembly contains interface and classes, it can also contain other resources like bitmaps, files etc. It carries version details which are used by the CLR during execution. Two assemblies of the same name but with different versions can run side-by-side enabling applications that depend on a specific version to use assembly of that version.

String class is immutable in Java that me we are unable to change its value. It is because a String object is always cached in the String pool, and these pools can be shared between various clients. So there will always a risk that if we change in client's string it will automatically affect all the client's action. So every time when we try to change the String value, it will create a new object

In the Java language, we can use two types of variables that are static variable and non-static variable.

The main differences between both the variables are given below:

  • Static Variable Non- static Variable(instance variable)
  • To specify a static variable we need to use keyword static with the variable name To specify a non-static variable we do not need to use any keyword, we can simply give a variable name
  • Static variable belongs to its class, not the instance  Non-static variable belongs to the instance of the class.
  • Memory is allocated to the static variable, at the time of loading of the class  .Memory is allocated to non-static variable whenever we create a new object.
  • We can access the static variable with class reference We can access the non-static variable with an object reference
  • A static variable can be shared between all the instances of class.A non-static variable can be used for a single instance.

C and C++ both are the computer programming languages. Both the languages enable us to write efficient code. As C++ is an advanced version of C language, therefore it has some extra features than C languages.

The main advantages of C++ over the C language are given below:

  • As C++ is an object-oriented language, hence support the function overloading, whereas C language does not support function overloading.
  • C++ provides the property of data hiding, whereas C does not provide this feature
  • C++ supports exception handling, whereas C does not support the exception handling concept
  • C++ provides a concept of classes and objects, wherein C language there is no such concept.

An immutable class is one in which once an object is created, then we cannot alter the values, or we cannot change its content. As in Java, we have wrapper classes like String, Boolean, Integer, etc., all these classes are immutable classes, and we can also create an immutable class by own.

Following are some requirement to create an immutable class in Java:

  • A class needs to declare as final so that it cannot be inherited.
  • All the data members of the class need to declare as final so its value can't be changed.
  • No option for setters method.
  • There should be getter methods for all variables.

Data abstraction:

Data abstraction is a technique to hide the irrelevant internal details of data from the user. It makes an easier user interaction with the database. This technique creates an easier way of database designing.

There are three levels of data abstraction:

@Physical level

  • Physical level is the base level of data abstraction
  • It gives information that how data stored actually in the database
  • Give information to a developer about memory size, requirements, and accessing frequency of record.
  • This level uses the organization methods such as hashing, sequential, B+ tree, etc.

@Logical level

  • Logical level is the intermediate level for data abstraction
  • It describes what type of data is stored in the form of tables.
  • It also relates the data and tables with the help of mapping.
  • Any type of changes does not affect other levels

@View level

  • View level is the highest level of data abstraction.
  • At this level, a user can view the part of the actual database
  • A user can look at the data in the form of rows and column.
  • In this level, a user can interact with the database in an easier way
  • A User can see the data in various views for the same database.

A custom control is a loosely coupled control which can be used across various applications.
We need to only include its reference (.dll) to the project and it can be added to your toolbox.You can also keep it inside a class library.

Main difference between User Controls and Custom Controls are:

  • UC is specific to your application but CC can be used across various applications.
  • @CC can be added to your application toolbox but UC cannot be added to the toolbox.
  • CC defines UI in a Resource Dictionary whereas UC defines UI as a normal xaml page.
  • To create a UC just add a new webform and add its reference to your page by declaring @Register directive. But to create a CC we need to add then folder of the "wwwRoot" directory.Assemblies "System.Web.UI.Control" or "System.Web.UI.WebControls.WebControl". After the CC is created we need to add the dll into the bi

Following is a program for factorial of a number using Recursion in Java.

@public class Factoria{    

@  @ static int display(int n){      

@  if (n == 0)      

@    return 1;      

@  else      

@    return(n * display(n-1));      

@ }      

@ public static void main(String args[]){    

@  int i,  fact=1;    

@  int number=5;//It is the number to calculate factorial      

@  fact = display(number);     

@  System.out.println("Factorial of "+number+" is: "+fact);      

@ }    

@}   

Output:

Factorial of 5 is: 120

Interface in Java is a way to achieve the abstraction. An Interface is like a class and also can have methods and variable as a class does but Interface only contains method signature and does not have a body.

  • An Interface cannot be instantiated in Java
  • An Interface includes methods which are public and abstract (by default).
  • A class can implement an interface.
  • For declaring an interface, we use the keyword interface.

Syntax:

@Interface Interface_Name{  

@//Methods  

@}  

View State is one of the state management methods used to retain the page and it's control values between post backs. It Store the values of page or control properties that you define. One bit of state that does not need to be persisted across post-backs is the control's properties specified in the declarative syntax, since they are automatically reinstated in the page's instantiate stage. View State is a client side state management.

  • Whenever we create an object, it occupies some space in memory. And once it completes its task, we need to delete this object to free the memory, so that it can be used by another object. For this purpose, we have used garbage collection in Java.
  • Garbage collection in Java is a process which is used for automatic memory management.
  • It destroys or deletes the unused objects from the heap area of the memory.
  • We do not use any explicit method or function in Java for garbage collection as it is automatically performed by JVM.

A foreign key is a field in a table, used to create a link between two tables. It defined in one table but refer to the primary key of another table. A table which contains the foreign key is called the child table. And the table which includes the candidate key is called as parent table.

Some important points for foreign key:

A value for a foreign key can be NULL.

All values for foreign key should be present for all equivalent values of a primary key.

Following is a program for swapping two strings without using the third variable in Java

@public class Swap {    

@  public static void main(String args[]) {    

@     String a = "Hello";    

@     String b = "world";    

@    System.out.println("Before swap: " + a + " " + b);    

@     a=a+b;  

7.       b = a.substring(0, a.length() - b.length());    

8.    a = a.substring(b.length());    

9.     System.out.println("After swap: " + a + " " + b);   

@    }  }  

Output:

Before swap: Hello world

After swap: world Hello

Normalization is a technique of efficient database designing and organizing to achieve two basic requirements:

  1. Minimum redundancy of data
  2. Logical data integrity.

Normalization increases the performance of the database, as it allows a database to take very less space in memory.

There are mainly four types of Normalization, which are given below:

1NF: A relation in the table be in first normal form if each attribute is single value attribute

2NF

3NF

BCNF

Client-side state management: This maintains information on the client's machine using Cookies, View State, and Query Strings.

Cookies: A cookie is a small text file on the client machine either in the client's file system or memory of client browser session. Cookies are not good for sensitive data. Moreover, Cookies can be disabled on the browser. Thus, you can't rely on cookies for state management.

View State: Each page and each control on the page has View State property. This property allows automatic retention of page and controls state between each trip to server. This me control value is maintained between page postbacks. Viewstate is implemented using _VIEWSTATE, a hidden form field which gets created automatically on each page. You can't trmit data to other page using view state.

Querystring: Query strings can maintain limited state information. Data can be passed from one page to another with the URL but you can send limited size of data with the URL. Most browsers allow a limit of 255 characters on URL length.

Server-side state management: This kind of mechanism retains state in the server.

Application State: The data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.

 Session State: Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application's configuration settings. By default, SessionID values are stored in a cookie.

Database: Database can be used to store large state information. Database support is used in combination with cookies or session state.

An abstract class is a class that cannot be instantiated and is always used as a base class. We cannot instantiate an abstract class directly. This implies that we cannot create an object of the abstract class; it must be inherited. We can have abstract as well as non-abstract members in an abstract class. We must declare at least one abstract method in the abstract class. An abstract class is always public. An abstract class is declared using the abstract keyword. The basic purpose of an abstract class is to provide a common definition of the base class that multiple derived classes can share.

The size of a class depends on the size of its members. There are the following factors which determine the size of a class:

  • Size of all non-static members of the class
  • Size of its immediate parent class(if have)

Yes, we can check that a given link-list is circular or not. A link-list will be a circular link-list if it follows the two main requirements:

  1. If a link list is not null terminated( it points to the first node)
  2. If all nodes are connected in the form of cycle.