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!

20 most common interview questions and answers for freshers

Last Updated on October 12, 2022 by Ria Pathak

1. What are the SDLC models present?
Ans. Waterfall Model, Spiral Model, Big-bag model, Iterative Model, and V- Model are some of the famous SDLC models.

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

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

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

5. What do you understand by Abstraction?
Ans. An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of objects, and thus, it provides crisply defined conceptual boundaries.

6. What is encapsulation?
Ans. Encapsulation builds a barrier to protect an object’s private data. Access to the private data can only be done through public methods of the object’s class, such as accessors & mutators. Information Hiding – Hides the implementation details of the class from users of the class.

7.What is polymorphism?
Ans. The same method can be invoked on different objects through the same reference type with different results. Sending object does not need to know the class of the receiving object or how the object will respond.

8. Describe Inheritance and multiple inheritance concept.
Ans. A mechanism that defines a new class that inherits the properties and behaviours (methods) of a parent class. Superclass/Base Class (Parent) → Subclass/Derived Class (Child). Any inherited behavior may be redefined and overridden in the subclass. Avoids duplication of code.
Multiple inheritance is when a class inherits from more than one superclass. A problem arises when there is more than one property/method to inherit with the same name.

9. What is an abstract class?
Ans. Abstract methods don’t have any implementation in the abstract class. The implementation must be provided by the subclass(es). Its instance cannot be created.

10. What is an Interface?
Ans. An interface is like an abstract class except it contains only abstract methods and constants (i.e. static final). The abstract keyword is not needed when defining the methods in an interface.

11. What do you mean by binding?
Ans. It is defined by which method is to be executed (i.e., connecting a method call to a method body).
Static Binding – Occurs when the method call is bound at compile time.
Dynamic Binding – The selection of the method body to be executed is delayed until runtime (based on the actual object being referred).

12. What is a final class?
Ans. A final class cannot be overridden in subclasses and it cannot be a super class.

13. Give the difference between Stack and Heap.
Ans. The main differences are –
The stack is used for static memory allocation while the heap is used for dynamic memory allocation.
Variables allocated on the stack have their memory allocated at compile time and access is very fast.
Variables allocated on the heap have their memory allocated at runtime and accessing this memory is slightly slower.

14. What is the difference between a process and a thread?
Ans. The difference between a process and thread are-
A process is an instance of a program in execution. It is an independent entity to which system resources are allocated. Each process executes in a separate address space and one process cannot access the data of another process. However, inter-process communication is possible using pipes, files, sockets etc.
A thread is a particular execution path of a process. It exists within a process and shares the process’ resources. Multiple threads within the same process will share the same heap space but each thread still has its own registers and its own stack.

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 starvation?
Ans. Starvation describes a situation where a thread is unable to gain regular access to shared resources and is unable to make progress. This happens when shared resources are made unavailable for long periods by "greedy" threads.

18. What are the main types of schedulers present in an Operating System?
Ans. The following types are –

  • Long-Term Scheduler: Determines which programs are admitted into the system for processing. It selects processes from the queue and loads them into memory for execution.
  • Short-Term Scheduler: Selects a process among the processes that are ready to execute and allocates the CPU to one of them. Its main objective is to increase system performance according to certain criteria.
  • Medium-Term Scheduler: Responsible for removing processes from memory in case of long waits (for eg. I/O wait). The suspended process is moved to secondary storage and swapped for another process in the queue. Once the wait is over, the suspended process is swapped back in for continued execution.

19. What is serialization?
Ans. Serialization is a process of writing the state of an object into a byte stream. It is mainly used to travel object’s state on the network. Serializable is a marker interface (has no data member and method). It is used to "mark" java classes so that objects of these classes may get certain capability. The Cloneable and Remote are also marker interfaces.

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

This article tried to discuss common interview questions and answers for freshers. Hope this blog helps you understand the concept. To practice more problems you can check out MYCODE | Competitive Programming.

Leave a Reply

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