Unit 2: Basic math operations (addition, subtraction, multiplication, division and exponentiation) - Subjective Questions

CSE329 — Prelude To Competitive Coding • Practice Questions with Detailed Answers

20 questions

1

Define Fast Modulo Multiplication and explain why it is needed in competitive programming. Illustrate with an example.

2

Explain the technique of Exponentiation by Squaring (Exponential squaring). Derive its time complexity.

3

What is the N-th non-square number? Derive a direct formula to find it without generating all numbers.

4

Define Modular Exponentiation and write an algorithm to compute efficiently.

5

Explain the concept of Modular Multiplicative Inverse. Under what condition does it exist?

6

Using Fermat's Little Theorem, derive the formula for the modular multiplicative inverse and demonstrate with an example.

7

Describe how to compute the sum of the middle row and middle column elements in a square matrix. Write the conditions and formula.

8

Explain the algorithm to check whether all rows of a matrix are circular rotations of each other.

9

State and explain the Inclusion-Exclusion Principle for two and three sets with a suitable example.

10

State the Pigeonhole Principle and its generalized form. Give two real applications.

11

Compare naive exponentiation with exponentiation by squaring in terms of time complexity, and explain when each is preferable.

12

Explain how the Extended Euclidean Algorithm is used to compute the modular multiplicative inverse. Trace it for finding the inverse of modulo .

13

Distinguish between the Inclusion-Exclusion Principle and the Pigeonhole Principle with respect to their purpose and typical use cases.

14

Write pseudocode for fast modulo multiplication (multiplying two large numbers under a modulus) and explain each step.

15

Using the Inclusion-Exclusion Principle, find how many integers from to are divisible by , , or . Show all steps.

16

Explain why applying modulo at intermediate steps gives correct results in modular arithmetic. State the key distributive properties for addition and multiplication.

17

Prove using the Pigeonhole Principle that in any group of integers chosen from , at least one pair is coprime.

18

Describe a step-by-step approach to compute where is prime. Illustrate with .

19

Explain the significance of modular exponentiation in cryptography, particularly in the RSA algorithm.

20

Given a matrix, explain the special case handling and edge cases when computing the sum of the middle row and middle column, and discuss even-order matrices.