Practice IT Operating System Questions and Answers
- 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...
- Complete the Python function to find the starting index of the first occurrence of sub in main_string. Return -1 if not found. def find_substring_index(mai...
- Complete the C function to calculate the length of a null-terminated string s without using strlen. int custom_strlen(const char* s) { Β Β int length = 0...
- Complete the Python function to return the last n characters of a string s. If n is greater than the string's length, return the entire string. def get_las...
- Inheritance is an OOP principle that establishes an "is-a" relationship between classes. What does this relationship primarily allow?
- Consider the following Python code: class Vehicle: Β Β def __init__(self, brand): Β Β Β Β self.brand = brand Β Β def display_info(self): Β Β Β οΏ½...
- The following Java code attempts to demonstrate multiple inheritance, which is not directly supported for classes in Java. How can similar functionality be...
- Which type of inheritance in C++ allows a class to inherit from more than one base class?
- In Python, if a method in a subclass has the same name as a method in its superclass, which method will be called when invoked on an object of the subclass...
- Consider the following Java code: class Animal { Β Β String type = "Generic Animal"; Β Β void eat() { Β Β Β Β System.out.println("Animal eats food....
- The following C++ code has a common inheritance-related issue. How can it be debugged to ensure the derived class constructor properly initializes the base...
- The following Python code attempts to call a method from the parent class, but it's using an outdated or incorrect syntax. How should it be corrected? clas...
- What is the keyword used in Java to indicate that a class is inheriting from another class?
- Consider the following C++ code: #include class Base { public: Β Β Base() { Β Β Β Β std::cout ...
- Consider the following Python code: list_a = [1, 2, 3] tuple_b = (4, 5) string_c = "hello" dict_d = {"key1": 1, "key2": 2} print(len(list_a) + len(tuple_b)...
- Consider the following Java code: public class SubstringDryRun { Β Β public static void main(String[] args) { Β Β Β Β String s = "Programming"; Β Β ...
- Consider the following Python code: import re text = "apple, banana, cherry. apple pie, banana split." pattern = r"\bapple\b|\bbanana\b" matches = re.finda...
- Consider the following C code: #include #include int main() { Β Β char* text = "The quick brown fox jumps over the lazy dog."; Β Β char* pattern = "f...
- Consider the following Java code: public class LengthMix { Β Β public static void main(String[] args) { Β Β Β Β int[] numbers = {10, 20, 30, 40}; Β ...
- Consider the following Python code: s = "PythonProgramming" part1 = s[2:6] # Corrected line part2 = s[-5:] print(part1 + part2) What will be the output of ...
- Consider the following Java code: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexGroup { Β Β public static void main(S...
- Consider the following Python code: text = "banana" char_to_find = 'a' count = 0 for i in range(len(text)): Β Β if text[i] == char_to_find: Β Β Β Β c...
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