50 multiple-choice questions with answers and detailed explanations. Untimed — choose an answer to check it instantly.
0/50 answered0 correct
Question 1 of 50
What is a branch in programming?
Correct answer: A) A sequence of statements executed under a certain condition
Explanation: A branch is a sequence of statements in a program that only executes when a specific condition is met, typically within an "if" or "else" block.
Question 2 of 50
What is a decision in a flowchart?
Correct answer: C) A choice between two branches based on a condition
Explanation: In a flowchart, a decision creates two branches, where one branch executes if the condition is true and the other if it is false.
Question 3 of 50
What is an if-else branch?
Correct answer: C) A decision structure where one branch executes if the condition is true and the other if false
Explanation: An if-else branch allows a program to choose between two paths depending on whether the condition evaluates to true or false.
Question 4 of 50
What is the symbol for the equality operator?
Correct answer: B) ==
Explanation: The equality operator (==) checks if two values are the same.
Question 5 of 50
What is a relational operator?
Correct answer: B) A symbol that relates two values, such as being greater than or less than
Explanation: Relational operators compare two values to determine their relationship, such as greater than, less than, or equal to.
Question 6 of 50
What does the logical AND operator (&&) do?
Correct answer: A) It returns true when both operands are true
Explanation: The logical AND operator (&&) evaluates to true only if both operands are true.
Question 7 of 50
What does the logical OR operator (||) do?
Correct answer: B) Returns true if at least one operand is true
Explanation: The logical OR operator (||) returns true if either one or both operands are true.
Question 8 of 50
What does the logical NOT operator (!) do?
Correct answer: A) It switches a true value to false, and vice versa
Explanation: The logical NOT operator (!) inverts the boolean value, turning true into false and false into true.
Question 9 of 50
What is a decision sequence in programming?
Correct answer: B) A series of actions performed in a set order
Explanation: A decision sequence is a series of conditional actions that follow one another in a predefined order.
Question 10 of 50
What are logical operators used for?
Correct answer: B) To compare boolean values and evaluate to true or false
Explanation: Logical operators (like AND, OR, and NOT) are used to evaluate boolean expressions and return true or false.
Question 11 of 50
What happens in a ‘while’ loop?
Correct answer: A) The loop executes until the condition is false
Explanation: A while loop repeatedly executes the loop body as long as the condition remains true.
Question 12 of 50
What is a sentinel value in a loop?
Correct answer: B) A special value that indicates the end of a list
Explanation: A sentinel value is used in loops to mark the end of input or a sequence, signaling the loop to stop.
Question 13 of 50
What is a ‘for’ loop used for?
Correct answer: A) To iterate a fixed number of times
Explanation: A 'for' loop is used when the number of iterations is known beforehand, making it ideal for iterating over arrays or counting.
Question 14 of 50
What is a nested loop?
Correct answer: A) A loop inside another loop
Explanation: Nested loops are loops placed inside the body of another loop, where the inner loop executes completely during each iteration of the outer loop.
Question 15 of 50
What is a do-while loop?
Correct answer: B) A loop that guarantees at least one execution of its body
Explanation: A do-while loop executes its body at least once, then checks the condition to determine if further iterations are needed.
Question 16 of 50
What is a switch statement?
Correct answer: A) A way to create multiple if-else branches
Explanation: A switch statement evaluates an expression and executes code based on different possible values of that expression, similar to multiple if-else branches.
Question 17 of 50
What is an if-elseif branch used for?
Correct answer: C) To detect ranges, with only one branch executing
Explanation: If-elseif branches allow a program to test multiple conditions, but only the first true condition's branch is executed.
Question 18 of 50
What is an equality operator?
Correct answer: A) A symbol that checks if two values are equal or not equal
Explanation: Equality operators (== and !=) compare two values to check if they are the same or different.
Question 19 of 50
What is an implicit conversion in programming?
Correct answer: B) An automatic conversion of one data type to another
Explanation: Implicit conversion occurs automatically when one data type is converted to another, such as from integer to float, without explicit instruction from the programmer.
Question 20 of 50
What is a function call?
Correct answer: B) The execution of a function’s statements by invoking its name
Explanation: A function call is when a program invokes a function to execute its defined statements.
Question 21 of 50
What is a parameter in a function?
Correct answer: C) An input specified in the function definition
Explanation: A parameter is an input passed into a function, which the function uses during execution.
Question 22 of 50
What is a function return value?
Correct answer: B) A value that is sent back to the caller after the function executes
Explanation: A return value is the result of a function that is passed back to the part of the program that called the function.
Question 23 of 50
What is modular development?
Correct answer: B) Dividing a program into smaller, manageable modules
Explanation: Modular development involves splitting a program into separate parts, each focusing on a specific task, to simplify development and testing.
Question 24 of 50
What is incremental development?
Correct answer: B) Writing and testing small amounts of code in increments
Explanation: Incremental development refers to gradually building and testing small parts of a program to ensure functionality before proceeding further.
Question 25 of 50
What is a function stub?
Correct answer: B) A function definition that has not yet been fully implemented
Explanation: A function stub is a placeholder function that allows a program to run without errors until the function is fully defined.
Question 26 of 50
What is a literal in programming?
Correct answer: A) A specific value written directly into the code
Explanation: A literal is a fixed value, like 10 or "Hello", used in the program code that doesn't change during execution.
Question 27 of 50
What is an operator in programming?
Correct answer: B) A symbol that performs a built-in calculation
Explanation: Operators like +, -, *, and / are symbols used to perform mathematical or logical operations on data.
Question 28 of 50
What is the modulo operator (%) used for?
Correct answer: B) To find the remainder of a division operation
Explanation: The modulo operator (%) returns the remainder of the division of two integers
Question 29 of 50
What is a class diagram in UML?
Correct answer: B) A structural diagram that shows classes, their attributes, and methods
Explanation: A class diagram in UML models the structure of a system by showing its classes, attributes, methods, and relationships.
Question 30 of 50
What is a use case diagram in UML?
Correct answer: B) A diagram that shows how users interact with the program
Explanation: A use case diagram visually models the different ways users interact with a software system, representing user actions and system responses.
Question 31 of 50
What is the difference between a while loop and a for loop?
Correct answer: B) A while loop executes while a condition is true, and a for loop runs for a specific number of iterations
Explanation: A while loop continues executing as long as the condition remains true, while a for loop executes a set number of times.
Question 32 of 50
What is a function argument?
Correct answer: B) A value passed to a function when it is called
Explanation: A function argument is a value provided to a function when it is called, which the function uses during execution.
Question 33 of 50
What does a ‘return’ statement do in a function?
Correct answer: C) Sends a value back to the calling part of the program
Explanation: The return statement exits the function and sends a value back to the part of the program that invoked the function.
Question 34 of 50
What is a floating-point number?
Correct answer: B) A number that can hold decimals
Explanation: A floating-point number can hold decimal values, such as 3.14 or -0.001.
Question 35 of 50
What is the purpose of the increment operator (++) in loops?
Correct answer: B) To increase the value of a variable by one
Explanation: The increment operator (++) adds 1 to the value of a variable, commonly used in loops to control iteration.
Question 36 of 50
What is an array in programming?
Correct answer: B) A data structure that holds a list of values of the same type
Explanation: An array is an ordered collection of elements, all of which are of the same data type.
Question 37 of 50
What is an index in an array?
Correct answer: C) The location number of an element in the array
Explanation: An index refers to the position of an element in an array, typically starting from 0.
Question 38 of 50
What is a constant in programming?
Correct answer: B) A named value that cannot be changed once assigned
Explanation: A constant is a value that remains the same throughout the execution of a program, typically used for fixed values like Pi or conversion factors.
Question 39 of 50
What is a type cast in programming?
Correct answer: A) A way to convert a value from one data type to another
Explanation: Type casting is the process of converting a value from one data type to another, such as from integer to float or vice versa.
Question 40 of 50
What is a flowchart used for?
Correct answer: A) To graphically represent the flow of control in a program
Explanation: A flowchart visually represents the sequence of steps in a program, helping to understand the control flow.
Question 41 of 50
What is the purpose of the ‘break’ statement in loops?
Correct answer: B) To terminate the loop immediately
Explanation: The break statement exits the loop immediately, regardless of whether the loop condition is true or false.
Question 42 of 50
What is Moore’s Law?
Correct answer: A) A principle that describes an increase in computational power
Explanation: Moore's Law states that the number of transistors on a microchip doubles approximately every two years, leading to increased computational power.
Question 43 of 50
What is a bit?
Correct answer: B) The smallest unit of data in a computer, represented as 0 or 1
Explanation: A bit is the fundamental unit of information in computing, storing either a 0 or 1.
Question 44 of 50
What is a byte?
Correct answer: B) A collection of 8 bits
Explanation: A byte consists of 8 bits and is commonly used as a basic unit of storage in computing
Question 45 of 50
What is an abstract data type (ADT)?
Correct answer: B) A data type whose creation and update are constrained to well-defined operations
Explanation: An abstract data type (ADT) defines the behavior of a data type but not its implementation, such as lists, stacks, or queues.
Question 46 of 50
What is Unicode used for?
Correct answer: B) Representing over 100,000 symbols, including non-English characters
Explanation: Unicode is a character encoding standard that supports a wide range of characters and symbols from various languages.
Question 47 of 50
What is computational complexity?
Correct answer: A) The time and space resources required to solve a computational problem
Explanation: Computational complexity measures how the resources (time and space) needed to solve a problem scale with the size of the input.
Question 48 of 50
What is a heuristic algorithm?
Correct answer: B) An algorithm that finds a near-optimal solution quickly
Explanation: A heuristic algorithm trades off optimal accuracy for speed, providing a good enough solution in a shorter time.
Question 49 of 50
What is binary search used for?
Correct answer: B) Searching sorted data by repeatedly dividing the search space in half
Explanation: Binary search is an efficient search algorithm that works on sorted data by repeatedly splitting the search space in half until the target is found.
Question 50 of 50
What is a software requirements specification (SRS)?
Correct answer: B) A document describing all requirements for the software product
Explanation: An SRS is a detailed document that outlines all the functional and non-functional requirements of a software system.
Set 2 complete
You scored 0%
0 correct out of 0 answered (50 questions in this set).