Practice IT Operating System Questions and Answers
- 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...
- When debugging an N-Queens problem solution using backtracking, a common issue is that the algorithm either finds no solutions or finds too many, including...
- A recursive backtracking solution for the Subset Sum problem is generating duplicate subsets or missing valid subsets. Assuming the input array might conta...
- Recursive algorithms, often central to Divide and Conquer, are prone to specific debugging challenges. Which of the following is a primary concern when deb...
- Consider a min-heap represented as an array: [1, 3, 5, 7, 9]. If the element 2 is inserted into this min-heap, what will be the state of the heap array aft...
- Consider the following binary tree: Β Β Β 5 Β Β Β / \ Β Β 3Β Β 8 Β Β / \ / \ Β 1Β 4 6Β 9 What is the output of an Inorder Traversal (Left, Root...
- Given a 2D array (matrix) in Python: matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] What are the values of matrix[1][2] and matrix[2][0] respectively?
- Consider the following JSON object: json { Β "user": { Β Β "id": "u123", Β Β "name": "Alice", Β Β "age": 30, Β Β "address": { Β Β Β "street": "...
- Complete the Python code snippet to initialize an array arr of size N with all zeros, and then iterate through it from the second element (index 1) up to, ...
- Complete the insert_at_beginning function for a singly linked list. Assume Node has data and next attributes. class Node: Β Β def __init__(self, data): οΏ½...
- Complete the is_empty method for a stack implemented using a Python list. class Stack: Β Β def __init__(self): Β Β Β Β self._items = [] Β Β def pus...
- Complete the recursive search function for a Binary Search Tree (BST). class Node: Β Β def __init__(self, data): Β Β Β Β self.data = data Β Β Β Β ...
- Complete a simple hash function for a string s that sums the ASCII values of its characters and then takes the modulo of a prime number M. def simple_hash(...
- Complete the Python code to print the elements of the main diagonal of a square matrix matrix of size N x N. def print_main_diagonal(matrix, N): Β Β for ...
- Complete the Python function to return the number of elements in a given list. def get_list_length(my_list): Β Β _________ # Line to complete
- Complete the Java method to extract a substring from text starting at startIndex and having length characters. public class StringUtil { Β Β public Strin...
- Complete the Python code to check if a string email matches a simple email pattern (e.g., [email protected]). import re def is_valid_email(email): Β Β patt...
- Complete the C function to find the first occurrence of a character c in a string str and return its index. Return -1 if not found. #include // For strlen...
- Complete the Java method to check if an integer array arr is empty. public class ArrayChecker { Β Β public boolean isEmpty(int[] arr) { Β Β Β Β _____...
- Complete the C function to copy at most n characters from source starting at start_index into destination, ensuring destination is null-terminated. Assume ...
- Complete the Java code to replace all occurrences of a specific word (case-insensitive) in a string. public class RegexReplacer { Β Β public String repla...
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