Modular exponentiation efficiently computes , the remainder of raised to power when divided by .
Incorrect! Try again.
2What is the time complexity of computing using exponentiation by squaring?
Exponential squaring
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Exponentiation by squaring reduces the exponent by half each step, giving multiplications instead of .
Incorrect! Try again.
3In exponentiation by squaring, when the exponent is even, equals:
Exponential squaring
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
For an even exponent, , allowing the problem to be halved at each step.
Incorrect! Try again.
4Fast modulo multiplication is mainly used to:
Fast modulo multiplication
Easy
A.Divide two numbers exactly
B.Find the square root of a number
C.Sort an array of numbers
D.Multiply two large numbers modulo while avoiding overflow
Correct Answer: Multiply two large numbers modulo while avoiding overflow
Explanation:
Fast modulo multiplication computes for large values without causing integer overflow.
Incorrect! Try again.
5Which technique does fast modulo multiplication resemble in its approach?
Fast modulo multiplication
Easy
A.Bubble sort
B.Binary search
C.Repeated doubling and addition
D.Prime factorization
Correct Answer: Repeated doubling and addition
Explanation:
Fast modulo multiplication uses repeated doubling and addition (similar to exponentiation by squaring) to avoid overflow.
Incorrect! Try again.
6Which of the following is a non-square number?
N-th non-square number
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
A non-square number is not a perfect square. , , are perfect squares, but is not.
Incorrect! Try again.
7What is the 1st non-square number (starting counting from 1)?
N-th non-square number
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
The sequence of non-square numbers is ; is skipped since , so the first non-square is .
Incorrect! Try again.
8The modular multiplicative inverse of modulo is a number such that:
Modular multiplicative inverse
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
By definition, the modular inverse satisfies .
Incorrect! Try again.
9A modular multiplicative inverse of modulo exists if and only if:
Modular multiplicative inverse
Easy
A. is even
B. is prime always
C.
D.
Correct Answer:
Explanation:
The inverse exists only when and are coprime, i.e., .
Incorrect! Try again.
10What is the modular multiplicative inverse of modulo ?
Modular multiplicative inverse
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
Since , the inverse of modulo is .
Incorrect! Try again.
11Which property is used in modular exponentiation to keep intermediate values small?
Modular Exponentiation
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
The modular product property lets us reduce each factor modulo , keeping intermediate results small.
Incorrect! Try again.
12Compute .
Modular Exponentiation
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
, and .
Incorrect! Try again.
13For an matrix where is odd, the middle row index (0-based) is:
Sum of middle row and element in matrix
Easy
A.
B.
C. (integer division)
D.
Correct Answer: (integer division)
Explanation:
For an odd-sized square matrix, the middle row is at index using integer division.
Incorrect! Try again.
14In a matrix, the middle element is located at position:
Sum of middle row and element in matrix
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
For a matrix (0-based), the center element is at row , column , i.e., .
Incorrect! Try again.
15A row is a circular rotation of another if it can be obtained by:
Checking if all rows of a matrix are circular rotations of each other
Easy
A.Shifting elements cyclically
B.Reversing the elements
C.Removing duplicate elements
D.Sorting the elements
Correct Answer: Shifting elements cyclically
Explanation:
A circular rotation is produced by cyclically shifting the elements of a row left or right.
Incorrect! Try again.
16A common technique to check if one string is a rotation of another is to check if it is a substring of:
Checking if all rows of a matrix are circular rotations of each other
Easy
A.The sorted first string
B.The first string concatenated with itself
C.The reversed first string
D.An empty string
Correct Answer: The first string concatenated with itself
Explanation:
If is a rotation of , then must be a substring of . This idea extends to matrix rows.
Incorrect! Try again.
17For two sets and , equals:
Inclusion - Exclusion Principle
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
The Inclusion-Exclusion Principle for two sets: .
Incorrect! Try again.
18If , , and , then is:
Inclusion - Exclusion Principle
Easy
A.
B.
C.
D.
Correct Answer:
Explanation:
.
Incorrect! Try again.
19The pigeonhole principle states that if items are placed into containers with , then:
Pigeonhole principle
Easy
A.At least one container holds more than one item
B.Every container holds exactly one item
C.No container holds any item
D.All containers are empty
Correct Answer: At least one container holds more than one item
Explanation:
When there are more items than containers, at least one container must contain more than one item.
Incorrect! Try again.
20If 13 people are in a room, by the pigeonhole principle at least two share the same:
Pigeonhole principle
Easy
A.First name
B.Exact birthday
C.Birth month
D.Height
Correct Answer: Birth month
Explanation:
There are only 12 months, so among 13 people at least two must share the same birth month.
Incorrect! Try again.
21Fast modulo multiplication (also called Russian peasant multiplication under a modulus) computes without overflow by repeatedly doubling and adding. What is the primary advantage of this technique over directly computing first?
Fast modulo multiplication
Medium
A.It always runs in time
B.It removes the need for a modulus entirely
C.It produces a different mathematical result than direct multiplication
D.It avoids overflow when exceeds the data type's range
Correct Answer: It avoids overflow when exceeds the data type's range
Explanation:
By adding to itself under the modulus using doubling, each intermediate value stays below , preventing the product from ever being formed in full and thus avoiding overflow.
Incorrect! Try again.
22Using the doubling method to compute , the loop processes the bits of . What is the final result?
Fast modulo multiplication
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
, and . The doubling method accumulates scaled by each set bit of , all reduced mod , yielding the same result.
Incorrect! Try again.
23Exponentiation by squaring computes in multiplications. Which recurrence correctly describes it for even ?
Exponential squaring
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
For even , , so only one recursive computation plus one squaring is needed, halving the exponent each step and giving logarithmic time.
Incorrect! Try again.
24How many multiplications does exponentiation by squaring perform (approximately) to compute ?
Exponential squaring
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Since , the value is obtained by squaring 4 times: , requiring only 4 multiplications instead of 15.
Incorrect! Try again.
25The -th non-square (non-perfect-square) number is given by the formula . What is the th non-square number?
N-th non-square number
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The non-square numbers are (skipping ). The 5th is , matching .
Incorrect! Try again.
26Using the formula , what is the th non-square number?
N-th non-square number
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Compute . The non-squares are , so the 10th is .
Incorrect! Try again.
27What is using modular exponentiation?
Modular Exponentiation
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Since (Fermat), .
Incorrect! Try again.
28In modular exponentiation computing , why is the result reduced modulo after every multiplication rather than only at the end?
Modular Exponentiation
Medium
A.To change the final answer
B.To make the exponent smaller each step
C.To keep intermediate values small and prevent overflow
D.Because the modulus must be prime
Correct Answer: To keep intermediate values small and prevent overflow
Explanation:
Reducing after each multiplication keeps intermediate values bounded below , preventing overflow while preserving the correct final result due to modular arithmetic rules.
Incorrect! Try again.
29What is the time complexity of computing using fast modular exponentiation?
Modular Exponentiation
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Fast modular exponentiation halves the exponent each step via squaring, performing about iterations, each with constant-time modular multiplication.
Incorrect! Try again.
30The modular multiplicative inverse of modulo exists if and only if which condition holds?
Modular multiplicative inverse
Medium
A. is prime
B.
C. is even
D.
Correct Answer:
Explanation:
An inverse satisfying exists exactly when and are coprime, i.e., .
Incorrect! Try again.
31What is the modular multiplicative inverse of modulo ?
Modular multiplicative inverse
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
We need . Testing : , so the inverse is .
Incorrect! Try again.
32When is prime, Fermat's Little Theorem gives the modular inverse of as which expression?
Modular multiplicative inverse
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Fermat's Little Theorem states , so , making the inverse when is prime and .
Incorrect! Try again.
33For an odd-sized matrix, the middle element lies at which index (0-based)?
Sum of middle row and element in matrix
Medium
A.
B. using integer division
C.
D.
Correct Answer: using integer division
Explanation:
For an odd , integer division gives the central row and column index. For example, in a matrix, the middle element is at .
Incorrect! Try again.
34Given the matrix , what is the sum of the middle row?
Sum of middle row and element in matrix
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The middle row (index 1) is , and its sum is .
Incorrect! Try again.
35A common technique to check whether every row of a matrix is a circular rotation of the first row uses string concatenation. If the first row (as a string) is , a row is a circular rotation of it when:
Checking if all rows of a matrix are circular rotations of each other
Medium
A. is a substring of
B. equals the reverse of
C. is a substring of
D. has the same length as only
Correct Answer: is a substring of
Explanation:
All circular rotations of appear as contiguous substrings of . So is a rotation of if and only if is a substring of the doubled string (and has equal length).
Incorrect! Try again.
36Consider a matrix with rows , , and . Are all rows circular rotations of the first row?
Checking if all rows of a matrix are circular rotations of each other
Medium
A.No, none are rotations
B.Yes, each is a rotation of
C.No, only the second row is a rotation
D.Yes, but only if reversed
Correct Answer: Yes, each is a rotation of
Explanation:
Rotations of are , , and . All three rows appear as contiguous substrings of , so every row is a circular rotation.
Incorrect! Try again.
37How many integers from to are divisible by or ?
Inclusion - Exclusion Principle
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
By inclusion-exclusion: .
Incorrect! Try again.
38For three finite sets, the inclusion-exclusion principle gives as:
Inclusion - Exclusion Principle
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Adding the individual sizes over-counts pairwise intersections, so they are subtracted, but this removes the triple intersection too many times, so it is added back once.
Incorrect! Try again.
39If people are in a room, the pigeonhole principle guarantees that at least how many share the same birth month?
Pigeonhole principle
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
With 12 months (pigeonholes) and 13 people (pigeons), at least one month must contain people, so at least two share a birth month.
Incorrect! Try again.
40What is the minimum number of items needed so that, when placed into boxes, at least one box contains at least items?
Pigeonhole principle
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
By the generalized pigeonhole principle, to force a box with at least items we need more than items, so the minimum is .
Incorrect! Try again.
41You need to compute where can each be up to . Direct multiplication overflows 64-bit integers. Which technique correctly computes this without overflow using only integer arithmetic?
Fast modulo multiplication
Hard
A.Computing and first, then multiplying directly
B.Right-shifting the product by 32 bits before taking modulo
C.Binary (Russian peasant) multiplication adding to a running result modulo while doubling
D.Using
Correct Answer: Binary (Russian peasant) multiplication adding to a running result modulo while doubling
Explanation:
Binary multiplication decomposes into bits; for each set bit it adds the current doubled value of (mod ) to the result (mod ). Since each intermediate value stays below , it never overflows a 64-bit range when handled carefully, giving the correct product mod .
Incorrect! Try again.
42How many modular multiplications (including squarings) does exponentiation by squaring perform in the worst case to compute , where has bits?
Exponential squaring
Hard
A.Approximately multiplications
B.Exactly multiplications
C.Approximately multiplications
D.Approximately multiplications
Correct Answer: Approximately multiplications
Explanation:
For each of the bits there is one squaring; additionally each set bit triggers one multiply. In the worst case (all bits set) this yields about squarings plus multiplications, i.e. roughly operations.
Incorrect! Try again.
43The -th non-square (non-perfect-square) positive integer is given by the closed form . What is the -th non-square number?
N-th non-square number
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Compute . Thus the answer is . Listing non-squares: confirms the -th is .
Incorrect! Try again.
44Using Fermat's little theorem, what is ?
Modular Exponentiation
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
By Fermat's little theorem . Since , we get .
Incorrect! Try again.
45The modular inverse of modulo exists if and only if which condition holds?
Modular multiplicative inverse
Hard
A.
B. is prime
C.
D. is even and is odd
Correct Answer:
Explanation:
An inverse with exists exactly when and are coprime. If , then is always a multiple of and can never equal . Primality of is sufficient but not necessary.
Incorrect! Try again.
46Compute the modular multiplicative inverse of modulo .
Modular multiplicative inverse
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
We need . Testing : , so . Hence the inverse is .
Incorrect! Try again.
47To compute inverses of modulo a prime in time, the recurrence is used. This works because implies which congruence?
Modular multiplicative inverse
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Since , the division identity gives . Multiplying by and rearranging yields the linear recurrence for computing all inverses in linear time.
Incorrect! Try again.
48To compute for prime using modular exponentiation, which exponent should be used?
Modular Exponentiation
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
By Fermat's little theorem , so . Therefore is the modular inverse of , computable quickly via exponentiation by squaring.
Incorrect! Try again.
49How many integers in are divisible by at least one of , , or ?
Inclusion - Exclusion Principle
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
By inclusion-exclusion: .
Incorrect! Try again.
50How many integers in are divisible by none of , , or ?
Inclusion - Exclusion Principle
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Count divisible by at least one: . Therefore divisible by none is . These correspond to numbers coprime-ish to the set .
Incorrect! Try again.
51From any set of integers chosen from , the pigeonhole principle guarantees that at least one pair satisfies which relationship?
Pigeonhole principle
Hard
A.Their sum equals
B.Their difference is exactly
C.Both are prime numbers
D.One number divides the other
Correct Answer: One number divides the other
Explanation:
Write each number as with odd. There are only odd values in , so among numbers two share the same odd part . The one with the smaller power of then divides the other.
Incorrect! Try again.
52In any sequence of distinct real numbers, the Erdős–Szekeres theorem (a pigeonhole application) guarantees a monotonic subsequence of length at least:
Pigeonhole principle
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Assign each element a pair (longest increasing run ending there, longest decreasing run ending there). If no monotonic subsequence reaches length , only distinct pairs exist, contradicting having elements. Hence a monotonic subsequence of length must exist.
Incorrect! Try again.
53For an matrix with odd , the sum of the middle row and middle column shares which element that must be counted only once to avoid double counting?
Sum of middle row and element in matrix
Hard
A.The top-left corner element
B.No element is shared between them
C.The central element at index using integer division
D.The last element
Correct Answer: The central element at index using integer division
Explanation:
The middle row is row and the middle column is column . They intersect precisely at the center , so if summing both, this element is added twice and must be subtracted once.
Incorrect! Try again.
54Given a matrix where element (0-indexed), what is the sum of the middle row?
Sum of middle row and element in matrix
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The middle row is row . Its elements are . Their sum is .
Incorrect! Try again.
55To check whether all rows of an matrix are circular rotations of the first row, the standard efficient approach concatenates the first row with itself and then does what?
Checking if all rows of a matrix are circular rotations of each other
Hard
A.Searches each subsequent row as a substring using KMP in per row
B.Computes the sum of each row and compares totals
C.Sorts each row and compares element sets
D.Reverses each row and checks for equality
Correct Answer: Searches each subsequent row as a substring using KMP in per row
Explanation:
A row is a circular rotation of the first row iff it appears as a contiguous substring of the first row concatenated with itself. Using KMP, each check runs in , giving overall . Sorting or summing would falsely accept mere permutations.
Incorrect! Try again.
56Consider rows and . Why is a valid circular rotation of ?
Checking if all rows of a matrix are circular rotations of each other
Hard
A. appears as a substring of
B. and have equal sums so rotation is guaranteed
C. is the reverse of
D. is a sorted permutation of
Correct Answer: appears as a substring of
Explanation:
Doubling yields , which contains the contiguous block starting at index . Equal sums or being a permutation are necessary but not sufficient for a circular rotation.
Incorrect! Try again.
57When computing with a very large exponent given as a decimal string, and prime with , the exponent can first be reduced modulo which value?
Modular Exponentiation
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
By Fermat's little theorem , so exponents can be taken modulo : . This lets a huge string exponent be reduced digit by digit before exponentiation by squaring.
Incorrect! Try again.
58Exponentiation by squaring can be generalized to compute the -th power of an matrix. What is its time complexity for computing ?
Exponential squaring
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Each matrix multiplication costs with the schoolbook algorithm, and exponentiation by squaring performs such multiplications. Hence the total is , widely used for linear recurrences like Fibonacci.
Incorrect! Try again.
59Given any integers, the pigeonhole principle guarantees a non-empty subset whose sum is divisible by . Which quantities serve as the pigeons and holes in the standard proof?
Pigeonhole principle
Hard
A.Prefix sums modulo are the pigeons; the residue classes are the holes
B.The integers themselves are pigeons; their values are holes
C.The divisors of are pigeons; the multiples are holes
D.Pairwise sums are pigeons; even/odd parity are holes
Correct Answer: Prefix sums modulo are the pigeons; the residue classes are the holes
Explanation:
Consider prefix sums ; that is values over residue classes mod . Two must share a residue, and the difference of those prefix sums is a contiguous subset sum divisible by .
Incorrect! Try again.
60Why does the formula for the -th non-square number add rather than simply ?
N-th non-square number
Hard
A.Because floor of is undefined for large
B.To ensure the result is always even
C.To correctly account for perfect squares that fall within the range as grows, rounding to the nearest integer
D.Because is always irrational for non-squares
Correct Answer: To correctly account for perfect squares that fall within the range as grows, rounding to the nearest integer
Explanation:
The count of perfect squares up to a value shifts the offset. Rounding to the nearest integer via correctly counts how many squares have been skipped up to the -th non-square, whereas plain flooring miscounts near square boundaries.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →