Skip to content

General Interview Question

Prashant edited this page Nov 16, 2019 · 7 revisions

When do you need to declare a class as abstract?
We should declare a class as abstract in the following situations: When the class is inherited from an abstract class, but not all the abstract methods have been overridden. In the case when a minimum one of the methods in the class is declared as an abstract.

What is modularization?
A. Modularization is a technique to divide a software system into multiple discreet modules, which are expected to carry out the task(s) independently.

What is data dictionary?
A. The data dictionary is referred to as meta-data. Meaning, it is a repository of data about data. The data dictionary is used to organize the names and their references used in a system such as objects and files along with their naming conventions.

What is the difference between function-oriented and object-oriented design? A. Function-oriented design is comprised of many smaller sub-systems known as functions. Each function is capable of performing significant tasks in the system. Object-oriented design works around the real-world objects (entities), their classes (categories) and methods operating on objects (functions).

Differentiate validation and verification?
A. Validation checks if the product is made as per user requirements whereas verification checks if proper steps are followed to develop the product. Validation confirms the right product and verification confirms if the product is built in the right way.

Q.What is black-box and white-box testing?
A. Black-box testing checks if the desired outputs are produced when valid input values are given. It does not verify the actual implementation of the program. White-box testing not only checks for desired and valid output when valid input is provided but also it checks if the code is implemented correctly.

Threading A single-threaded application is desirable for the sake of simplicity and readability when there is no performance penalty. A multithreaded application is desired when multiple CPU cores can be used concurrently and independently of each other. This means the data being used by each core and each thread is by a large independent. This applies to I/O intensive and computational tasks. A simple example would be to compute to sum the logarithms of an input batch of 1 million numbers. As you must be knowing that the multi-threading “in a single core system” is just time-interleaved multiple tasks (or threads) running together with context switching between one another during their run on a processor. Note: In a multi-core system, different threads become different processes running in parallel in multiple cores, where threads running on the same core only experience the time-slicing. This implies:

  1. Only one thread runs at a time, but it does not run until it completes.
  2. Multiple threads are in the waitlist (pool) and are waiting to execute (to be scheduled) by a thread scheduler.

The key technique is overlapping IO operations: For example, don't wait the milliseconds needed for a disk seek to write out that data, spin-off a thread to do the IO and keep computing in another thread or threads. Or, if you're running multiple independent programs, run one while the others are waiting on IO. Obviously, being able to do something useful during multiple millisecond IO delays can have a huge performance impact. Multithreading is most useful when a process consists of mutually independent tasks, either of which can be performed when the other is waiting for some resources to be freed up and allocated by the CPU. Let's take an example of your music player there are multiple tasks that done simultaneously using thread

  • thread is running for listening current song
  • Thread is used to show the list of track available in your device
  • Another thread used for displaying ads in music player
  • Another thread used for search specific song which you want to search
  • Another thread keeps track that is there any song is added or deleted from files

Non-Blocking I/O which is based on event-driven model [Asynchronous I/O]: In addition to the inherent complexity of the synchronization of shared resources, everyone knows that thread management is very costly for the operating system and resource-intensive and rarely many more than 100 threads are used as spawning a new thread per task is resource-intensive. In the alternative Java NIO approach, one thread is capable of processing multiple requests avoiding the problem of switching thousands of threads and allowing greater scalability, consequently a greater number of concurrent users. Asynchronous I/O is the best fit for high-intensive I/O operation applications like building HTTP proxy or crawling applications. Unlike processes, threads share memory between each other. When multiple threads inadvertently change the same data in memory, you may get incorrect results. And worse, you may not even be aware of these incorrect results (ie. they are silent errors) There are a few ways to avoid multiple threads inadvertently changing the same data in memory. One is to have immutable data; that is data that cannot be changed once it's created. Another option is to use a mutex, which is a programming construct that lets a thread acquire a lock on a variable and prevents changes to that variable by other threads until the first thread explicitly unlocks it. But obviously this is more complicated that writing a single-threaded program

Processes are the abstraction of running programs. Threads are the unit of execution in a process:

Semaphores in Process Synchronization : Semaphore was proposed by Dijkstra in 1965 which is a very significant technique to manage concurrent processes by using a simple integer value, which is known as a semaphore. Semaphore is simply a variable that is non-negative and shared between threads. This variable is used to solve the critical section problem and to achieve process synchronization in the multiprocessing environment. The two most common kinds of semaphores are counting semaphores and binary semaphores. Counting semaphore can take non-negative integer values and Binary semaphore can take the value 0 & 1. only.

On the basis of synchronization, processes are categorized as one of the following two types:

  • Independent Process: Execution of one process does not affect the execution of other processes.
  • Cooperative Process: Execution of one process affects the execution of other processes.

Race Condition : When more than one processes are executing the same code or accessing the same memory or any shared variable in that condition there is a possibility that the output or the value of the shared variable is wrong so for that all the processes doing race to say that my output is correct this condition known as race condition.

mutex vs sephamore

Virtual memory is not a memory unit, its a technique.

SDE Testing type Unit testing, Integration testing, Regression testing, Smoke testing, Alpha testing, Beta testing, System testing, Stress testing, Performance testing

Black Box testing :- It is used for validation. In this, we ignore the internal working mechanism and focuses on what is the output?.

White Box testing :- It is used for verification. In this, we focus on internal mechanism i.e. how the output is achieved?

Clone this wiki locally