Problem Understanding & Analysis Question Bank
Showing 64 questions of 64 with verified answers
(Conceptual) What happens when a break statement is encountered inside a loop?
(Code Output) Look at this code containing a continue statement: for i from 1 to 4: if (i == 2): continue print(i) What is printed?
(Debugging) Why will the following code result in an infinite loop? count = 10 while (count > 0): print(count) count = count + 1
(Scenario-Based) An ATM machine asks a user for their PIN. If they get it wrong, it asks again, up to a maximum of 3 attempts. Which structure best models this?
(Calculation) Trace the following algorithm that swaps two variables without a temporary variable: A = 5 B = 10 A = A + B B = A - B A = A - B What are the final values of A and B?
(Conceptual) In programming, what is a "Base Case"?
(Code Output) Trace this recursive algorithm: Function blastoff(n): if (n == 0): print("Ignition") else: print(n) blastoff(n - 1) blastoff(2)
(Debugging) Look at this SWITCH statement: color = "Red" switch (color): case "Red": print("Stop") case "Green": print("Go") In languages like C, Java, or JS, what is printed?
(Calculation) How many times will the following loop execute? for (i = 0; i < 10; i = i + 2)
(Scenario-Based) A school grading system assigns 'A' for ≥ 90, 'B' for ≥ 80, and 'C' for ≥ 70. What is the most efficient control flow structure to determine a single student's grade?
(Code Output) What does this algorithm do to an array `arr` of size `N`? for i from 0 to N-1: if (arr[i] < 0): arr[i] = 0
(Conceptual) Which of the following best describes "Control Flow"?
(Debugging) What is the danger of writing an IF statement like this in C/C++/Java? if (userRole = "Admin") { ... }
(Code Output) flag = False while (NOT flag): print("Running") flag = True print("Done") How many times will "Running" be printed?
(Scenario-Based) You need to create a menu that displays options to the user, waits for their input, and repeats UNTIL the user chooses "Exit". Which loop is the most natural fit?
(Conceptual) What is the main purpose of "Pseudocode" in algorithmic design?
(Code Output) x = 10 if (x > 5): if (x == 10): print("A") print("B") else: print("C") What will this output?
(Conceptual) What is the primary purpose of "Data Abstraction" in software engineering?
(Code Output / Logic) Consider the following pseudocode utilizing floating-point numbers: float x = 0.1 float y = 0.2 float z = 0.3 if ((x + y) == z): print("Equal") else: print("Not Equal") In most modern programming languages (Java, Python, C++), what is printed?
(Scenario-Based) You are building a global messaging app. Users will send text in English, Arabic, Japanese, and use emojis. Which data representation standard MUST you choose for text encoding?
(Calculation) How is the decimal number -5 represented in an 8-bit binary system using Two's Complement?
(Debugging / Error Analysis) A game uses a standard 32-bit signed integer to track a player's money. A hacker discovers a glitch that gives them 3 billion coins. Suddenly, their coin balance reads as a massive negative number (e.g., -1,294,967,296). What phenomenon caused this?
(Comparison) What is the difference between an Abstract Data Type (ADT) and a Data Structure?
(Scenario-Based) An IoT temperature sensor sends data using a single byte (8 bits) without a sign bit (unsigned). What is the maximum temperature value it can represent?
(Code Output / Bitwise) In many languages, performing a bitwise Left Shift (<<) by 1 position on an integer has the mathematical effect of:
(Calculation) In web design, colors are often represented in Hexadecimal format (e.g., #FF0000). What does the FF represent in decimal, and what color does this code represent?
(Scenario-Based) A developer is creating an email client. Email protocols (like SMTP) were originally designed to only handle 7-bit ASCII text. However, users need to attach images and PDFs (binary data). Which abstraction technique solves this representation problem?
(Conceptual) What does the term "Endianness" (Big-Endian vs Little-Endian) refer to in computer science?
(Debugging / Casting) Trace the following pseudocode: int a = 5 int b = 2 float result = a / b print(result) What is the likely output in languages like Java or C++?
(Scenario-Based) You need to represent the read, write, and execute permissions of a file. You use a single integer where the bits represent permissions (e.g., Binary 111 means Read, Write, Execute). This technique is known as:
(Conceptual) In Object-Oriented Programming, grouping related primitive data types and behaviors into a single Class (like grouping string name, int age into a Student class) is an example of:
(Calculation) Convert the binary number 1011 to decimal.
(Code Output) Look at this type conversion scenario: char letter = 'A' int value = (int) letter print(value) Assuming ASCII encoding, what is printed?
(Debugging) A developer wants to store the number of human beings on Earth (approx 8.1 billion) in a database. They choose a standard 32-bit unsigned integer data type. What will happen?
(Conceptual) Lossless compression (like a ZIP file) works by:
(Conceptual) In the context of computational thinking, what is the primary relationship between Pattern Recognition and Generalization?
(Scenario-Based) A developer notices that the code for "Validate User Phone Number," "Validate User Zip Code," and "Validate User ID" all involve checking if a string consists only of digits of a specific length. The developer decides to write one function isValidNumeric(input, length). This is an example of:
(Code Output / Regex) A system uses a Regular Expression (Regex) to recognize a specific pattern in user-submitted filenames. The pattern is: ^[a-zA-Z]+[0-9]{2}$. Which of the following strings will be recognized (matched) by this pattern?
(Comparison) A programmer observes that every time they use a "Bubble Sort" on a nearly sorted array, it runs very quickly. They conclude: "Bubble Sort is efficient for nearly sorted data." This type of logical reasoning is:
(Scenario-Based) An antivirus software recognizes a new virus because its binary code contains a sequence of instructions very similar to an older, known piece of malware. This detection method is primarily based on:
(Debugging) A developer creates a "Universal Database Connector" that handles SQL, NoSQL, and CSV files all in one massive function. Later, they find that changing one SQL parameter breaks the CSV logic. This is a classic example of:
(Conceptual) In Machine Learning, what is the purpose of "Feature Extraction"?
(Code Output / Logic) Trace the pattern in this sequence of numbers: 1, 1, 2, 3, 5, 8, 13.... What is the generalized rule to find the next number N?
(Scenario-Based) You are designing a system that must handle IntList, StringList, and DoubleList. Instead of writing three separate classes, you use C++ Templates or Java Generics: List. This technical implementation is an example of:
(Conceptual) Which of the following is an example of "Pattern Recognition" applied to User Experience (UX) design?
(Code Output) What pattern is being checked in the following pseudocode? function check(str): for i from 0 to length(str)/2: if (str[i] != str[length(str) - 1 - i]): return False return True
(Comparison) What is the primary difference between a "Standard Pattern" and an "Anti-Pattern" in software engineering?
(Debugging / Regex) A developer writes a regex to capture text inside parentheses: \ (.*\). However, when given the string (
(Scenario-Based) An e-commerce engine recognizes that a user who buys "Coffee Beans" almost always buys "Coffee Filters" next. This pattern is then used to generate a recommendation. This is an application of:
(Conceptual) When we say a problem-solving strategy is "Deductive," we mean:
(Code Output / Logic) You are given three functions: `calculateSquare()`, `calculateCircle()`, and `calculateTriangle()`. You decide to generalize them into `calculateArea(Shape s)`. This uses which programming concept?
(Scenario-Based) You are analyzing 1,000 log files to find "Unauthorized Login" attempts. You notice that all such attempts originate from an IP range 192.168.1.x and occur between 2 AM and 4 AM. Creating a firewall rule based on this is:
(Conceptual) Why is "Pattern Recognition" considered a core pillar of Computational Thinking?
(Code-Math) You are implementing a circular queue using an array of size N. If the current index is i, which expression correctly calculates the next index, ensuring it wraps around to 0 when it reaches the end?
(Calculation) Convert the Hexadecimal number 0x2F to its Decimal equivalent.
(Scenario-Based) A database query uses the INTERSECT operator between two sets of User IDs: Set A {1, 2, 3, 4} and Set B {3, 4, 5, 6}. What is the resulting set?
(Conceptual) In a dataset containing the response times of a web server, you notice a few "outliers" (requests that took 60 seconds while most took 0.1 seconds). Which statistical measure will give you the most accurate "typical" user experience?
(Calculation) A system administrator wants to create a 4-digit PIN using only the digits 0-9. If repetitions are allowed, how many unique PIN combinations are possible?
(Code-Math) What is the result of the following integer division and modulo operation in a language like C++ or Java? int x = 7 / 2; int y = 7 % 2;
(Scenario-Based) A network switch has a 1% probability of dropping a packet. If you send two independent packets, what is the probability that BOTH packets will be dropped?
(Calculation) In a Geometric Progression (GP) used for memory allocation (e.g., doubling the array size), the sequence is: 4, 8, 16, 32... What is the 7th term in this sequence?
(Conceptual) Which mathematical concept is the foundation of "Hash Tables," ensuring that data is distributed across a fixed number of buckets?
(Calculation) Convert the binary number 11010 to Decimal.
A server receives 250 requests per second. Each request requires 12 milliseconds of CPU processing. What is the minimum number of CPU cores required to prevent an infinite queue buildup?