“In a day, when you don’t come across any problems – you can be sure that you are travelling in a wrong path” – Swami Vivekananda
TCS Technical Interview Questions
A linked list consists of two parts: information and the link. In the single connected listening, the beginning of the list is marked by a unique pointer named start. This pointer does point to the first element of the list and the link part of each node consists of an arrow looking to the next node, but the last node of the list has null pointer identifying the previous node. With the help of start pointer, the linked list can be traversed easily.
The four basic principles of Object-Oriented Programming System are listed below:
Abstraction: is a process of hiding the implementation details and showing only functionality to the user. For example, sending SMS where you type the text and send the message. You don't know the internal processing about the message delivery.
Abstraction lets you focus on what the object does instead of how it does it.
Inheritance: Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object.
Encapsulation: Encapsulation in Java is a process of wrapping code and data together into a single unit, for example, a capsule which is mixed of several medicines.
Polymorphism: Polymorphism in Java is a concept by which we can perform a single action in different ways. Polymorphism is derived from 2 Greek words: poly and morphs. The word "poly" means many and "morphs" means forms. So polymorphism means many forms.
//Base Class class A { public int a; } //Derived Class class B : A { a=15; }
Polymorphism is a concept in OOPS which means having many forms. In simple words, it means that different actions will be performed in different instances. Polymorphism is of two types:
1.Method overloading
2.Operator overloading
Types of Inheritance:
1.Single inheritance
2.Multiple Inheritance
3.Multi-level Inheritance
4.Multi-path Inheritance
5.Hierarchical Inheritance
6.Hybrid Inheritance
The differences between classes and interfaces are listed below:
A class can be instantiated by creating its object, whereas interfaces cannot be instantiated as all the methods in the interface are abstract and do not perform any action, so there is no use of instantiating an interface.
A class is declared using class keyword whereas an interface is declared using interface keyword.
The members of the class can have access specifier such as public, protected, and private but members of the interface can not have the access specifier, all the members of the interface is declared as public because the interface is used to derive another class. There will be no use to access specifies inside the members of an interface.
The methods inside the class are defined to perform some actions on the fields declared in the class whereas interface lacks in asserting in areas, the ways in an interface are purely abstract.
A class can implement any number of the interface but can only extend one superclass. Whereas interface can reach any number of interfaces but cannot perform any interface.
A class can have a constructor defined inside the class to declare the fields inside the class, whereas interface doesn't have any constructor defined because there are no fields to be initialized.
Software development life-cycle is steps involved in the life cycle of software development phase. Generally, it is followed by the development team which develops the software in the organization. It consists of a clear explanation of developing and maintaining the software.
Normalization is process of organizing data in a database efficiently. Two goals of the normalization process are: to eliminate redundant data (for example, storing the same data in more than one table) and also ensure data dependencies make sense (only storing related data in a table). These both are important as they reduce the amount of space a database consumes and ensure that data is logically stored.
Loops are used to execute block of statement several times in a program depending upon the conditional statement. The basic structure of a circuit is given above in the diagram. For each successful execution of the loop, the conditional statement should be checked. If the conditional statement is true, then the circuit will be executed. If the conditional statement is false, then the course will be terminated.
The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between specific columns in these tables.
Tables in a database are often related to each other with keys.
A view is a virtual table. A look contains rows and columns, just like a real table. The fields in a picture are fields from one or more real tables in the database.
You can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the data were coming from one single table.
Improved data sharing.
The list of several advantages of DataBase Management System:
1.Improved data security.
2.Better data integration.
3.Minimized data inconsistency.
4.Improved data access.
5.Improved decision making.
6.Increased end-user productivity.
A DataBase Management System is a software system used for creating and managing databases. DBMS make it possible for the end user to build and maintain databases. DBMS provides an interface between the end user/application and the databases.
The formal definition of the database schema is a set of formulas (sentences) called integrity constraints imposed on a database.
The conditional statements can alternatively be called as conditional expression also. Conditional comments are the set of rules which were executed if a particular condition is true. It is often referred to an if-then statement because if the state is true, then the statement is executed.
Reference Key is the primary key that is referenced in the other table (linked via the other tables Foreign Key). Foreign Key is how you connect the second table to the primary tables Primary Key (or Reference Key).
C++ has classes whereas C did not have classes.
C does not support function overloading. In C, for input or output, we use functions like gets(), puts(), scanf(), printf(), etc
C does not support exception handling.
Btree
It is made of branch nodes and leaf nodes. Branch nodes hold prefix key value along with the link to the leaf node and the leaf nodes contain the indexed value and rowed.
Bitmap
It consists merely of bits for every single distinct value. It uses a string of bits to locate rows in a table quickly. It is used to index low cardinality columns.
Clustered Index
1.Only one per table
2.Faster to read than non clustered as data is physically stored in index order
Non-Clustered Index
1.Can be used lot of times per table
2.Quicker for insert and update operations than a clustered index
Socket is the Combination of IP address and Port Number (in pairs)
The session is a Logical Connectivity between the source and destination.
An array is a collection of similar elements. For an array, the necessary condition is that the data type of all the elements in the array must be same. The declaration of an array in C++ is as follows:
int a[10];
This defines an array whose name is a and has ten elements from index 0-9
#include< stdio.h >
#include< conio.h >
void main()
{
int A[10]={'0','1','0','1','0','0','0','1','0','1','0','0'};
int x=0,y=A.length-1;
while(x
x++;
else if(A[y])
y--;
if(A[x] && !A[y])
A[x]=0,A[y]=1;
}
getch();
}
Abstraction is process of recognizing and focusing on essential characteristics of a situation or object and leaving/filtering out the unwanted components of that situation or object.
Abstraction is the basis for software development. It's through this concept we define the essential aspects of a system. The process of identifying and designing the ideas for a given system is called Modeling ( objectmodeling).
Three levels of data abstraction are:
1.Logical level: Information stored in the database. e.g., Database administrator
2.Physical level: Where data is stored physically in the database.
3.View level: End users always work on view level. If any amendment is made it may be saved by another name.
void swap(int &i, int &j) { i=i+j; j=i-j; i=i-j; }
The calloc() function allocates a memory area; the length will be the product of its parameters (it has two settings). calloc fills the memory with ZERO's and returns a pointer to the first byte. If that fails to locate enough space, it returns a NULL pointer.
A malloc() function allocates a memory area; length will be the value entered as parameter. (it has one parameter). It does not initialize memory area
The free() function is used to free the allocated memory(allocated through the calloc and malloc), in other words, this used release the allocated memory
new also used to allocate memory on the heap and initialize the memory using constructor
delete also used release memory allocated by new operator
int i=10;
printf("%d%d%d",i,++i,i++);
Answer= 10 12 12
Virtual function:- To achieve polymorphism, function in base class is declared as virtual. By state virtual, we make a base class pointer to execute the purpose of any derived class depends on the content of pointer (any acquired class address).
Pure Virtual Function:- This is the function used in base class, and its definition has to be provided in derived class, In other pure virtual function has no definition in the base is declared as :
virtual void fun()=0;
It means that this function is not going to do anything, In case of pure virtual function derived function has to
WPF/WCF application, need in .NET 3.0 Framework. These application will cover the following concepts:
WCF(Windows Communication Foundation)
1.The new service orientated attributes
2.The use of interfaces
3.The use of callbacks
4.Asynchronous delegates
5.Creating the proxy
WPF( Windows Presentation Foundation )
1.Styles
2.Templates
3.Animations
4.Databinding
/*
* C++ program to swap two numbers without using a temporary variable
*/
#include< iostream >
using namespace std;
/* Function for swapping the values */
void swap(int &a, int &b)
{
b = a + b;
a = b - a;
b = b - a;
}
int main()
{
int a, b;
cout << "Enter two numbers to be swapped : ";
cin >> a >> b;
swap(a, b);
cout << "The two numbers after swapping become :" << endl;
cout << "Value of a : " << a << endl;
cout << "Value of b : " << b << endl;
}
// file name: Main.java
class Complex {
private double re, im;
public Complex(double re, double it) {
this.re = re;
this.im = im;
}
}
// Driver class to test the Complex level
public class Main {
public static void main(String[] args) {
Complex c1 = new Complex(10, 15);
System.out.println(c1);
}
}
public class Prg {
public static void main(String args[]){
System.out.print("A" + "B" + 'A');
}
}
public class Prg {
public static void main(String args[]){
System.out.print('A' + 'B');
}
}
public class Prg {
public static void main(String[] args) {
char [] str={'i','n','c','l','u','d','e','h','e','l','p'};
System.out.println(str.toString());
}
public class pg {
public static void main(String[] args) {
System.out.print("Hello");
System.out.println("Guys!");
}
class Test2 {
ublic
static void main(String[] args)
{
byte x = 12;
byte y = 13;
byte result = x + y;
System.out.print(result);
}
#include < stdio.h >
union test {
int x;
char arr[8];
int y;
} u;
int main()
{
printf("%u", sizeof(u));
return 0;
}