0% found this document useful (0 votes)
12 views2 pages

Programming Logic Exercises by Difficulty

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Programming Logic Exercises by Difficulty

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

🔹 Level 1: Easy (Remembering & Understanding)

These focus on basic logic building and understanding flowcharts.

1. Convert Celsius to Fahrenheit (Remember)

2. Find the largest of two numbers (Understand)

3. Check if a number is Even or Odd (Understand)

4. Print the first N natural numbers (Remember)

5. Calculate Simple Interest (SI = P×R×T/100) (Understand)

6. Check if a year is Leap Year or not (Understand)

7. Find the sum of digits of a number (Apply basic loop logic)

8. Reverse a given number (Apply loop + modulus operation)

9. Generate multiplication table of a number (Apply)

10. Find the factorial of a number (using loop) (Apply)

🔹 Level 2: Medium (Applying & Analyzing)

These require decision-making and nested loops.

1. Find the largest of three numbers (Analyze conditions)

2. Check if a number is Prime or Not (Apply + Analyze)

3. Find GCD and LCM of two numbers (Apply)

4. Generate Fibonacci Series up to N terms (Apply)

5. Check if a number is Palindrome (Analyze flow)

6. Check if a number is Armstrong Number (Apply digit-based logic)

7. Calculate the sum of first N odd/even numbers (Analyze patterns)

8. Print Pascal’s Triangle up to N rows (Apply + Analyze)

9. Count the number of vowels and consonants in a string (Apply)

10. Find the roots of a quadratic equation (Analyze + Apply formula)

🔹 Level 3: Hard (Evaluating & Creating)

These require critical thinking, optimization, and multi-step logic.

1. Sort an array using Bubble Sort / Selection Sort (Flowchart + Algorithm) (Analyze +
Evaluate)

2. Search an element using Linear Search & Binary Search (Analyze efficiency)
3. Check if a number is Strong Number (sum of factorials of digits = number) (Analyze)

4. Check if a number can be expressed as sum of two prime numbers (Evaluate)

5. Generate Floyd’s Triangle / Diamond Pattern using loops (Create flow)

6. Design an algorithm to convert Decimal → Binary (Evaluate + Create)

7. Implement Tower of Hanoi problem (recursive logic flowchart) (Analyze recursion)

8. Algorithm to check Magic Square (matrix sums equal) (Evaluate + Create)

9. Algorithm to find the frequency of each character in a string (Analyze data structures)

10. Design a flowchart for ATM transaction (withdrawal, balance inquiry, deposit) (Create real-
world problem-solving)

📊 Bloom’s Taxonomy Mapping

 Remembering → Write flowchart for Celsius to Fahrenheit, Print numbers.

 Understanding → Leap year check, Even/Odd, Simple Interest.

 Applying → Factorial, Fibonacci, Prime check.

 Analyzing → Palindrome, Quadratic equation, GCD/LCM.

 Evaluating → Search algorithms, Strong Number, Sum of two primes.

 Creating → ATM system, Tower of Hanoi, Decimal to Binary converter.

Common questions

Powered by AI

Generating a Fibonacci series involves initializing the first two terms and recursively or iteratively adding the last two to continue the sequence. Effective application requires management of large integer calculations, especially for high N, and understanding memory or compute constraints in recursive implementations .

The Euclidean algorithm calculates the GCD by utilizing the property that GCD(a, b) = GCD(b, a mod b), recursively until one number becomes zero. The LCM is calculated using the relationship LCM(a, b) = (a*b) / GCD(a, b). Analyzing the repetitive division process and understanding modular arithmetic underpin this task .

The Tower of Hanoi is solved recursively by moving n-1 disks to a spare rod, moving the nth disk to its target, and moving the n-1 disks from the spare to the target rod. This multi-step recursion requires analyzing base cases and recursive progression, sharpening recursive logic skills and understanding complexity management .

Solving quadratic equations involves analyzing the equation ax^2 + bx + c = 0, using methods such as factoring, completing the square, or applying the quadratic formula x = (-b ± √(b^2-4ac)) / 2a. Recognizing which method to apply and interpreting discriminant conditions are critical analytical tasks .

Bubble sort and selection sort can be evaluated by analyzing their time complexity, both O(n^2) in the worst case. Bubble sort repeatedly swaps adjacent elements, improving efficiency with each pass, while selection sort searches for the minimum value to place in order, restricting swaps. Evaluating these reveals insights on flow optimization and algorithmic efficiency .

Designing a flowchart for converting decimal to binary requires leveraging division by 2 while recording remainders. The process involves repeatedly dividing the number by 2, tracking the remainder each time, and constructing the binary number from these remainders in reverse order after reaching zero. This task involves creating a novel flow to solve a problem, placing it in the 'Creating' category of Bloom's Taxonomy .

Designing an ATM transaction algorithm entails modeling real-world tasks like withdrawals, deposits, and balance checks. It requires synthesis of user interface design, security measures, and transaction logic. The creative challenge lies in ensuring efficient, secure, and user-friendly operations, necessitating complex multilateral thinking and system design skills .

To determine if a number is prime, first analyze if it is less than 2, which disqualifies it as a prime. For numbers 2 and above, conduct trial division: use a loop to check divisibility starting from 2 up to the square root of the number. If none of these values divide the number evenly, the number is a prime .

Checking for a palindrome involves analyzing the symmetry of a number or string around its center. Convert the input into a string or number array, then verify that characters or digits equidistant from the ends are equal. This analysis tests both logical reasoning and understanding of data structures in computational logic .

Generating Pascal's Triangle involves applying combinatorial logic: starting each new row with 1, following by generating the intermediate values by summing the two values directly above. This requires analyzing patterns, as each row and value is interdependent, and applying the combination formula for cross-verifying values when necessary .

You might also like