Top 50 TCS Interview Questions & Answers

Top 50 TCS Interview Questions & Answers(Technical Round)


 1. What is your strongest programming language (Java, ASP, C, C++, VB, HTML, C#, etc.)?

Important point: Before the interview, you should decide your Favorite programming language and be prepared based on that question.

2. What is friend function?

  • A friend function for a class is used in object-oriented programming to allow access to public, private, or protected data in the class from the outside.
  • Normally, a function that is not a member of a class cannot access such information; neither can an external class. Occasionally, such access will be advantageous for the programmer.
  • Under these circumstances, the function or external class can be declared as a friend of the class using the friend keyword.

3. What is the difference between an array and a list?

  • The array is a collection of homogeneous elements. A list is a collection of heterogeneous elements.
  • For Array memory allocated is static and continuous. For List memory allocated is dynamic and Random.
  • Array: User need not have to keep track of next memory allocation.
  • List: The user has to keep track of the next location where memory is allocated.
  • The array uses direct access of stored members, list uses sequential access for members.

4. What are the four basic principles of OOPS?

The four basic principles of Object-Oriented Programming System are listed below:

  • Abstraction: 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 of 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 behaviours 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 that is mixed with 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.

5. What is Memory Alignment?

Data structure alignment is the way data is arranged and accessed in computer memory. It consists of two separate but related issues: data alignment and data structure padding.

6. What is Polymorphism?

Polymorphism is a concept in OOPS that means having many forms. In simple words, it means that different actions will be performed in different instances.

Polymorphism is of two types:

  • Method overloading
  • Operator overloading

7. What is data structure?

  • A data structure is a way of organizing data that considers not only the items stored but also their relationship to each other.
  • Advance knowledge about the relationship between data items allows the designing of efficient algorithms for the manipulation of data.

8. Differences between C and Java?

JAVA 

1. Object-Oriented 

2. Interpreted language 

3. High-level language 

5. Method Overloading 

C

  1. Procedural
  2. Compiled language
  3. Top-down approach
  4. No overloading at all.

9. What is Cryptography?

  • Cryptography is the science of enabling secure communications between a sender and one or more recipients.
  • This is achieved by the sender scrambling a message (with a computer program and a secret key) and leaving the recipient to unscramble the message (with the same computer program and a key, which may or may not be the same as the sender's key).

10. What are the different storage classes in C?

There are four types of storage classes in CP:-

Extern

Register

Auto

Static

11. What is a Static identifier?

  • The static identifier is used for initializing only once, and the value retains during the lifetime of the program/application.
  • A separate memory is allocated for static variables. This value can be used between function calls. The default value of an uninitialized static variable is zero.
  • A function can also be defined as a static function, which has the same scope as the static variable.

12. In header files whether functions are declared or defined?

Functions are declared within the header file. That is function prototypes exist in a header file, not function bodies. They are defined in the library (lib).

13. What is an interrupt?

An interrupt is an asynchronous signal informing a program that an event has occurred. When a program receives an interrupt signal, it takes a specified action.

14. What does a Static variable mean?

  • Static is an access qualifier. If a variable is declared as static inside a function, the scope is limited to the function, but it will exist for the lifetime of the program.
  • Values will be persisted between successive calls to a function

15.  What is Memory Alignment?

  • Data structure alignment is the way data is arranged and accessed in computer memory.
  • It consists of two separate but related issues: data alignment and data structure padding.

16. What are Macros? What are its advantages and disadvantages?

  • Macros are processor directives that will be replaced at compile time.
  • The disadvantage with macros is that they just replace the code they do not function call. similarly, the advantage is they can reduce the time for replacing the same values.

17. What is the difference and similarity between C and C++?

  • 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.

18. Difference between pass by reference and pass by value?

  • Pass by value just passes the value from caller to calling function so the called function cannot modify the values in caller function.
  • But Pass by reference will pass the address to the caller function instead of value if called function requires to modify any value it can directly modify

19. What is the difference between the foreign key and reference key?

  • 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).

20. What is the difference between class and structure?

Structure: Initially (in C) a structure was used to bundle different types of data types together to perform a particular functionality. But C++ extended the structure to contain functions also.

The major difference is that all declarations inside a structure are by default public.

Class: Class is a successor of Structure. By default all the members inside the class are private.

21. What is Database Schema?

The formal definition of the database schema is a set of formulas (sentences) called integrity constraints imposed on a database.

22. What is the difference between null and void pointer?

A Null pointer has the value 0. void pointer is a generic pointer introduced by ANSI. The generic pointer can hold the address of any data type.

23. List different advantages of DBMS?

The list of several advantages of Database Management System is:

  • Improved data security.
  • Better data integration.
  • Minimized data inconsistency.
  • Improved data access.
  • Improved decision making.
  • Increased end-user productivity.

24. What is function overloading and operator overloading?

  • Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned).
  • This capability is called function overloading.
  • When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order of the arguments in the call.
  • Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.
  • Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls.
  • They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).

25. What are loops?

  • Loops are used to execute a block of statements several times in a program depending upon the conditional statement.
  • 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.

26. What is the difference between realloc() and free()?

  • The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer.
  • If the Pointer parameter is a null value, no action will occur.
  • The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block.
  • The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines.
  • Undefined results occur if the Pointer parameter is not a valid pointer.

27. What is the normalization of databases, joins, and keys?

  • Normalization is the 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.

28. Can you list out the areas in which data structures are applied extensively?

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

29.  What is the software development life-cycle?

  • Software development life-cycle is steps involved in the life cycle of the 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.

30. What are the advantages of inheritance?

  • It permits code reusability.
  • Reusability saves time in program development.
  • It encourages the reuse of proven and debugged high-quality software, thus reducing problems after a system becomes functional.

31. What are the different types of inheritance?

Types of Inheritance:

  • Single inheritance
  • Multiple Inheritance
  • Multi-level Inheritance
  • Multi-path Inheritance
  • Hierarchical Inheritance
  • Hybrid Inheritance

32. What are the two integrity rules used in DBMS?

  • The two types of integrity rules are referential integrity rules and entity integrity rules. Referential integrity rules dictate that a database does not contain orphan foreign key values.
  • This means that a primary key value cannot be modified if the value is used as a foreign key in a child table. Entity integrity dictates that the primary key value cannot be Null.

33. What exactly is a digital signature?

  • Just as a handwritten signature is affixed to a printed letter for verification that the letter originated from its purported sender, a digital signature performs the same task for an electronic message.
  • A digital signature is an encrypted version of a message digest, attached together with a message.

34. What is a Doubly linked list?

  • A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes.
  • Each node contains two fields, called links, that are references to the previous and to the next node in the sequence of nodes.
  • The beginning and ending nodes' previous and next links, respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate traversal of the list.
  • If there is only one sentinel node, then the list is circularly linked via the sentinel node.
  • It can be conceptualized as two singly linked lists formed from the same data items but in opposite sequential orders.

35. What is a static identifier?

  • The static identifier is used for initializing only once, and the value retains during the lifetime of the program/application.
  • A separate memory is allocated for static variables. This value can be used between function calls. The default value of an uninitialized static variable is zero.
  • A function can also be defined as a static function, which has the same scope as the static variable.

36. What is Data abstraction?

Abstraction is the process of recognizing and focusing on important characteristics of a situation or object and leaving/filtering out the unwanted characteristics of that situation or object.

  • Abstraction is the basis for software development. It's through abstraction we define the essential aspects of a system.
  • The process of identifying the abstractions for a given system is called Modeling (or object modelling).

37. What are enumerations?

  • An enumeration is a data type, used to declare variables that store a list of names.
  • It acts like a database, which will store a list of items in the variable.

38. What is Cache memory?

  • Cache Memory is used by the central processing unit of a computer to reduce the average time to access memory.
  • The cache is a smaller, faster memory that stores copies of the data from the most frequently used main memory locations.
  • As long as most memory accesses are cached memory locations, the average

latency of memory accesses will be closer to the cache latency than to the latency of main memory.

39. What do you know about the garbage collector?

  • Garbage collection is the systematic recovery of pooled computer storage that is being used by a program when that program no longer needs the storage.
  • This frees the storage for use by other programs

(or processes within a program). It also ensures that a program using increasing amounts of pooled storage does not reach its quota (in which case it may no longer be able to function).

40. What is a Spanning Tree?

  • 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.

41. What is Java Applet?

  • Applet is a java program that can be embedded into HTML pages. Java applets run on java enables web browsers such as Mozilla and internet explorer.
  • Applet is designed to run remotely on the client browser, so there are some restrictions on it.
  • Applet can't access system resources on the local computer. Applets are used to make the website more dynamic and entertaining.

42. Differentiate between Complier and Interpreter?

  • An interpreter reads one instruction at a time and carries out the actions implied by that instruction.
  • It does not perform any translation. But a compiler translates the entire instructions

43. What is the Scope of a variable?

Scope refers to the visibility of variables. It is very useful to be able to limit a variable's scope to a single function. In other words, the variable will have a limited scope

44. What are the three levels of Data abstraction with Example?

Three levels of data abstraction are:

1. Physical level: how the data is stored physically and where it is stored in a database.

2. Logical level: what information or data is stored in the database. eg: Database administrator

3. View level: end-users work on view level. if any amendment is made it can be saved by another name.

45. What are the types of Cryptography?

There are two types of cryptography: -

  • Secret/Symmetric Key Cryptography
  • Public Key Cryptography
46. What are the types of Encapsulation?

Encapsulation in Java is a process of wrapping code and data together into a single unit, for example, a capsule that is mixed with several medicines.

  • Member Variable Encapsulation.
  • Function Encapsulation.
  • Class Encapsulation.

47. How many types of database languages are?

  • Data Definition Language (DDL)
  • Data Manipulation Language (DML)
  • DATA Control Language (DCL)
  • Transaction Control Language (TCL)

48. Define a Relation Schema and a Relation.

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

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

49. What is a Degree of Relation?

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

50. What are the disadvantages of file processing systems?

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

Comments