Fill in the Blanks Complete the sentences by filling in the blanks with the correct options. You have 1 minute to solve this! Start Instructions Time left: 60s 1. ____ is the capital of 2. ____, and it is famous for 3. ____. Submit Clear All Warning: The same option cannot be used for multiple blanks! Instructions 1. Click the “Start” button to begin the game. 2. You have 1 minute to complete the game. 3. Select the blank where you want to input your answer. 4. Choose the correct option to fill the blank. 5. Use the “Clear All” button to reset your inputs. 6. Press “Submit” to see your score and correct answers. Close Share this with your friends Play and Fill More Blanks Back Crossword Sudoku Word Search Fun Quiz Fill in the Blanks [1] Search More Word Search [5] Search More Word Search [4] Search More Word Search [3] Search More Word Search [2] Search More Word Search [1] Search More
MCQs on Programming Basics [Set – 6]
MCQs on Programming Basics [Set – 6] 1. What is the difference between a variable and a constant in programming? A) Constants never change valuesB) Variables always store stringsC) Constants allow re-assignmentD) Variables only hold numbers Show Answer Correct Answer: A) Constants never change valuesExplanation: Variables can store data that changes during program execution, while constants hold fixed values that cannot be altered after initialization. 2. Which symbol is used to end a statement in C, C++, and Java? A) Colon (:) for ending linesB) Semicolon (;) for statementC) Comma (,) for line breaksD) Period (.) for termination Show Answer Correct Answer: B) Semicolon (;) for statementExplanation: In C, C++, and Java, the semicolon ; marks the end of a statement, making it syntactically complete. 3. How do you declare a variable as an integer in Python? A) Directly assign valueB) Use the let keywordC) Declare int variableD) Add int before value Show Answer Correct Answer: A) Directly assign valueExplanation: Python is dynamically typed, so variables are created by directly assigning a value, and their type is inferred. 4. What is the output of the expression 3 * (4 + 5) in most programming languages? A) Error in expressionB) 12 with no priorityC) 20 with wrong syntaxD) 27 after operations Show Answer Correct Answer: D) 27 after operationsExplanation: The parentheses ensure 4 + 5 is evaluated first, and the result is multiplied by 3, giving 27. 5. Which of the following represents the logical NOT operator in most programming languages? A) ^ symbol for inversionB) ! symbol for negationC) & symbol for conditionD) # symbol for logic Show Answer Correct Answer: B) ! symbol for negationExplanation: The ! operator inverts the truth value of a boolean expression, making True become False and vice versa. 6. What is the significance of variable initialization in programming? A) Reserves memory spaceB) Sets an initial valueC) Ensures variables are staticD) Declares variable data type Show Answer Correct Answer: B) Sets an initial valueExplanation: Initialization assigns an initial value to a variable, ensuring it doesn’t contain unpredictable (garbage) data. 7. What is the output of the expression 10 / 3 in a programming language that supports floating-point division? A) 3 with integer truncationB) 3.0 for simplified resultC) 3.33 for exact divisionD) 10 for unexpected logic Show Answer Correct Answer: C) 3.33 for exact divisionExplanation: Floating-point division retains the decimal part, so dividing 10 by 3 results in approximately 3.33. 8. Which keyword is used to exit a loop prematurely in most programming languages? A) exit for ending functionB) break to terminate loopC) continue for skipping stepD) return to exit program Show Answer Correct Answer: B) break to terminate loopExplanation: The break keyword immediately exits the loop, stopping further iterations, regardless of the loop condition. 9. How are multi-line comments written in JavaScript? A) Enclose with /* */B) Start lines with ##C) Use double quotes “”D) Use triple slashes /// Show Answer Correct Answer: A) Enclose with /* */Explanation: In JavaScript, multi-line comments are written between /* and */, allowing developers to comment multiple lines of code. 10. Which data type is used to represent decimal numbers in Python? A) str for textual dataB) int for whole numbersC) float for real numbersD) list for collections Show Answer Correct Answer: C) float for real numbersExplanation: The float data type in Python is used to represent decimal or real numbers with a fractional part. 11. What is the result of the expression 5 >= 5 in programming? A) Null due to no conditionB) False for exact matchC) True for equal valuesD) Error in syntax usage Show Answer Correct Answer: C) True for equal valuesExplanation: The >= operator checks if the left-hand operand is greater than or equal to the right-hand operand, which is True in this case. 12. How do you check the length of a string in JavaScript? A) string.length propertyB) string.size methodC) string.count functionD) string.total property Show Answer Correct Answer: A) string.length propertyExplanation: In JavaScript, the length property is used to determine the number of characters in a string. 13. What happens when a division by zero is performed in most programming languages? A) Returns infinity as resultB) Raises an error messageC) Produces a zero outputD) Crashes the entire program Show Answer Correct Answer: B) Raises an error messageExplanation: Most programming languages raise a runtime error or exception when attempting to divide by zero, as it’s mathematically undefined. 14. Which keyword is used to declare a function in JavaScript? A) return for function bodyB) def for defining codeC) lambda for expressionsD) function for definition Show Answer Correct Answer: D) function for definitionExplanation: The function keyword is used to declare functions in JavaScript, followed by the function name and parameters. 15. What is the purpose of a default case in a switch statement? A) Handle unmatched conditionsB) Exit the program entirelyC) Restart the case evaluationD) Throw errors on no match Show Answer Correct Answer: A) Handle unmatched conditionsExplanation: The default case in a switch statement executes when none of the specified case conditions are met. 16. How do you round a floating-point number to the nearest integer in Python? A) float(number) methodB) math.ceil() for roundingC) int(number) for nearestD) round(number) function Show Answer Correct Answer: D) round(number) functionExplanation: The round() function rounds a floating-point number to the nearest integer, based on the decimal part. 17. What does the term “type inference” mean in programming? A) Enforcing strict data rulesB) Automatically detecting typeC) Casting between data typesD) Specifying types explicitly Show Answer Correct Answer: B) Automatically detecting typeExplanation: Type inference allows a programming language to deduce the type of a variable from its value without explicit declaration. 18. How do you check if a string contains a specific substring in Python? A) Use in keyword directlyB) Use has() for existenceC) Use contains() methodD) Use search() function Show Answer Correct Answer: A) Use in keyword directlyExplanation: In Python, the in keyword checks if a substring exists within a string, returning True or False. 19. Which operator is used to
MCQs on Programming Basics [Set – 5]
MCQs on Programming Basics [Set – 5] 1. Which of the following is an example of polymorphism? A) Defining a function only once in codeB) Reusing a variable name across modulesC) Using the same method in multiple classesD) Creating a class without initialization Show Answer Correct Answer: C) Using the same method in multiple classesExplanation: Polymorphism allows methods in different classes to have the same name but behave differently based on the class. 2. How is exception handling implemented in Python? A) Using try-except blocks for errorsB) Using if-else conditions for logicC) Using while loops for conditionsD) Using variables to catch issues Show Answer Correct Answer: A) Using try-except blocks for errorsExplanation: In Python, exceptions are handled using try blocks to test code and except blocks to handle errors that occur. 3. What is the result of len(“Hello World”)? A) 10 as the character countB) 11 for all charactersC) 12 for spaces includedD) Error due to syntax issue Show Answer Correct Answer: B) 11 for all charactersExplanation: The len() function counts all characters in a string, including spaces, so the result is 11. 4. How can you iterate over both keys and values of a dictionary in Python? A) Use range() for indicesB) Use keys() for iterationC) Use items() method directlyD) Use dict() to access all Show Answer Correct Answer: C) Use items() method directlyExplanation: The items() method returns key-value pairs, allowing iteration over both keys and values in a dictionary. 5. What is the difference between is and == in Python? A) is checks identity, == checks equalityB) is compares values, == compares typesC) is handles errors, == evaluates logicD) is defines conditions, == assigns values Show Answer Correct Answer: A) is checks identity, == checks equalityExplanation: The is operator checks whether two variables point to the same object, while == checks if their values are equal. 6. What is the correct way to define a list comprehension in Python? A) {key: value for key in range}B) (x for x in sequence)C) {x for x in sequence}D) [x for x in sequence] Show Answer Correct Answer: D) [x for x in sequence]Explanation: List comprehensions in Python are enclosed in square brackets and provide a concise way to create lists. 7. Which of the following is used to handle errors in Python? A) pass statement logicB) def function blocksC) try-except blocksD) break statements Show Answer Correct Answer: C) try-except blocksExplanation: The try-except structure is used to handle runtime errors by catching exceptions and executing alternative code. 8. How do you open a file for reading in Python? A) open(“file.txt”, “r”)B) open(“file.txt”, “w”)C) open(“file.txt”, “a”)D) open(“file.txt”, “x”) Show Answer Correct Answer: A) open(“file.txt”, “r”)Explanation: The r mode opens a file for reading. If the file doesn’t exist, an error is raised. 9. Which method is used to close a file in Python? A) file.save() for changesB) file.close() for closureC) file.flush() for bufferD) file.quit() to terminate Show Answer Correct Answer: B) file.close() for closureExplanation: The close() method ensures the file is properly closed and resources are released. 10. What is the purpose of the finally block in exception handling? A) Ensure code runs only if no errorsB) Execute code after the try blockC) Terminate the program executionD) Skip remaining lines in code Show Answer Correct Answer: B) Execute code after the try blockExplanation: The finally block runs regardless of whether an exception occurs, often used for cleanup operations. 11. Which of the following is NOT a reserved keyword in Python? A) return for functionsB) break in loopsC) execute for callsD) continue in conditions Show Answer Correct Answer: C) execute for callsExplanation: The word execute is not a reserved keyword in Python, unlike return, break, and continue. 12. How do you generate random numbers in Python? A) Use random.randint()B) Use math.random()C) Use random.randint()D) Use seed.random() Show Answer Correct Answer: C) Use random.randint()Explanation: The random.randint() function generates a random integer within a specified range. 13. Which of the following functions checks if all elements in a list are true? A) reduce() for outputsB) any() for conditionsC) map() for functionsD) all() for all elements Show Answer Correct Answer: D) all() for all elementsExplanation: The all() function returns True if all elements in a list evaluate to True. 14. What is the output of the following code: [x**2 for x in range(3)]? A) [0, 1, 4] in resultB) [1, 4, 9] outputC) Error in syntax logicD) Null due to no operation Show Answer Correct Answer: A) [0, 1, 4] in resultExplanation: The list comprehension squares each number from 0 to 2 (range(3)), resulting in [0, 1, 4]. 15. How do you check the type of a variable in Python? A) Use isinstance(type)B) Use type(variable)C) Use len(variable)D) Use str(variable) Show Answer Correct Answer: B) Use type(variable)Explanation: The type() function returns the data type of a variable, such as int, str, or list. 16. Which of the following methods is used to sort a list in ascending order? A) list.sort() directlyB) sorted(list) functionC) range() for elementsD) map() for iteration Show Answer Correct Answer: A) list.sort() directlyExplanation: The sort() method modifies a list in place to arrange its elements in ascending order. 17. What is the result of int(’10’) + float(‘5.5’)? A) 15.5 for numeric additionB) Error in conversion syntaxC) 10.5 for combined valuesD) Null due to type mismatch Show Answer Correct Answer: A) 15.5 for numeric additionExplanation: The string ’10’ is converted to an integer, ‘5.5’ to a float, and their sum is 15.5. 18. How do you check if a string starts with a specific character in Python? A) str.match(‘char’)B) str.contains(‘char’)C) str.startswith(‘char’)D) str.prefix(‘char’) Show Answer Correct Answer: C) str.startswith(‘char’)Explanation: The startswith() method checks if a string begins with the specified substring. 19. What is the purpose of the enumerate function in Python? A) Create lists from sequencesB) Sort elements by orderC) Map keys to values directlyD) Iterate with index pairs Show Answer Correct Answer: D) Iterate with index pairsExplanation: The enumerate() function adds an index to each item in a sequence during iteration. 20. Which keyword
MCQs on Programming Basics [Set – 4]
MCQs on Programming Basics [Set – 4] 1. Which of the following is an immutable data type in Python? A) List is mutable and flexibleB) String is immutable in PythonC) Set is mutable in operationsD) Dictionary is changeable type Show Answer Correct Answer: B) String is immutable in PythonExplanation: Strings in Python cannot be modified after creation. Any operation on a string creates a new string instead of altering the original. 2. How can you concatenate two lists in Python? A) Use the + operator for listsB) Use the append method in loopsC) Use the range function directlyD) Use the iter function on lists Show Answer Correct Answer: A) Use the + operator for listsExplanation: The + operator combines two lists by creating a new list containing all elements from both lists. 3. Which of the following is NOT an arithmetic operator? A) + for addition operationB) // for integer divisionC) and for logical comparisonD) % for modulus operation Show Answer Correct Answer: C) and for logical comparisonExplanation: The and keyword is a logical operator used for conditional statements, not for arithmetic operations. 4. What is the result of bool([]) in Python? A) True because it’s validB) False because it’s emptyC) Error due to syntaxD) Null for invalid input Show Answer Correct Answer: B) False because it’s emptyExplanation: An empty list is considered False in a boolean context in Python. Non-empty lists return True. 5. What is the default value of a static variable in Java? A) Null for all static typesB) False for boolean valuesC) Zero for all data typesD) Garbage for uninitialized Show Answer Correct Answer: B) False for boolean valuesExplanation: In Java, static boolean variables are initialized to false by default, while numeric types default to 0. 6. How do you append an element to a list in Python? A) Use the pop() functionB) Use the insert() functionC) Use the len() functionD) Use the append() function Show Answer Correct Answer: D) Use the append() functionExplanation: The append() method adds an element to the end of the list without modifying existing elements. 7. Which function is used to remove an element from a list in Python? A) pop() removes specific indexB) append() adds elementsC) clear() empties the listD) count() finds occurrences Show Answer Correct Answer: A) pop() removes specific indexExplanation: The pop() method removes and returns the element at a specific index, with the default being the last element. 8. What is the output of type(None) in Python? A) <class ‘int’> for numericalB) <class ‘NoneType’> outputC) <class ‘str’> for stringsD) <class ‘object’> general Show Answer Correct Answer: B) <class ‘NoneType’> outputExplanation: The type() function returns <class ‘NoneType’> when passed None, which is a unique data type in Python. 9. Which keyword is used to create an infinite loop in Java? A) Use while(true) syntaxB) Use do-while(true) loopC) Use for(;;) with no conditionsD) Use loop(true) for execution Show Answer Correct Answer: C) Use for(;;) with no conditionsExplanation: The for(;;) syntax in Java creates an infinite loop by omitting all loop control parameters. 10. What is the difference between a tuple and a list in Python? A) Tuples are immutable data typesB) Lists can only hold stringsC) Tuples use square bracketsD) Lists cannot hold duplicates Show Answer Correct Answer: A) Tuples are immutable data typesExplanation: Tuples cannot be modified after creation, while lists are mutable and allow changes. 11. How do you write a nested function in Python? A) lambda function() inner()B) function(outer): call innerC) def outer(): def inner()D) init function(): nested defs Show Answer Correct Answer: C) def outer(): def inner()Explanation: In Python, nested functions are written by defining one function inside another, enabling encapsulated logic. 12. What will the following code output? print(‘5’ + ‘5’) A) 10 as an integer resultB) 55 as a concatenated stringC) Error in type coercionD) Undefined due to data types Show Answer Correct Answer: B) 55 as a concatenated stringExplanation: The + operator concatenates strings. Since both ‘5’ and ‘5’ are strings, the result is ’55’. 13. What is the correct syntax to initialize a variable in JavaScript? A) var x = 5; declarationB) define x = 5; assignmentC) initialize x with let 5D) type x: number assign 5 Show Answer Correct Answer: A) var x = 5; declarationExplanation: In JavaScript, the var or let keyword is used to declare variables, followed by the assignment operator =. 14. How can you create a set in Python? A) list() to avoid duplicatesB) {} to store unique itemsC) set() to initialize valuesD) dict() to define values Show Answer Correct Answer: C) set() to initialize valuesExplanation: The set() function creates a collection of unique, unordered elements. {} is also used but can be ambiguous with empty dictionaries. 15. What is the difference between mutable and immutable data types? A) Mutable only stores numbersB) Immutable changes contentsC) Mutable allows data changeD) Immutable defines a sequence Show Answer Correct Answer: C) Mutable allows data changeExplanation: Mutable data types, like lists, can be modified after creation, while immutable types, like tuples, cannot. 16. What is the output of list(range(3)) in Python? A) [0, 1, 2] as a sequenceB) [1, 2, 3] by incrementC) Error in argument typeD) Null for undefined range Show Answer Correct Answer: A) [0, 1, 2] as a sequenceExplanation: The range(3) function generates numbers from 0 to 2, and list() converts them into a list. 17. Which keyword is used to inherit a class in Python? A) class extends parent()B) class derived from()C) class child(base): defineD) class child(parent): base Show Answer Correct Answer: D) class child(parent): baseExplanation: In Python, inheritance is specified by placing the parent class name inside parentheses after the child class name. 18. Which of the following is a characteristic of object-oriented programming? A) Sequential data in arraysB) Functions with no stateC) Conditional loops in logicD) Encapsulation in methods Show Answer Correct Answer: D) Encapsulation in methodsExplanation: Object-oriented programming emphasizes encapsulation, where data and functions are bundled into objects. 19. What is the purpose of the __init__ method in Python? A) Initialize
MCQs on Programming Basics [Set – 3]
MCQs on Programming Basics [Set – 3] 1. How many times will the following loop execute? for i in range(5): print(i) A) 4 times in totalB) 5 times in totalC) Infinite due to errorD) Once for every element Show Answer Correct Answer: B) 5 times in totalExplanation: The range(5) function generates numbers from 0 to 4, so the loop executes 5 times, printing each value. 2. What is the output of the following: print(5 // 2) in Python? A) 2 for integer divisionB) 2.5 for floating resultC) 0 due to truncationD) Error in syntax use Show Answer Correct Answer: A) 2 for integer divisionExplanation: The // operator performs floor division, discarding the fractional part. Dividing 5 by 2 gives 2. 3. Which keyword is used to define a class in Python? A) class for structureB) def for declarationC) struct for dataD) object for templates Show Answer Correct Answer: A) class for structureExplanation: The class keyword in Python defines a blueprint for creating objects, encapsulating methods and attributes. 4. What is the correct way to initialize a dictionary in Python? A) (key1:value1, key2:value2)B) [key1:value1, key2:value2]C) {key1:value1, key2:value2}D) <key1:value1, key2:value2> Show Answer Correct Answer: C) {key1:value1, key2:value2}Explanation: Dictionaries in Python use curly braces {} to store key-value pairs, separated by a colon :. 5. What is the use of the is keyword in Python? A) Assigns values to variablesB) Compares identity of objectsC) Defines scope in a blockD) Checks for membership Show Answer Correct Answer: B) Compares identity of objectsExplanation: The is operator checks whether two variables point to the same object in memory, not just their values. 6. What is the significance of indentation in Python code? A) Indicates block of codeB) Adds comments in loopsC) Separates multiple linesD) Specifies logical errors Show Answer Correct Answer: A) Indicates block of codeExplanation: Python uses indentation to define blocks of code, such as those in loops, functions, and conditionals, instead of braces. 7. Which of the following is a valid function definition in Python? A) define my_function() {pass}B) function my_function(): passC) def my_function(): passD) func my_function {return;} Show Answer Correct Answer: C) def my_function(): passExplanation: Python functions are defined using the def keyword, followed by the function name, parentheses, and a colon. 8. What is the output of the following: 5 == 5.0 in most programming languages? A) False because types differB) Cannot evaluate conditionC) Error in type coercionD) True because values match Show Answer Correct Answer: D) True because values matchExplanation: In most languages, 5 (integer) and 5.0 (float) are considered equal because their values are equivalent. 9. Which of the following is the correct syntax to create a 2D array in Java? A) int[][] arr = new int[3][3];B) int arr[3][3] = new int;C) int arr = [3][3] integers;D) int new array[3][3]; Show Answer Correct Answer: A) int[][] arr = new int[3][3];Explanation: In Java, a 2D array is declared using double square brackets [][] followed by memory allocation with new. 10. What is the difference between break and return statements in a function? A) break continues execution; return halts all codeB) break exits loops; return exits functionsC) break skips lines; return changes logicD) break modifies loops; return accesses variables Show Answer Correct Answer: B) break exits loops; return exits functionsExplanation: The break statement exits a loop, while return exits a function and optionally returns a value. 11. Which of the following is used to declare a variable in JavaScript? A) let declaration keywordB) def declaration keywordC) init declaration keywordD) var declaration keyword Show Answer Correct Answer: D) var declaration keywordExplanation: In JavaScript, var and let are commonly used to declare variables, with let being the modern preference. 12. Which keyword is used to define a block of code that might throw an error? A) error for debug toolsB) catch for conditionsC) try for error handling D) block for secure access Show Answer Correct Answer: C) try for error handlingExplanation: The try keyword is used to define a block of code where exceptions might occur, typically followed by catch or finally. 13. What is the correct way to find the size of an array in most programming languages? A) array.length propertyB) size(array) functionC) array.count propertyD) getSize(array) function Show Answer Correct Answer: A) array.length propertyExplanation: The .length property is widely used in many programming languages to find the number of elements in an array. 14. How are private variables typically indicated in object-oriented programming? A) By starting with an underscore _B) By using all-uppercase namesC) By ending with a semicolon ;D) By using angle brackets < > Show Answer Correct Answer: A) By starting with an underscore _Explanation: In many languages like Python, private variables are indicated by a single or double underscore prefix, though true enforcement depends on the language. 15. Which of the following is a mutable data type in Python? A) Float is immutableB) String is immutableC) Tuple is immutableD) List is mutable type Show Answer Correct Answer: D) List is mutable typeExplanation: Lists in Python can be modified after creation, while strings, tuples, and numbers are immutable. 16. Which symbol is used to start a single-line comment in Python? A) ;; for single-line commentB) // for single-line commentC) # for single-line commentD) ** for single-line comment Show Answer Correct Answer: C) # for single-line commentExplanation: In Python, single-line comments start with a # symbol, and the interpreter ignores the text following it. 17. What is the output of not True in Python? A) Error in logical syntaxB) True is the outputC) Null for invalid logicD) False is the output Show Answer Correct Answer: D) False is the outputExplanation: The not operator inverts a boolean value. Since True is inverted, the result is False. 18. How do you declare a multi-line string in Python? A) “”” for multiple linesB) <<EOF for multiple linesC) {} brackets for stringsD) using backticks “ Show Answer Correct Answer: A) “”” for multiple linesExplanation: Multi-line strings in Python are enclosed in triple quotes (“”” or ”’), allowing the string to span multiple lines. 19. Which function
MCQs on Programming Basics [Set – 2]
MCQs on Programming Basics [Set – 2] 1. What is the correct syntax to declare an array in Java? A) int[] arr = new int[5];B) array int arr = 5;C) declare int arr[5];D) int arr = [5]; Show Answer Correct Answer: A) int[] arr = new int[5];Explanation: In Java, arrays are declared using square brackets [], followed by the new keyword to allocate memory for the specified size. 2. How can you access the last element of an array in most languages? A) Use array[length-1] for accessB) Reference array[-1] directlyC) Access array[length*2] directlyD) Use array[0] for the last element Show Answer Correct Answer: A) Use array[length-1] for accessExplanation: Arrays are zero-indexed in most languages, so the last element is accessed using the index length-1. 3. What is the default value of a boolean variable in Java? A) True as default valueB) False as default valueC) Null as default valueD) Undefined in Java memory Show Answer Correct Answer: B) False as default valueExplanation: In Java, boolean variables default to false when not explicitly initialized, ensuring predictable behavior. 4. Which operator is used to compare two values for equality in programming? A) || operator for logic checkB) := operator for comparisonC) && operator for conditionsD) == operator for comparison Show Answer Correct Answer: D) == operator for comparisonExplanation: The == operator checks if two values are equal, returning True or False depending on the comparison. 5. Which of the following is an example of a ternary operator syntax? A) condition ? value1 : value2B) condition == value ? optionC) if(condition) {value1} else {value2}D) option (condition) : value check Show Answer Correct Answer: A) condition ? value1 : value2Explanation: The ternary operator is a shorthand for an if-else statement, evaluating a condition and returning one of two values. 6. What is the output of the following: print(type(5.0))? A) <class ‘int’> in PythonB) <class ‘str’> in PythonC) <class ‘float’> in PythonD) Error in type check Show Answer Correct Answer: C) <class ‘float’> in PythonExplanation: The type() function in Python returns the type of the object. Since 5.0 is a floating-point number, the output is <class ‘float’>. 7. Which keyword is used to define a function in Python? A) func for defining functionsB) def for defining functionsC) lambda for defining functionsD) init for defining functions Show Answer Correct Answer: B) def for defining functionsExplanation: In Python, the def keyword is used to declare a function, followed by the function name and parameters in parentheses. 8. What is the output of the expression: “Hello” + “World” in most programming languages? A) Hello World is displayedB) HelloWorld is displayedC) Error in concatenation syntaxD) Hello-World is displayed Show Answer Correct Answer: B) HelloWorld is displayedExplanation: The + operator concatenates strings in most languages, combining “Hello” and “World” into “HelloWorld”. 9. How do you create an infinite loop in Python? A) while True: loop executionB) for x in range(): loop executionC) if x == 0: infinite checkD) do: condition until stop Show Answer Correct Answer: A) while True: loop executionExplanation: A while True loop runs indefinitely because the condition is always true unless explicitly terminated with a break. 10. Which of the following is NOT an example of a loop? A) for in iteration loopB) while for conditional loopC) if for checking conditionD) do-while for guaranteed loop Show Answer Correct Answer: C) if for checking conditionExplanation: An if statement is a conditional structure and not a loop, as it does not repeat execution based on conditions. 11. What is the main advantage of using a function in programming? A) Avoid repetitive code blocksB) Increase execution speedC) Reduce memory consumptionD) Minimize number of variables Show Answer Correct Answer: A) Avoid repetitive code blocksExplanation: Functions allow code reuse by enabling the same logic to be called multiple times, reducing redundancy and improving maintainability. 12. Which of the following is NOT a characteristic of a variable? A) Variables store data valuesB) Variables hold fixed data typesC) Variables always initialize memoryD) Variables allow data changes Show Answer Correct Answer: C) Variables always initialize memoryExplanation: Variables do not always initialize memory automatically; in some languages, they may hold garbage values if not explicitly initialized. 13. Which data structure is used to store a collection of key-value pairs? A) Dictionary data structureB) Array for storing elementsC) Stack for managing sequencesD) Queue for ordered elements Show Answer Correct Answer: A) Dictionary data structureExplanation: Dictionaries store data as key-value pairs, allowing quick access to values based on their associated keys. 14. What is the output of the following code: if 0: print(“True”) else: print(“False”)? A) True for non-zero checkB) False for zero conditionC) Error in logical syntaxD) True and False displayed Show Answer Correct Answer: B) False for zero conditionExplanation: In Python, 0 is considered False in a boolean context, so the else block is executed, printing “False”. 15. How do you check if an element exists in a list in Python? A) Use find(list, element) checkB) Use list.has(element) checkC) Use list.contains() methodD) Use element in list check Show Answer Correct Answer: D) Use element in list checkExplanation: The in keyword checks if an element exists in a list, returning True if the element is found. 16. What is the primary difference between while and do-while loops? A) do-while checks at start; while checks endB) while uses indices; do-while does notC) do-while runs once; while may notD) while needs initialization; do-while does not Show Answer Correct Answer: C) do-while runs once; while may notExplanation: A do-while loop executes at least once before checking the condition, whereas a while loop checks the condition first. 17. Which of the following operators is used to access a member of an object? A) The : operator in programmingB) The . operator in programmingC) The -> operator in functionsD) The @ operator in Python Show Answer Correct Answer: B) The . operator in programmingExplanation: The dot . operator is used to access attributes or methods of an object in most programming languages. 18. What is the result of the expression: 2
MCQs on Programming Basics [Set – 1]
MCQs on Programming Basics [Set – 1] 1. What is the result of the following code snippet: x = 5; y = x + 2; print(y)? A) 2 is displayed on the screenB) 5 is displayed as the resultC) 7 is displayed on the screenD) Error due to missing semicolon Show Answer Correct Answer: C) 7 is displayed on the screenExplanation: The code assigns 5 to x, adds 2 to it, and assigns the result to y. When y is printed, the output is 7. 2. Which of the following is used to terminate a while loop in most programming languages? A) break statementB) continue statementC) pass statementD) next statement Show Answer Correct Answer: A) break statementExplanation: The break statement is used to exit a loop immediately, regardless of the loop’s condition. 3. Which keyword is used to declare a constant in programming? A) static keywordB) let keywordC) const keywordD) fixed keyword Show Answer Correct Answer: C) const keywordExplanation: The const keyword is used to declare constants, ensuring the variable’s value cannot be changed after initialization. 4. What is the output of the expression: 10 % 3? A) 0 as the resultB) 1 as the remainderC) 3 as the divisorD) 10 as the numerator Show Answer Correct Answer: B) 1 as the remainderExplanation: The modulo operator % returns the remainder of a division. Dividing 10 by 3 gives a remainder of 1. 5. Which of the following is NOT a valid data type in most programming languages? A) float data typeB) boolean data typeC) number data typeD) string data type Show Answer Correct Answer: C) number data typeExplanation: Most programming languages do not have a number data type; they use specific types like int, float, or double. 6. What is the purpose of the elif statement in programming? A) Terminate a program’s executionB) Provide additional conditional checksC) Repeat a block of code continuouslyD) Initialize variables within a loop Show Answer Correct Answer: B) Provide additional conditional checksExplanation: The elif statement allows for additional conditions to be checked when the initial if condition is false. 7. In a for loop, which part specifies the range of values to iterate over? A) Condition to terminateB) Initialization variableC) Range function or sequenceD) Increment or decrement step Show Answer Correct Answer: C) Range function or sequenceExplanation: In a for loop, the range function or sequence defines the set of values over which the loop will iterate. 8. Which operator is used for logical AND in most programming languages? A) || symbol for logicB) && symbol for logicC) == symbol for comparisonD) ++ operator for increment Show Answer Correct Answer: B) && symbol for logicExplanation: The && operator checks whether both conditions in a logical statement are true. 9. What happens if a variable is used without being initialized in most languages? A) An error is thrown immediatelyB) The variable is treated as nullC) A default value is assignedD) Undefined behavior occurs Show Answer Correct Answer: D) Undefined behavior occursExplanation: In most languages, using an uninitialized variable can lead to unpredictable behavior or errors, depending on the language. 10. How is a block of code defined in Python? A) Using curly braces {}B) Indenting lines properlyC) Adding a semicolon ;D) Using parentheses () Show Answer Correct Answer: B) Indenting lines properlyExplanation: Python uses indentation to define blocks of code, unlike other languages that rely on braces or keywords. 11. What is the default value of an uninitialized integer variable in most languages like C/C++? A) 0 is assigned by defaultB) A random value is assignedC) Null is used for uninitialized variablesD) Undefined behavior occurs Show Answer Correct Answer: B) A random value is assignedExplanation: In C/C++, uninitialized variables may hold a garbage value unless explicitly initialized. 12. What will be the result of the following code snippet: x = 5; x += 2; print(x)? A) 2 is printedB) 5 is printedC) 7 is printedD) Error due to syntax Show Answer Correct Answer: C) 7 is printedExplanation: The x += 2 statement is shorthand for x = x + 2, so x becomes 7, which is then printed. 13. Which of the following loops guarantees execution at least once? A) for loop in generalB) while loop in all casesC) do-while loop in logicD) nested loop in recursion Show Answer Correct Answer: C) do-while loop in logicExplanation: A do-while loop executes its code block at least once before checking the condition. 14. What is the purpose of the continue statement in a loop? A) Skip the current iterationB) Restart the loop from the beginningC) Terminate the loop executionD) Reverse the iteration sequence Show Answer Correct Answer: A) Skip the current iterationExplanation: The continue statement skips the remaining code in the current iteration and proceeds to the next loop cycle. 15. Which function is commonly used to get the length of a string or array? A) size() function for arraysB) length() function for objectsC) len() function for sequencesD) count() function for elements Show Answer Correct Answer: C) len() function for sequencesExplanation: In languages like Python, the len() function returns the number of elements in strings, arrays, or lists. 16. How is a comment written in C++? A) Using # symbol at the beginningB) Using // for single-line commentsC) Wrapping text with {} bracesD) Using : at the start Show Answer Correct Answer: B) Using // for single-line commentsExplanation: Single-line comments in C++ begin with //, while multi-line comments are enclosed within /* */. 17. What will the expression True and False evaluate to in Python? A) True for both conditionsB) Error in boolean comparisonC) Null for invalid logicD) False because both are not true Show Answer Correct Answer: D) False because both are not trueExplanation: The and operator evaluates to True only if both conditions are True. Since one is False, the result is False. 18. In a function, what is the purpose of the return statement? A) End the function and return a valueB) Restart the function executionC) Skip some lines in the functionD) Log the
MCQs on Networking & Internet [Set – 2]
MCQs on Networking & Internet [Set – 2] 1. What is the maximum length of a CAT6 Ethernet cable to maintain performance? A) 50 meters for stable speedB) 150 meters for all devicesC) 100 meters for full performanceD) 200 meters in ideal conditions Show Answer Correct Answer: C) 100 meters for full performanceExplanation: CAT6 cables are designed to maintain optimal performance, including gigabit speeds, for distances up to 100 meters (approximately 328 feet). Beyond this, signal degradation can occur. 2. What is the purpose of ICMP (Internet Control Message Protocol)? A) Assign IP addresses dynamicallyB) Monitor and report network errorsC) Encrypt data for secure transferD) Resolve hostnames to IP addresses Show Answer Correct Answer: B) Monitor and report network errorsExplanation: ICMP is used for diagnostic and error-reporting purposes in networks, such as identifying unreachable hosts or measuring response times with tools like ping. 3. How does a wireless access point function in a network? A) Connects wired devices to each otherB) Extends the range of a wireless networkC) Encrypts wireless data for securityD) Assigns IP addresses to connected devices Show Answer Correct Answer: B) Extends the range of a wireless networkExplanation: Wireless access points connect wireless devices to a wired network, extending the network’s range and enabling seamless wireless connectivity. 4. What is the role of a port number in networking? A) Identifies specific applications on a deviceB) Tracks data packets across subnetsC) Maps MAC addresses to IP addressesD) Encrypts data transmitted between devices Show Answer Correct Answer: A) Identifies specific applications on a deviceExplanation: Port numbers distinguish between different services or applications running on the same device, enabling effective communication between systems. 5. What does the term “bandwidth” mean in the context of networking? A) The maximum speed of a network connectionB) The delay between sending and receiving dataC) The total data transmitted over timeD) The amount of data a network can handle Show Answer Correct Answer: D) The amount of data a network can handleExplanation: Bandwidth refers to the capacity of a network connection, indicating the maximum amount of data that can be transmitted in a given time, usually measured in Mbps or Gbps. 6. How does the traceroute command work in identifying network paths? A) Sends encrypted packets to all routersB) Measures delay across each hop in the pathC) Resolves IP addresses to hostnamesD) Assigns temporary addresses for testing Show Answer Correct Answer: B) Measures delay across each hop in the pathExplanation: Traceroute sends packets to identify each hop (router) along the path to a destination, measuring delays and showing where issues may occur. 7. What is the primary function of a gateway in networking? A) Translate between network protocolsB) Monitor and prioritize data trafficC) Encrypt and decrypt network dataD) Resolve conflicts in IP assignments Show Answer Correct Answer: A) Translate between network protocolsExplanation: A gateway connects different networks, often translating between protocols, ensuring data communication between systems using different standards. 8. What is the difference between a public IP address and a private IP address? A) Public IP is routable globally; private is local onlyB) Private IP uses IPv6; public IP uses IPv4C) Public IP is assigned by DHCP; private is staticD) Private IP encrypts data; public IP does not Show Answer Correct Answer: A) Public IP is routable globally; private is local onlyExplanation: Public IP addresses are globally unique and accessible over the Internet, while private IP addresses are used within local networks and cannot be routed externally. 9. How does Quality of Service (QoS) improve network performance? A) Encrypts data to avoid interferenceB) Prioritizes critical traffic over less important trafficC) Increases the bandwidth of all network connectionsD) Reduces the latency for all types of communication Show Answer Correct Answer: B) Prioritizes critical traffic over less important trafficExplanation: QoS ensures that high-priority data, such as video calls or VoIP, gets preference over less critical traffic, optimizing network performance. 10. What is the significance of the BGP (Border Gateway Protocol) in Internet routing? A) Assigns IP addresses dynamicallyB) Determines the best path between autonomous systemsC) Encrypts data between connected routersD) Monitors latency in real-time Show Answer Correct Answer: B) Determines the best path between autonomous systemsExplanation: BGP is the protocol used to route data between large networks (autonomous systems) on the Internet, ensuring efficient data delivery. 11. How do collision domains and broadcast domains differ in networking? A) Collisions occur in switches; broadcasts occur in routersB) Collisions are limited to one device; broadcasts affect all devicesC) Collisions involve packet errors; broadcasts involve sending to all devicesD) Collision domains are separated by switches; broadcast domains by routers Show Answer Correct Answer: D) Collision domains are separated by switches; broadcast domains by routersExplanation: Switches reduce collision domains by providing individual connections for devices, while routers separate broadcast domains to prevent excessive traffic. 12. What is the function of a DHCP server in a network? A) Dynamically assign IP addresses to devicesB) Encrypt network data for secure communicationC) Monitor bandwidth usage across devicesD) Resolve hostnames to IP addresses Show Answer Correct Answer: A) Dynamically assign IP addresses to devicesExplanation: DHCP servers automatically assign IP addresses, reducing the need for manual configuration and ensuring efficient network management. 13. How does data encapsulation work in the OSI model? A) Layers add headers to data as it travelsB) Packets are split into smaller segmentsC) Data is encrypted at every network layerD) Protocols ensure equal bandwidth allocation Show Answer Correct Answer: A) Layers add headers to data as it travelsExplanation: In data encapsulation, each layer of the OSI model adds its own header (and sometimes a trailer) to the data as it passes through, preparing it for transmission. 14. What is the role of a Content Delivery Network (CDN) in improving website performance? A) Monitors and prioritizes network bandwidthB) Encrypts data between clients and serversC) Distributes content to servers close to usersD) Optimizes database queries for speed Show Answer Correct Answer: C) Distributes content to servers close to usersExplanation: CDNs store copies of website content on geographically distributed servers, reducing latency and
MCQs on Networking & Internet [Set – 1]
MCQs on Networking & Internet [Set – 1] 1. What is the primary function of a router in a network? A) Assign IP addresses to devicesB) Direct traffic between networksC) Encrypt sensitive network dataD) Monitor bandwidth usage Show Answer Correct Answer: B) Direct traffic between networksExplanation: A router connects different networks and determines the best path for data packets to travel, ensuring efficient communication. 2. What does the term “subnet mask” signify in networking? A) Define broadcast domainsB) Identify network and host parts of an IP addressC) Specify the type of encryption usedD) Measure the latency in data transfer Show Answer Correct Answer: B) Identify network and host parts of an IP addressExplanation: A subnet mask divides an IP address into the network and host portions, helping to determine which subnet a device belongs to. 3. How is data transmitted in a circuit-switched network compared to a packet-switched network? A) Continuous and dedicated in circuit-switched; divided into packets in packet-switchedB) Randomized in circuit-switched; sequential in packet-switchedC) Encrypted in circuit-switched; unencrypted in packet-switchedD) Asynchronous in circuit-switched; synchronous in packet-switched Show Answer Correct Answer: A) Continuous and dedicated in circuit-switched; divided into packets in packet-switchedExplanation: Circuit-switched networks establish a dedicated connection for the duration of a communication session, while packet-switched networks break data into packets sent independently. 4. What is the primary purpose of a firewall in a computer network? A) Enhance data transmission speedB) Protect the network from unauthorized accessC) Assign unique IP addresses to devicesD) Manage bandwidth for connected devices Show Answer Correct Answer: B) Protect the network from unauthorized accessExplanation: Firewalls monitor and control incoming and outgoing traffic based on security rules, preventing unauthorized access to the network. 5. Which protocol is responsible for assigning IP addresses dynamically to devices in a network? A) DNSB) ICMPC) ARPD) DHCP Show Answer Correct Answer: D) DHCPExplanation: The Dynamic Host Configuration Protocol (DHCP) assigns IP addresses dynamically to devices, simplifying network configuration. 6. What is the difference between IPv4 and IPv6 addressing? A) IPv6 provides a larger address space than IPv4B) IPv4 uses fewer protocols than IPv6C) IPv6 encrypts data by default, unlike IPv4D) IPv4 supports DNS better than IPv6 Show Answer Correct Answer: A) IPv6 provides a larger address space than IPv4Explanation: IPv4 uses 32-bit addressing, supporting around 4 billion unique addresses, while IPv6 uses 128-bit addressing, allowing for a virtually unlimited number of addresses. 7. How does a VPN (Virtual Private Network) enhance security in a network? A) Assign unique IP addresses to usersB) Monitors bandwidth for secure connectionsC) Encrypts data and masks IP addressesD) Prevents malware from spreading Show Answer Correct Answer: C) Encrypts data and masks IP addressesExplanation: VPNs encrypt transmitted data and hide the user’s IP address, ensuring privacy and security on public and private networks. 8. What is the significance of DNS (Domain Name System) in the Internet? A) Maps IP addresses to domain namesB) Encrypts data for secure communicationC) Optimizes network speed for websitesD) Prevents unauthorized access to servers Show Answer Correct Answer: A) Maps IP addresses to domain namesExplanation: DNS translates human-readable domain names (like www.example.com) into IP addresses, enabling devices to locate and communicate with websites. 9. Which OSI layer is responsible for end-to-end delivery of data? A) Application layerB) Network layerC) Transport layerD) Data link layer Show Answer Correct Answer: C) Transport layerExplanation: The transport layer ensures reliable end-to-end data delivery, managing error checking, retransmissions, and flow control. 10. What does the term “latency” refer to in network communication? A) The speed of data transfer over a networkB) The time it takes for data to travelC) The size of packets sent in a networkD) The encryption level of transmitted data Show Answer Correct Answer: B) The time it takes for data to travelExplanation: Latency refers to the delay between sending and receiving data in a network, often measured in milliseconds. 11. How does a proxy server work in a network? A) Directly connects devices to the InternetB) Acts as an intermediary for requestsC) Encrypts all transmitted data automaticallyD) Assigns static IP addresses to clients Show Answer Correct Answer: B) Acts as an intermediary for requestsExplanation: A proxy server handles client requests to access resources, improving privacy, security, and caching for better performance. 12. What is the role of a MAC address in a network? A) Resolve conflicts in IP address assignmentB) Encrypt transmitted data for securityC) Improve data transfer speeds on Wi-FiD) Assign unique physical addresses to devices Show Answer Correct Answer: D) Assign unique physical addresses to devicesExplanation: MAC (Media Access Control) addresses are unique identifiers for devices on a local network, used for communication within a LAN. 13. What is the purpose of the TCP three-way handshake process? A) Encrypt data before transmissionB) Assign dynamic IP addressesC) Establish a reliable connectionD) Ensure the quickest routing path Show Answer Correct Answer: C) Establish a reliable connectionExplanation: The TCP three-way handshake synchronizes communication between devices, ensuring a reliable connection before data transfer begins. 14. What is the main function of a switch in a network? A) Direct packets to appropriate devicesB) Encrypt transmitted network dataC) Assign IP addresses to devicesD) Optimize bandwidth for all users Show Answer Correct Answer: A) Direct packets to appropriate devicesExplanation: Switches manage data flow by forwarding packets only to the intended recipient devices in a network. 15. How does SSL/TLS ensure secure communication over the Internet? A) By encrypting data and verifying identitiesB) By assigning unique IP addresses to usersC) By monitoring traffic for potential threatsD) By preventing malware distribution Show Answer Correct Answer: A) By encrypting data and verifying identitiesExplanation: SSL/TLS encrypts data and authenticates the server and client, ensuring secure communication over the Internet. 16. What is the difference between unicast, multicast, and broadcast communication? A) Unicast sends to many; multicast to all; broadcast to oneB) Unicast sends to all; multicast to many; broadcast to noneC) Unicast sends to one; multicast to many; broadcast to allD) Unicast sends to all; multicast to one; broadcast to many Show Answer Correct Answer: C) Unicast sends
MCQs on Operating Systems [Set – 1]
MCQs on Operating Systems [Set – 1] 1. What is the main function of an operating system? A) Provide a file structureB) Manage hardware resourcesC) Compile and run programsD) Encrypt stored information Show Answer Correct Answer: B) Manage hardware resourcesExplanation: The operating system acts as an intermediary between hardware and applications, managing resources like memory, CPU, and storage. 2. Which scheduling algorithm may cause starvation? A) Priority-based schedulingB) First-come, first-servedC) Round-robin schedulingD) Shortest job next Show Answer Correct Answer: A) Priority-based schedulingExplanation: In priority scheduling, low-priority processes may never execute if high-priority processes continuously enter the system, leading to starvation. 3. What is the main advantage of multiprogramming systems? A) Improve security featuresB) Reduce power consumptionC) Increase CPU utilizationD) Manage user access rights Show Answer Correct Answer: C) Increase CPU utilizationExplanation: Multiprogramming allows multiple processes to share CPU time, ensuring that the CPU is not idle and increasing efficiency. 4. Which component of the operating system maintains the directory structure? A) File system componentB) Process scheduler toolC) Memory management unitD) System call interface Show Answer Correct Answer: A) File system componentExplanation: The file system organizes and maintains the directory structure, enabling easy access and storage of files. 5. In a priority scheduling algorithm, which process is executed first? A) The process with lowest priorityB) The process with least memoryC) The process in the ready queueD) The process with highest priority Show Answer Correct Answer: D) The process with highest priorityExplanation: In priority scheduling, the process with the highest assigned priority is selected for execution. 6. What happens when a process tries to access a memory location it does not own? A) The process completes normallyB) A segmentation fault occursC) The system reallocates memoryD) An infinite loop is executed Show Answer Correct Answer: B) A segmentation fault occursExplanation: Unauthorized memory access triggers a segmentation fault, terminating the process to protect system stability. 7. Which of the following is used for inter-process communication? A) Pipes for data exchangeB) Semaphores for schedulingC) Paging for memory sharingD) Mutexes for thread control Show Answer Correct Answer: A) Pipes for data exchangeExplanation: Pipes provide a mechanism for inter-process communication by allowing processes to read and write data in a shared buffer. 8. What is the name of the queue where processes wait for I/O operations to complete? A) Ready queue for processesB) Run queue for executionC) Waiting queue for I/OD) Interrupt queue for CPU Show Answer Correct Answer: C) Waiting queue for I/OExplanation: Processes waiting for I/O operations reside in the waiting queue until their I/O requests are fulfilled. 9. What is the function of a system call in operating systems? A) Enable user access controlB) Provide interface to kernelC) Monitor hardware devicesD) Encrypt sensitive files Show Answer Correct Answer: B) Provide interface to kernelExplanation: System calls allow user-level applications to request services from the operating system’s kernel. 10. In Unix, which command is used to terminate a process? A) kill to stop executionB) exit for system shutdownC) stop for pausing processD) terminate for program end Show Answer Correct Answer: A) kill to stop executionExplanation: The kill command in Unix terminates a process by sending a specific signal, typically SIGTERM or SIGKILL. 11. Which type of OS is most suitable for time-critical tasks? A) Batch processing operating systemB) Real-time operating systemC) Networked operating systemD) Distributed operating system Show Answer Correct Answer: B) Real-time operating systemExplanation: Real-time operating systems guarantee timely task execution, making them ideal for time-critical applications like embedded systems. 12. What is the first process that runs when an operating system starts? A) Shell process for user inputB) Init process for Unix systemsC) Memory manager for allocationD) Interrupt handler for devices Show Answer Correct Answer: B) Init process for Unix systemsExplanation: The init process is the first process executed after the kernel loads, initializing the system and starting essential services. 13. In memory management, what is swapping? A) Moving processes to disk temporarilyB) Reorganizing memory for efficiencyC) Allocating memory for executionD) Loading drivers into kernel space Show Answer Correct Answer: A) Moving processes to disk temporarilyExplanation: Swapping involves transferring inactive processes to secondary storage to free up memory for active processes. 14. What does the term “thrashing” refer to in operating systems? A) Excessive swapping between memory and diskB) High CPU utilization without outputC) Failure to allocate resources properlyD) Continuous loop in a process Show Answer Correct Answer: A) Excessive swapping between memory and diskExplanation: Thrashing occurs when the system spends most of its time swapping processes in and out of memory instead of executing them. 15. Which of the following is not a valid page replacement algorithm? A) Least recently used (LRU)B) First in first out (FIFO)C) Optimal page replacementD) Random memory allocator Show Answer Correct Answer: D) Random memory allocatorExplanation: Random memory allocation is not a recognized page replacement algorithm. Algorithms like LRU and FIFO are commonly used. 16. What is the primary function of virtual memory? A) Manage CPU scheduling for tasksB) Extend physical memory using diskC) Optimize I/O operations for speedD) Encrypt sensitive data in RAM Show Answer Correct Answer: B) Extend physical memory using diskExplanation: Virtual memory uses disk space as additional RAM, allowing systems to run processes larger than physical memory. 17. What is the mechanism that allows the CPU to interrupt the execution of a process? A) Paging for memoryB) Semaphore schedulingC) Process fork methodsD) Hardware interrupts Show Answer Correct Answer: D) Hardware interruptsExplanation: Hardware interrupts signal the CPU to stop the current process and handle an urgent event, like I/O completion. 18. In which state does a process reside when it is ready for execution but waiting for CPU? A) Ready state for executionB) Waiting state for I/OC) Running state for CPU useD) Blocked state for resources Show Answer Correct Answer: A) Ready state for executionExplanation: A process in the ready state is prepared to execute but must wait until the CPU becomes available. 19. What does the “round-robin” scheduling algorithm do? A) Prioritizes based on execution timeB) Executes the shortest processes firstC) Allocates fixed