Practice IT Operating System Questions and Answers
- Β A deadlock situation can be completely prevented if which of the following conditions is eliminated?
- Which system call is typically used by a parent process to wait for a child process to terminate?
- In the context of file systems, what is the primary purpose of an inode?
- Consider a delete_node(head, key) function for a singly linked list that removes the first occurrence of a node with a given key. The function works for mo...
- A custom stack implementation has a pop() method that is supposed to remove and return the top element. However, when the stack is empty, calling pop() cau...
- A recursive function calculate_height(node) is designed to find the height of a binary tree (where a single node has height 0). The function is implemented...
- An insert(root, value) function for a Binary Search Tree (BST) is implemented recursively. After inserting several elements, a search(root, value) function...
- A hash map (or dictionary) implemented with separate chaining is exhibiting very poor performance, even with a seemingly good hash function. Operations lik...
- A function sum_matrix_elements(matrix, R, C) is designed to sum all elements of a matrix with R rows and C columns. The implementation uses nested loops: t...
- Consider the array arr = [1, 2, 3, 4, 5] and the following operations: 1.Β arr.insert(2, 9) (inserts 9 at index 2) 2.Β arr.pop(3) (removes element at ind...
- Consider a singly linked list: 1 -> 2 -> 3 -> 4 -> None. If a delete_node(head, 3) function is called (which deletes the node with value 3), what will be t...
- A queue initially empty undergoes the following sequence of operations: 1.Β enqueue(10) 2.Β enqueue(20) 3.Β dequeue() 4.Β enqueue(30) 5.Β dequeue() 6....
- Consider the Quick Sort algorithm with the last element as the pivot. For the array [7, 2, 1, 6, 8, 5, 3, 4], what will be the state of the array *after th...
- Given the array [38, 27, 43, 3, 9, 82, 10], what would be the two sorted subarrays immediately *before the final merge step* in a Merge Sort algorithm?
- Perform a dry run of Binary Search for target = 29 in the sorted array [2, 12, 15, 17, 27, 29, 45]. What are the values of mid in each iteration until the ...
- Consider a graph with vertices A, B, C, D and edges with weights: (A,B)=1, (A,C)=7, (A,D)=10, (B,C)=3, (C,D)=4, (D,E)=2. (Assume E is another vertex). If y...
- Given a set of activities with start and finish times: (1,4), (3,5), (0,6), (5,7), (3,9), (5,9), (6,10), (8,11), (8,12), (2,14), (12,16). If you apply the ...
- Using a bottom-up dynamic programming approach to calculate the 6th Fibonacci number (F(0)=0, F(1)=1), what are the values stored in the DP table F at indi...
- For matrix dimensions p = {10, 20, 30, 40}, representing matrices A (10x20), B (20x30), C (30x40). What is the minimum number of scalar multiplications req...
- Consider generating all permutations of the string "ABC" using a backtracking approach. Which of the following sequences represents a valid path in the rec...
- For a 4x4 chessboard, if the first queen is placed at (0, 1) (row 0, column 1), which of the following positions would be the *first valid position* for th...
- Given the string S = "aabaaab" for Z-Algorithm, what is the Z-array for this string? (Z is typically 0 or undefined).
- Polymorphism, meaning "many forms," allows objects of different classes to be treated as objects of a common superclass. Which of the following best descri...
- The following Java code attempts to demonstrate method overloading, but it has a compilation error. How should it be corrected? public class Calculator { οΏ½...
- In C++, what mechanism is primarily used to achieve runtime polymorphism?
- .Consider the following Java code: class Shape { Β Β void draw() { Β Β Β Β System.out.println("Drawing a generic shape"); Β Β } } class Circle exte...
- The following C++ code intends to demonstrate runtime polymorphism, but it's not working as expected. What is the issue? #include class Animal { public: οΏ½...
- Which type of polymorphism in Java is achieved through method overloading?
- Consider the following C++ code: #include #include class Printer { public: Β Β void print(int num) { Β Β Β Β std::cout ...
- A Java method attempts to extract a substring. public class StringProcessor { Β Β public String extractPart(String text, int start, int length) { Β Β οΏ½...
- A C function attempts to find a substring. #include #include char* find_substring(char* haystack, char* needle) { Β Β if (haystack == NULL || needle ==...
- A Java method tries to get the length of an array and a string. public class LengthChecker { Β Β public void checkLengths() { Β Β Β Β String[] names ...
- A C function attempts to copy a substring. #include #include #include char* copy_substring(const char* source, int start_index, int length) { Β Β char* d...
- Consider a Quick Sort implementation where the pivot is always chosen as the last element. If the input array is already sorted in ascending order, what is...
- A programmer is debugging a Selection Sort implementation. They notice that after the first pass, the smallest element is correctly placed at the beginning...
- A binary search function is returning -1 (not found) even when the target element is present in the array. The array is sorted. Which of the following is a...
- A greedy algorithm is used to make change for a given amount using a set of coin denominations. For denominations {1, 5, 10, 25} and an amount of 30, it wo...
- When implementing Huffman Coding, a common issue arises if the generated codes are not unique prefixes (i.e., one code is a prefix of another, leading to a...
- In a 0/1 Knapsack problem implemented using dynamic programming, a common mistake is to allow items to be reused, effectively turning it into an unbounded ...
- A DP solution for LCS is producing incorrect lengths. Upon inspection, the dp table is being filled, but the values don't match expected outcomes. Which of...
More Topics
- Algorithms Questions
- Analog and Digital Communication Questions
- Artificial Intelligence & Machine Language Questions
- Basics of Computers Questions
- Big Data Analytics Questions
- C Programming Questions
- C++ Questions
- Cloud Computing Questions
- Compiler Design Questions
- Computer Architecture and Design Questions
- Cyber Security Questions
- Data Analytics Languages Questions
- Data Structure Questions
- Data Warehousing Questions
- Digital Logic Questions
- Emerging Technologies Questions
- IOT and mobile Computing Questions
- IT DBMS Questions
- IT Networking Questions
- Java Language Questions
- Machine Learning Questions
- Memory Management Questions
- Microsoft Office Questions
- Miscellaneous Questions Questions
- Network Layer and IP Protocol Questions
- Numerical and Statistical Computing Questions
- Object Oriented Programming Questions
- OOPS Concepts Questions
- Previous Year Questions Questions
- Programming Concept Questions
- Python Questions
- Shell Scripting Questions
- Software Engineering and Web Technology Questions
- SQL Questions
- String Manipulation Questions
- TCP IP and OSI Questions