IBM Interview Questions
About IBM
IBM is an American global technology business based in Armonk, New York, with operations in more than 171 countries. The Computing-Tabulating-Recording Company (CTR) was formed in 1911 in Endicott, New York, by trust merchant Charles Ranlett Flint, and was renamed "International Business Machines" in 1924. IBM is a multinational corporation that manufactures and sells computer hardware, middleware, and software, as well as hosting and consulting services in a variety of fields, from mainframe computers to nanotechnology. IBM is also a large research institution, having set the record for the most yearly U.S. patents generated by a business for the past 28 years (as of 2020).
IBM, also known as Big Blue, is one of the Dow Jones Industrial Average's 30 corporations and one of the world's largest employers, employing about 345,000 people as of 2020. One of the most essential aspects of IBM's culture, and a crucial contributor in its longevity, is the company's ability to not only tolerate but even encourage innovative ideas.
In this article
1. IBM Recruitment Process 2. IBM Technical Interview Questions: Freshers and Experienced 3. IBM Interview Preparation 4. IBM Coding Questions 5. Frequently Asked QuestionsIBM Recruitment Process
Interview Process
At IBM, candidates are usually required to undergo four steps of recruitment processes. These four assessments assess the candidate’s technical knowledge as well as their analytical abilities. They are as follows :
- Cognitive Ability Assessment
- Coding Round
- Technical Interview
- HR Interview
Each of these rounds is eliminative in nature. To get a job offer from IBM, you must be able to clear all of the above rounds.
Interview Rounds
- Cognitive Ability Assessment: This round is generally designed to test the candidate’s cognitive ability. Shortcuts (here, the aim is to move blue marble to the stars), Gridlock (here, the aim is to fill the given main area with the blocks given), Resemble (here, the aim is to create a required image from a given image after rotation), Numbubbles (here, the aim is to pop the bubbles whose sum equals the target given), and Tally Up (here, the aim is to identify whether the left-hand side calculation is equal to, greater than or less than the right-hand side calculation) are some of the amusing games which are generally included in this round. This round may require you to join a WebEx conference where a proctor would be watching the candidates playing the games. The results of this round are generally processed quickly within half an hour and the candidates who pass this round receive links for the further rounds.
- Coding Round: The coding round in the IBM recruitment process is dynamic in nature. It can range from 1 coding question to 4 coding questions. The time allotted for solving them varies according to the number of questions to be solved. Generally, the time allotted for 1 to 2 questions is 30 minutes to 45 minutes while the time allotted for 3 to 4 questions can range from 1 hour to 2 hours. This round focuses on testing the coding skills of the candidate and his/ her knowledge of the various data structures and algorithms. You can code in any of the modern programming languages of your choice which generally includes C, C++, Java and Python. You should be well prepared with data structures and algorithms and should have a good amount of practice for these types of coding questions. To practice such questions, you can visit the programming section of our site through this link.
- Technical Interviews: Candidates who clear the online assessment will be invited to a technical interview in person. Technical interviews are used to evaluate your technical talents – which are usually particular to the position you are applying for – as well as to learn how you think, solve problems, and deal with stressful situations. The interviewer will also assess your problem-solving abilities. You'll be asked about your previous projects and professional experiences, as well as what you did and how you used technology, and how successful you were. Prepare yourself by learning the fundamentals of computer science. The candidate should be proficient in at least one of the modern programming languages which include C, C++, Java or Python. You can also expect questions from basic computer fundamentals. You can expect questions majorly from Object-Oriented Programming Systems(OOPs), DataBase Management Systems (DBMS), Computer Networks (CN), Computer Organization and Architecture (CoA) and Operating Systems (OS). Your performance in earlier rounds, your job profile, your experience, and the firm's demands will all influence the number of technical interviews you have. In most cases, each candidate will go through two rounds of technical interviews.
-
HR Interview: Candidates will advance to the HR round after clearing the technical interview. An HR interview's main purpose is to assess a candidate's personality, background, strengths, and shortcomings in order to evaluate whether or not they are a suitable fit for a certain position. As a result, being well-prepared for the HR interview is critical.
Assess your resume to make sure you've included all pertinent personal information and that the data you've provided is accurate to the best of your knowledge. They can also question IBM's history, including when the company was founded, as well as its aims, beliefs, and organisational structure. Prepare to address any queries that may be asked about your résumé. In your explanations, explain your interest in the profession and what motivates you the most.
To help you prepare for your job interview, we've created a list of frequently asked HR round interview questions.- Tell me a little bit about yourself. (You can begin with your family's history, then go on to your educational credentials, and ultimately to your professional advancement.)
- Would you be willing to relocate to other parts of India?
- What do you want to achieve from this position?
- What motivates you to join IBM?
- Where can you see yourself in five years?
- Describe your internships and projects to me.
- How would you rate yourself on a scale of 1 to 10?
- Tell me about a time when you faced difficulty and how did you overcome it?
- Let us assume that you are the leader of a team. One member of your team is not performing up to the mark and is not willing to change his/ her attitude despite several warnings. What will be your approach in such a situation?
- Describe a situation where you worked hard but could not succeed.
IBM Technical Interview Questions: Freshers and Experienced
1. What do you understand about procedural programming? How is it different from object oriented programming?
Procedural programming is a programming model that evolved from structured programming and is based on the concept of invoking procedures. Procedures, often known as routines, subroutines, or functions, are essentially a set of instructions to be executed. Any procedure in a program can be invoked at any time during execution, either by other procedures or by the program itself.
The following table illustrates the differences between procedural programming and object-oriented programming:
Procedural Programming | Object-Oriented Programming |
---|---|
In procedural programming, the program is broken down into little modules known as functions. | Object-oriented programming divides a program into discrete pieces called objects. |
The top-down technique is used in procedural programming. | The bottom-up method is used in object-oriented programming. |
It's not straightforward to add new data and functions. | It's simple to add additional data and functions. |
Overloading is not possible with procedural programming. | In object-oriented programming, overloading is possible. |
Because procedural programming lacks a proper method for hiding data, it is insecure. | Data is hidden in object-oriented programming, making it safer. |
In procedural programming, function takes precedence over data. | Data is more important than function in object-oriented programming. |
C, FORTRAN, Pascal, Basic, and other programming languages are examples. | C++, Java, Python, C#, and other programming languages are examples. |
2. What are the three types of schedulers in the context of operating systems? Explain.
Schedulers are specialised computer programs that manage process scheduling in a variety of ways. Their primary responsibility is to choose which jobs to submit into the system and which processes to run.
Following are the three types of schedules:
- Long Term Scheduler: It is also known as a job scheduler. A long-term scheduler determines which programs are accepted for processing into the system. It chooses processes from the ready queue and loads them into memory so they can be executed. For CPU scheduling, the process loads into memory. The job scheduler's main goal is to deliver a balanced mix of jobs, such as I/O bound and CPU bound workloads. It also regulates how much multiprogramming is done. If the degree of multiprogramming remains constant, the average rate of process creation must be equal to the average rate of process departure from the system.
- Medium Term Scheduler: Medium Term Schedulers are used for swapping processes in the main memory. It clears the memory occupied by the processes. The degree of multiprogramming is reduced as a result. The swapped out-processes are handled by the medium-term scheduler.
- Short Term Scheduler: It's also referred to as a CPU scheduler. Its primary goal is to improve system performance in accordance with the set of criteria established. It is the transition from the process's ready to running stage. The CPU scheduler chooses a process from among those that are ready to run and allocates CPU to that process. Short-term schedulers usually referred to as dispatchers, decide which process to run next.
3. What do you know about virtual memory in the context of operating systems?
Virtual Memory is a storage allocation system that allows secondary memory to be addressed as if it were the main memory. The addresses used by an application to refer to memory are distinct from the addresses used by the memory system to designate physical storage sites, and program-generated addresses are automatically translated to machine addresses.
The capacity of virtual storage is limited by the computer system's addressing method, and the amount of secondary memory available is determined by the number of main storage sites available rather than the actual number of main storage locations.
4. What is the purpose of the sudo command in the context of the UNIX operating system?
sudo is a short form of Super Users DO. In Linux, the sudo command is commonly used as a prefix to a command that only superusers are permitted to run. If you use the prefix "sudo" before any command, it will run it with elevated privileges, allowing a user with the necessary permissions to run a command as another user, such as the superuser. This is the Windows version of the "run as administrator" option.
The sudoers file, stored at "/etc/sudoers," must contain an entry for each user who may use the sudo command. Remember to use the sudo command to edit or inspect the sudoers file. The "visudo" command is suggested for editing the sudoers file.
5. Write a program to calculate how many ways can we make change for N cents if we have an endless supply of each of the C = C1, C2,..Cm valued coins? It makes no difference what order the coins are placed in.
Example:
Input :N = 4, C = { 1, 2, 3}
Output : 4
Explanation:
There are 4 possible combinations : {1, 1, 1, 1}, {1, 1, 2}, {1, 3}, {2, 2}
Input :N = 10, C = {2, 3, 5, 6}
Output :
5
Explanation:
There are 5 possible combinations ; {2, 2, 2, 2, 2}, {2, 2, 3, 3}, {2, 2, 6}, {2, 3, 5}, {5, 5}
Approach:
We can divide all set solutions into two sets to count the total number of solutions.
1) Solutions that are devoid of the mth coin (or Cm).
2) At least one Cm is present in the solution.
If solve(C[], m, n) is the function for counting the number of solutions, it may be represented as the sum of solve(C[], m-1, n) and solve(C[], m, n-Cm). We will use dynamic programming to store the result for a particular value of n and m. This will optimise our time complexity to O(nm).
Code:
#include<bits/stdc++.h>
using namespace std;
// function to count the number of ways n can be represented from a coin set of size m
int solve( int C[], int m, int n )
{
int dp[n + 1][m];//Creating a 2D matrix of size (n + 1) 8 m to store the result of each state of our problem
// Filling the matrix for the base case when n = 0
for (int i = 0; i < m; i++)
dp[0][i] = 1;
// Filling the entries in the dp table in bottom up fashion
for (int i = 1; i < n + 1; i++)
{
for (int j = 0; j < m; j++)
{
// Including C[j] in our current state's answer
int x = (i-C[j] >= 0) ? dp[i - C[j]][j] : 0;
// Excluding C[j] in our current state's answer
int y = (j >= 1) ? dp[i][j - 1] : 0;
// storing the sum of x and y in our current state's answer
dp[i][j] = x + y;
}
}
return dp[n][m - 1];
}
int main()
{
int C[] = {2, 3, 5, 6};
int m = sizeof(C)/sizeof(C[0]);
int n = 10;
cout << solve(C, m, n);
return 0;
}
Output:
5
Explanation:
In the above code, we define a function named ‘solve’ which returns the number of ways in which n can be represented from a set of m coins having distinct values. We create a dp table of size (n+1) * m. dp[i][j] represents the number of ways in which i can be represented by a set of j coins. Here, we have used the recurrence formula dp[i][j] = x + y. Here, x = dp[i - C[j]][j], y = dp[i][j-1].
6. Write a program to convert the characters of a string into the opposite case, that is, if a character is lowercase, convert it to upper case and vice versa.
Input :“inTerVieWbiT”
Output :“INtERvIEwVIt”
Input :“Hello World”
Output :“hELLO wORLD”
Approach:
We scan each character of the string one by one. If the current character is in lowercase, we subtract 32 from the character and convert it to uppercase. Similarly, if the current character is in uppercase, we add 32 to the character and convert it to lowercase.
Code:
#include <iostream>
using namespace std;
// Function to convert the characters of the string to its opposite case
void changeCase(string& s)
{
int len = s.length();
for (int i = 0; i < len; i++) {
if (s[i] >= 'a' && s[i] <= 'z')
{
s[i] = s[i] - 32;// Subtracting 32 from the character
}
else if (s[i] >= 'A' && s[i] <= 'Z')
{
s[i] = s[i] + 32;// Adding 32 to the character
}
}
}
int main()
{
string s = "inTerVieWbiT";
cout << "Original String : " << s << "\n";
changeCase(s);
cout << "Changed String : " << s << "\n";
return 0;
}
Output:
Original String : inTerVieWbiT
Changed String : INtERvIEwBIt
Explanation :
In the above code, we define a function named ‘changeCase’ which takes a reference of a string as a parameter. We iterate through each character of the string and change the character to its opposite case by either adding or subtracting 32.
7. Given a sorted array of 0s and 1s. The goal is to discover the index of the sorted array’s first '1'. It's possible that the array is made up entirely of 0s or 1s. If there are no 1's in the array, display "-1."
Example:
Input: arr = {0, 0, 0, 0, 1, 1, 1}
Output :4
Input :Arr = {0, 0, 0, 0}
Output :-1
Approach:
It is given that the array is sorted. We use this property of the array and apply binary search to find the first occurrence of 1 in the given array. We start with the whole array as our search space and find the middle element. If we encounter 0 as the middle element, it implies that our answer lies to the right side of the middle element. If we encounter 1 as the middle element, our answer can either be this index or the indices left to the current middle if there are more 1s preceding the current middle.
Code:
#include <bits/stdc++.h>
using namespace std;
// function to find the first occurrence of 1 in the give sorted array
int findIndex(int arr[], int low, int high)
{
while (low <= high) {
int mid = low + (high - low) / 2;
// we check if the mid element is a 1 and the mid - 1 element is 0
if (arr[mid] == 1 && (mid == 0 || arr[mid - 1] == 0))
return mid;
// our answer lies to the left of mid, we reduce our search space
else if (arr[mid] == 1)
high = mid - 1;
// our answer lies to the right of mid, we reduce our search space
else
low = mid + 1;
}
// we return -1 since 1 is not present in the array
return -1;
}
int main()
{
int arr[] = { 0, 0, 0, 0, 1, 1, 1, 1 };
int n = sizeof(arr) / sizeof(arr[0]);
cout << findIndex(arr, 0, n - 1);
return 0;
}
Output:
4
Explanation :
In the above code, we defined a function named ‘findIndex’ which finds the first occurrence of the first one in the sorted array. We reduce the search space by changing the values of low and high as per the current value of the middle element. If low exceeds high, we return -1 which indicates that no 1 is present in the array.
8. What do you understand about an entry controlled loop in the context of OOPs programming?
An entry control loop examines the condition at the point of entry and passes control to the body of the loop if the condition or expression becomes true.
The name "entry control loop" comes from the fact that this sort of loop regulates loop entry.
for loops and while loops are examples of entry controlled loops.
9. Differentiate between quick sort and merge sort in the context of sorting algorithms.
Following are the differences between quick sort and merge:
Quick Sort | Merge Sort |
---|---|
In a quick sort, the array is divided into any ratio. In a quick sort, there is no requirement to divide the array of components into equal sections. | The array is divided into only two halves (i.e. n/2) in the merge sort. |
The worst-case complexity of quick sort is O(n2) | In merge sort, the worst and average cases have the same complexity O (n log n). |
The quick sort, on the other hand, does not function well with large datasets. | Merge sorting can be used on any form of data set, regardless of its size (either large or small). |
The quick sort is in place since it does not necessitate any extra storage. | Merge sort is not in place because it requires additional memory space to hold the auxiliary arrays. |
Quick sort is unstable (two elements with the same value may appear in a different order in the sorted array from that in the unsorted input array) in this situation. However, with a few code tweaks, it may be made stable. | Merge sort is stable because two elements with the same value appear in the sorted output in the same order as they did in the unsorted input array. |
Quick sort is preferred for arrays. | Merge sort is preferred for linked lists. |
Quicksort has a good cache locality, making it faster than merge sort (in many cases like in a virtual memory environment). | Merge sort has a poor locality of reference. |
10. What do you understand about a deadlock in the context of operating systems? What are the necessary conditions for a deadlock?
A deadlock occurs when a group of processes is halted because each process is holding a resource and waiting for another process to obtain it.
Consider the situation when two trains are approaching each other on the same track and there is only one track: once they are in front of each other, neither train can move. In operating systems, a similar situation happens when two or more processes hold some resources while waiting on resources owned by other processes (s).
For example, let us assume that there are two trucks trying to cross a one-way bridge from opposite ends. None of the trucks is ready to move back and neither can any of them cross the bridge. In this situation, a deadlock has been obtained.
Following are the necessary conditions for a deadlock :
- Mutual Exclusion: One or more resources are not available for sharing. That is, only one process can use the resource at a time.
- Hold and Wait: A process is holding at least one resource and waiting for further resources.
- No Preemption: A resource can only be obtained from a process if it is released by the process. There can be no forced snatching of the resources.
- Circular Wait: A group of processes are waiting for each other in a circular fashion.
11. What do you understand about arrays? What are some of the real life applications of an array?
A collection of items stored in contiguous memory spaces is referred to as an array. The objective is to group together goods of the same type. This makes calculating the position of each element easy by simply adding an offset to a base value, such as the memory address of the array's first element.
Following are the real-life applications of an array:
- Arrays can be used to store data in a tabular style as a simple application. For example, if we want to save our contacts on our phones, the software will simply create an array with all of our contacts.
- The arrangement of a game's leaderboard may be done simply by using arrays to record the score and arranging them in descending order to clearly see each player's rank in the game.
- A straightforward question paper consists of an array of numbered questions, each of which is assigned a set of marks.
- In image processing, 2D arrays, often called matrices, are used.
- It's also used in speech recognition, where each spoken signal is represented by an array.
12. Differentiate between variable/ function declaration and definition in the context of any OOPs programming language.
The purpose of a variable declaration is to tell the compiler of the following information: the variable's name, the kind of value it stores, and the initial value if any. Declaration, in other words, provides information about a variable's attributes. The definition of a variable allocates memory space for the variable and specifies where the variable will be stored.
The following table illustrates the differences between definition and declaration:
Definition | Declaration |
---|---|
Only one time can a variable or function be defined. | There is no limit to how many times a variable or function can be declared. |
Memory is allocated during definition. | Memory is not allocated during declaration. |
Example:
The above code defines a void function named “fun” and the compiler allocates the memory for it as soon as it encounters the above code. |
Example:
The above code declares a void function named “fun”. |
13. Differentiate between struct and union in the context of C programming language.
- struct: In C, a structure is a user-defined data type that allows you to combine data objects of various types. A record is represented by a structure.
Syntax:
struct structureName
{
member definition;
member definition;
...
member definition;
};
- union: In C, a union is a unique data type that allows you to store many data types in the same memory region. A union can have numerous members, but only one of them can have a value at any given time. Unions are a useful approach to reuse the same memory space for numerous purposes.
Syntax:
union unionName
{
member definition;
member definition;
...
member definition;
};
The following table illustrates the differences between struct and union:
struct | union |
---|---|
A structure is defined using the struct keyword. | Union is defined by the keyword union. |
The compiler allocates memory to each variable member when the variables are declared in a structure. The total size of each data member determines the size of a structure. | When a variable is declared in a union, the compiler allocates memory to the variable member with the largest size. A union's size is determined by the size of its largest data member. |
Changing a variable's value has no effect on other variables present in the struct. | Changing the value of one variable member will have an impact on the other variables present in the union. |
Each variable's member has its own memory area. | Members of a variable share the memory space of the variable with the largest size. |
Multiple variables in a structure can be initialised at the same time. | Only the first data member of a union can be initialised. |
At any point in the program, all variable members store some value. | At any given point in the program, exactly one data member stores a value. |
It's used to keep track of various data types' values. | It's used to save one value at a time from a variety of data types. |
It provides for the simultaneous access and retrieval of any data member. | It lets you access and retrieves individual data members at a time. |
14. What do you know about the ACID properties of a transaction in the context of a database management system?
In a SQL Database, every transaction must follow some specific set of properties. These properties are referred to as ACID properties. They are as follows:
-
A for Atomicity: This means that either the complete transaction occurs at once or it does not occur at all. There is no middle ground, which means that transactions do not take place in stages. Each transaction is treated as a single entity that is either completed or not conducted at all. It entails the following two procedures.
- Abort: If a transaction aborts, any database modifications are lost.
-
Commit: When a transaction commits, the changes it contains become visible.
The 'All or nothing rule' is another name for atomicity.
For example, consider a bank transaction from one account to another. The transaction must either be completed entirely or must be failed. There cannot be a midway transaction such as money has been debited from one account but has not been credited to the other account.
-
C for Consistency: This property implies that integrity constraints must be fulfilled before and after the transaction to ensure that the database is consistent. It refers to a database's correctness.
For example, if a bank transaction is performed from account A having X money to an account B having Y money, then after the transaction has been performed the total amount of money must remain the same, that is, X + Y. -
I for Isolation: This attribute assures that several transactions can take place at the same time without causing database state inconsistencies. Transactions take place in a non-interfering manner. Changes made in one transaction are not visible to other transactions until that transaction's update is written to memory or committed. This feature assures that concurrently executing transactions results in a state that is identical to the one attained if they were executed sequentially in some order.
For example, a bank has many ATMs present in a country. All of the ATMs can operate at the same time. They function as if they are the only transaction being performed on the bank’s database thereby, implementing isolation. -
D for Durability: This attribute ensures that once a transaction has completed execution, the database updates and modifications are saved and written to memory and that they survive even if the system fails. These modifications are now saved in non-volatile memory and are permanent. As a result, the transaction's effects are never lost.
For example, a backup database must be maintained so that if in any case, the primary database fails, we can recover the data from the backup database.
15. What is a DataBase Management System? What are its advantages over traditional file systems?
A database management system is a piece of software that manages databases. Examples of database management systems include MySQL, Oracle, and other commercial databases. A database management system (DBMS) provides an interface for doing tasks such as building a database, saving data in it, updating data, and creating a table in the database, among others. It ensures the database's safety and security. It also ensures data consistency when there are multiple users.
Following are the advantages of a database management system over traditional file systems :
- Better Data Management: Database management makes it possible for users to access better-managed data. As a result, end-users will be able to take a quick check at their data and respond quickly to any changes.
- Enhanced Data Security: As the number of users grows, the rate at which data is transferred or shared grows as well, raising the danger of data security. It is frequently used in the corporate sphere, where organisations devote a significant amount of money, time, and effort to assure data security and proper use. A Database Management System (DBMS) helps firms improve data security by providing a better platform for data privacy and security regulations.
- Reduced Data Inconsistency: In a database management system, data inconsistency is minimised when various versions of the same data appear in different places. For example, data inconsistency occurs when a student's name is saved as "William Shakespeare" on the school's main computer, while the same student's name is saved as "W. Shakespeare" on the teacher's registered system.
- Faster data access: The database management system (DBMS) aids in the production of speedy responses to database queries, allowing for faster and more accurate data access. End users, for example, will have improved access to data while dealing with massive amounts of sales data, allowing for a speedier sales cycle.
16. What do you understand about processes and threads in the context of an operating system?
- Process: Any program in execution is referred to as a process. Any process is controlled by a process control block. Process priority, process id, process state, CPU, register, and other information are all stored in the Process Control Block (PCB). Child Processes are created when a process spawns another process. It takes longer for a process to end, and it is isolated, which means it doesn't share memory with other processes.
- Thread: A thread is a section of a process, which means that a process can have several threads, all of which are contained within the process. A thread can be in one of three states: running, ready, or blocked. Threads require less time to terminate than processes, but they do not isolate like processes.
The following table illustrates the differences between them:
Process | Thread |
---|---|
The creation of a process takes more time. | The creation of a thread takes less time. |
Switching between contexts from one process to another takes longer. | Switching between contexts from one thread to another takes less time. |
In terms of intercommunication, the process is inefficient. | In terms of intercommunication, Thread is more efficient. |
Different processes use different areas of memory. They do not share memory. | Threads of the same process share memory. |
The Process Control Block, Stack, and Address Space are all unique to each process. | All threads of the same process share the process control block but have different thread control blocks, stack and address space. |
When one process gets blocked, it does not affect the other running processes. | When one thread gets blocked, all the other threads of the same process get blocked. |
The operating system interface is used for process switching. | Thread switching does not necessitate invoking an operating system or causing a kernel interrupt. |
17. Differentiate between primary memory and secondary memory in the context of a computer.
- Primary/Main Memory: The computer memory that is directly accessible by the CPU is referred to as primary memory. It is made up of DRAM (Dynamic Random Access Memory) and provides the processor with an actual working area. It keeps track of the data and instructions that the processor is currently processing. Example - RAM (Random Access Memory)
- Secondary Memory: Because the processor does not directly interface with the secondary memory, the contents of the secondary memory are first transferred to the primary memory and then accessed by the processor. Example - Hard disk, USB drive, etc.
The following table illustrates the differences between primary memory and secondary memory:
Primary Memory | Secondary Memory |
---|---|
Storage in primary memory is temporary. | Storage in secondary memory is permanent. |
Processor/CPU has immediate access to primary memory. | Processor/CPU does not have immediate access to primary memory. |
It may be volatile (requires power to maintain the stored information) or non-volatile in nature. | It is always non-volatile (does not require power to maintain the stored information) in nature. |
Semiconductor memories are the memory devices utilised for primary memory. | Magnetic and optical memories are used as secondary memory devices. |
Primary memory is more expensive than secondary memory. | When compared to primary memory devices, secondary memory devices are less expensive. |
18. What are the functions of an operating system?
Following are the functions of an operating system :
- Provides user interface: Operating systems provide an interface between computer hardware and the users. It makes it easy for the user to access the hardware in a systematic manner.
- Maintains system performance: Helps increase performance by monitoring overall system health. To get a thorough picture of the system's health, keep track of the time between service requests and system responses. This can aid performance by providing critical information for troubleshooting issues.
- Security: To safeguard user data, the operating system employs password protection and other similar measures. It also protects applications and user data from illegal access.
- Error-detection: The operating system constantly monitors the system in order to detect errors and prevent a computer system from failing.
-
Memory Management: The primary memory, often known as main memory, is managed by the operating system. The main memory consists of a vast array of bytes or words, each of which is allocated an address. Main memory is rapid storage that the CPU can access directly. A program must first be loaded into the main memory before it can be executed. For memory management, an operating system performs the following tasks:
- It keeps track of primary memory, i.e., which user programmes use specific bytes of memory. Memory addresses that have already been assigned, as well as memory addresses that have yet to be used.
- The OS determines the order in which processes are permitted memory access and for how long in multiprogramming. It allocates memory to a process when the process asks for it and deallocates memory when the process exits or performs an I/O activity.
- Processor Management: In a multiprogramming environment, the operating system determines the sequence in which tasks access the processor and the amount of processing time each process has.
- Device Management: An operating system (OS) controls device connectivity through drivers. It keeps track of all the devices that are linked to the system. The Input/Output controller is a program that is responsible for all devices. Determines which processes are allowed access to a device and for how long. Allocates devices in a way that is both effective and efficient. When a gadget is no longer needed, it is deallocated.
- File Management: A file system is divided into directories to make navigation and usage more efficient. Other directories and files may be found in these directories. The operating system keeps track of where data is kept, user access settings, and the state of each file, among other things.
19. Explain function overloading and function overriding in the context of C++ programming language. Differentiate between them.
- Function Overloading:
It allows for multiple definitions of the function by modifying the signature, i.e. the number of parameters, the datatype of the parameters, and the return type.
For example:
using namespace std;
// Method 1
void overloadedMethod(int x)
{
cout << "In Overloaded Method 1" << endl;
}
// Method 2
void overloadedMethod(float x)
{
cout << "In Overloaded Method 2" << endl;
}
// Method 3
void overloadedMethod(int x1, float x2)
{
cout << "In Overloaded Method 2" << endl;
}
int main()
{
int x = 5;
float y = 5.5;
overloadedMethod(x);
overloadedMethod(y);
overloadedMethod(x, y);
return 0;
}
Output:
In Overloaded Method 1
In Overloaded Method 2
In Overloaded Method 3
Explanation:
In the above code, we have three functions with the same name and return type. However, they have different function signatures which differentiates them from each other. When we pass a parameter of int type, method 1 gets executed. When we pass a parameter of float type, method 2 gets executed. When we pass both an int and a float type parameter, method 3 gets executed.
- Function Overriding:
It is the redefining of a base class function in a derived class with the same signature, that is, the return type and parameters. It's only possible in derived classes.
class Test
{
public:
virtual void print(){ cout << "Test Function"; }
};
class Sample : public Test
{
public:
void print(){ cout << "In Sample Function";}
};
int main()
{
Test obj = new Sample();
obj.print();
return 0;
}
Output:
In Sample Function
In the above code, the class Sample extends the class Test and therefore inherits all its properties. We can clearly see that both the classes have a function ‘print’ with the same function signature and return type. Therefore, the above code implements function overriding. Since we have added a virtual keyword in the function of the base class, the function is called according to the type of object being referred to and so the print function of the Sample class gets called.
The following points illustrate the differences between function overloading and function overriding:
- When one class inherits from another, it causes overriding of functions. Overloading can happen in the same class.
- Overloaded functions must have a different function signature, which means they must have a different number of parameters or a different type of parameter. Function signatures must be identical when overriding.
- Overloaded functions are present in the same scope of a class while overridden functions are present in different scopes.
20. Explain the major concepts of Object Oriented Programming in the context of C++ programming language.
There are four major concepts in Object-Oriented Programming. They are as follows:
-
Encapsulation: Encapsulation is described as the binding of data and the functions that alter it in Object-Oriented Programming. Encapsulation makes a class's variables or data concealed from other classes and that they can only be accessible through member functions of the class in which it is stated.
Let us consider the following example:
In a company, there are different divisions such as accounts, finance, sales, and so on. The finance department’s duty is to keep track of all financial data and the transactions performed on them. Similarly, the sales department’s duty is to keep track of all sales-related activities.
Let us assume that an official from the finance department requires the sales data for a specific month. In this scenario, he cannot access the sales section's data directly. An official from the sales department must be contacted because only he can access the data. Here, the process of asking the sales officials for the data depicts encapsulation. The sales department's data and the people who can influence it are bundled together under the category "sales section." -
Abstraction: Abstraction refers to revealing only the most important information while concealing the details. Data abstraction refers to exposing only the most important aspects of the data to the outside world while concealing the implementation specifics.
Consider the case of a man driving a vehicle. The man only knows that pressing the accelerators will increase the vehicle's speed and that applying the brakes will stop it, but he has no idea how the speed is increased by pressing the accelerators, nor does he understand the car's inner mechanism or how the accelerator, brakes, and other controls are implemented in the car. This is the definition of abstraction. -
Inheritance: Inheritance refers to a class's capacity to derive features and traits from another class. One of the most significant characteristics of Object-Oriented Programming is inheritance. A class that inherits properties from another class is referred to as a subclass or a derived class. A class whose properties and member functions are inherited by other classes are referred to as superclass or base class. Inheritance supports the concept of "reusability".
Consider a class Vehicle that contains all the essential functions which a vehicle must possess. This includes accelerating speed, applying brakes, changing gear and so on.
Now let us assume the classes Car, Bus, Truck and so on. All of these classes can be considered as a subclass of the class Vehicle since all of them must essentially possess all the properties of the class Vehicle. -
Polymorphism: Polymorphism refers to the fact that something exists in multiple forms. Polymorphism, in simple terms, is the ability of a message to be displayed in multiple formats. For example, at the same time, a person might have a variety of characteristics. At the same time, he is a father, a spouse, and a worker. As a result, the same person behaves differently in different settings. Polymorphism is the term for this.
There are mainly two types of polymorphism in C++. They are as follows:- Compile Time Polymorphism: Function overloading and operator overloading is used to achieve this form of polymorphism.
- Runtime Polymorphism: Function Overriding is used to generate this form of polymorphism.
IBM Interview Preparation
Interview Preparation Tips
- Test yourself on a range of coding challenges to see how fast you can solve them. This will help you improve your problem-solving abilities.
- Make preparations to share your experiences and exhibit your leadership, teamwork, professional and academic successes, communication skills, and capacity to overcome obstacles and challenges.
- Understand your strengths and shortcomings, as well as any experiences or talents that make you a good fit for the job. Consider coming up with instances that will help you stand out. Interviewers want to discover what motivates you, why you're interested in working for their company, and how your past qualifies you for the position.
- "Belief in oneself" is the first step toward a successful interview. You've already completed half of the task if you're confident enough. Always have an optimistic outlook and a friendly demeanour.
- The more you prepare for the interview, the better your chances of getting the job. Learn all about interviews, including stages, rounds, and questions. Answers to popular HR and management interview questions should be prepared ahead of time. You can also learn about the firm's achievements, organisational structure, vision, work-life balance, and other topics.
- Consider going through the interview experiences for the company. This will give you a fair enough idea of how an actual interview goes through and what you can expect from the interview.
- Consider giving mock interviews. This will give you an idea of how the real interview would be like. You can try our InterviewBit platform for mock interviews. You will be paired up with a peer and you both can take interviews with each other, making it a win-win for both of you.
IBM Coding Questions
Frequently Asked Questions
1. Why are you a fit for this role?
In such types of questions, mention your strong points and the skills you possess which makes you a good fit for the role. A sample answer to the question could be as follows:
“For various reasons, I am certain that I am a suitable fit for this role, but most notably because of my commitment to going above and beyond in my work. To succeed in this role, I am committed to learning any new abilities on my own. My abilities and skills are a perfect match for the prerequisites for this post. My communication and leadership abilities, in particular, make me a strong contender for the position.”
2. Is it hard to get an internship at IBM?
IBM assesses a candidate thoroughly in both technical and interpersonal domains before making any hiring decisions. Therefore, getting an internship at IBM should not be considered as a piece of cake. However, with the right preparation and the right attitude, one can easily crack an internship at IBM. The only thing required is the right path and guidance.
3. Does IBM hire interns?
Yes, IBM does hire interns.
4. What is the salary for freshers at IBM?
The average salary for freshers at IBM ranges from Rs. 2.2 lakhs per year to Rs. 7.3 lakhs per year.
5. Why do you want to work for IBM?
In such types of questions, mention the things which motivate you to work for the company. Try to highlight the values and the motto which the company believes in as part of your motivation to join the company.
The following could be a sample answer:
“I'd like to work with IBM because IBM has a strong set of principles and a clear commitment to not only your staff but also to your customers and clients. This is an organisation where I will be able to grow, thrive, and develop over time, and I will have the opportunity to work with an incredibly brilliant group of people who are all dedicated to the IBM brand's long-term success. I see this as a once-in-a-lifetime opportunity to put my abilities and traits to good use.”
6. Is IBM interview easy?
The interviews at IBM focus on the candidate’s understanding of the basic fundamentals. With the right preparation, IBM interviews are definitely easy to crack.
7. How long is the IBM hiring process?
At International Business Machines, the employment procedure can take anywhere from two weeks to ten months. Because of the large number of applicants, the screening procedure takes a bit longer before the best candidates are chosen.