Get free ebooK with 50 must do coding Question for Product Based Companies solved
Fill the details & get ebook over email
Thank You!
We have sent the Ebook on 50 Must Do Coding Questions for Product Based Companies Solved over your email. All the best!

25 Most Important programming interview questions

Last Updated on October 12, 2022 by Ria Pathak

1. What is the difference between procedural language and object-oriented language?

Ans. Procedural Programming languages follow a sequence of instructions and conveys it to the computer. Procedural programming depends on procedures. As procedural programming language follows a method of solving problems from the top of the code to the bottom of the code, if a change is required to the program, the developer has to change every line of code that links to the main or the original code.

Object Oriented Programming or OOP is a programming paradigm that uses the concept of classes and objects to construct models based on the real world surrounding. An object is a constituent of a program that recognizes how to execute certain actions and how to interrelate with other elements of the program (study.com, 2003). Objects are the foundation of object-oriented programming. An object-oriented program uses a set of objects, which will communicate by sending and receiving messages to request services or information.

2. What is the software development life cycle?

Ans. SDLC or the Software Development Life Cycle is a process that produces software with the highest quality and lowest cost in the shortest time. SDLC includes a detailed plan for how to develop, alter, maintain, and replace a software system.

  1. Give the difference between abstraction and polymorphism.
    Ans. Abstraction is the process of hiding information that are not necessarily changed rather only those methods or functions are extended such that they can be used to modify or perform a function. Abstraction helps to hide the complex data structures and variables from the users who might be only requiring a sub class of data and functionalities. Moreover, there are abstract classes too which can be implemented in java and their instances cannot be created.
    Polymorphism is the ability to have same interface for differing underlying data types. A polymorphic type is a type 4. which can handle multiple types of data or in different form. There are two kind of polymorphism –

    • Compile Time Polymorphism: Static binding
    • Run time polymorphism: Dynamic binding

4. What is virtual memory?
Ans. Virtual memory technique virtualizes the main storage available to a process or task, as a contiguous address space which is unique to each running process, or virtualizes the main storage available to all processes or tasks on the system as a contiguous global address space.

5. What is a process?
Ans. Process is a program in execution. It has its own set of basic resources like stack, text section, heap, data etc. A process is known by its characteristics like Process ID, process state, I/O information, CPU scheduling information. Each such process has also different memory space, address memory etc.

6. What are threads?
Ans. Threads are basically called lightweight processes. It is a path of execution with a process. Many threads can be contained in one process sharing some of the resources in common. Threads shared code section, data, OS resources etc with each other in a process but has their own stack, PC, register etc.

7. What is a network?
Ans. A network is a set of interconnected devices with physical links. Two or more nodes constitute a network. It is basically used for sharing of data and resources.

8. What is bandwidth?
Ans. The difference between the upper range and lower range frequency limit of a network is called bandwidth.

9. What is a node?
Ans. A node is basically a point where a connection takes place. It can be a device or a part of network.

10. What do you mean by subnet mask?
Ans. It is a 32-bit mask which is combined with the IP address to extensively identify – extended network address and host address.

11. What is a gateway?
Ans. A node which is connected to two or more networks is known as gateway. It might be also known as router and is used to forward messages from one network to another. It also regulates the traffic in a network.

12. What is an IP address?
Ans. It is a unique 32-bit address which uniquely identifies a computer in a network.

13. What do you mean by protocol?
Ans. A protocol refers to set of rules by which computers in a network communicate with each other.

14. What are the layers of the OSI reference model?
Ans. These include 7 OSI layers:

  • Physical Layer,
  • Data Link Layer,
  • Network Layer,
  • Transport Layer,
  • Session Layer,
  • Presentation Layer,
  • Application Layer.

15. What is a deadlock?
Ans. A deadlock is a situation where a thread is waiting for a resource that another thread holds, while the second thread is waiting for the resource held by the first thread (or an equivalent situation with several threads). Since each thread is waiting for the other to unlock the resource, both threads remain waiting forever.

16. What are the conditions for Deadlock?
Ans. These 4 conditions are necessary for deadlock occurrence –

  • Mutual Exclusion: Only one process can access a resource at a given time (or there are limited number of the same resource).
  • Hold and Wait: Processes already holding a resource can request additional resources without releasing their current resources.
  • No Pre-emption: One process cannot forcibly remove another process’ resource.
  • Circular Wait: Two or more processes form a circular chain where each process is waiting on another resource in the chain.

17. What is TCP/IP?
Ans. It stands for Transmission Control Protocol/ Internet Protocol and it refers to a set of protocols which is designed for exchanging data on different types of network.

18. What are the types of query language present in SQl?
Ans. These are the few types present –

  • Data Definition Language (DDL)
  • Data Manipulation Language (DML)
  • Data Control Language (DCL)

19. What is a primary key?
Ans. A primary key is a combination of fields (or one) which uniquely identifies a tuple in a table. It cannot be null. It is implemented by a PRIMARY KEY keyword.

20. What is a candidate key?
Ans. The minimum set of attributes which can uniquely identify a tuple are called candidate keys. A primary key is also a candidate key but not all candidate keys are primary keys.

21. What is a foreign key?
Ans. Foreign key refers to the attribute of one relation which is a primary key in one relation. This is used to get or cross refer relations and very crucial for maintaining ACID properties.

22. What do you mean by Normalisation?
Ans. Normalisation is the process of reducing or removing redundancy, anomalies and inconsistency of data in a database. The various rules for Normalisation are set by 4 main forms-

  • First Normal Form (1NF)
  • Second normal form (2NF)
  • Third Normal Form (3NF)
  • Boyce-Codd normal form (BCNF)

23. What is a view in SQL?
Ans. A view is like a virtual table which contains subsets of table and can include multiple tables. It is basically a feature used for easier modifications and more security.

24. Find the GCD of two numbers in logn time.
Ans.

public static int gcd(int a, int b) {
    If(b==0)return a;
Return gcd(b,a%b);
  }  

25. What are joins in a database? What are the types of joins present?
Ans. Joins are basically used to merge two tables or retrieve data from multiple tables. This join is either based on some common attribute or external join. The various types of joins are –

  • Internal Joins:
    • Natural join: returns the joins of two tables using a common attribute. Eliminates duplicates.
  • External Joins:
    • Left Outer Join: returns all the tuples from the left table and corresponding right table tuples. Null is present for those tuples which do not have any matching pairs.
    • Right Outer Join: returns all the tuples from the right table and corresponding left table tuples. Null is present for those tuples which do not have any matching pairs.

Leave a Reply

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