cs502-Midterm-Solved-MCQs.pdf

Verified academic study resource for CS502 (Fundamentals of Algorithms) under the Computer Science at Virtual University of Pakistan. This PDF document (Midterm Solved Past Paper & Revision File) covers Mid-Term Exam Scope (Lectures 1 to 22) spanning approximately 240 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS502 – Fundamentals of Algorithms
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Tags
MCQ, SOLVED, MIDTERM

Focus on core definitions and repeated MCQs from Lectures 1–22. Remember that scoring in the First Half builds your safety buffer toward the mandatory 20% Two-Half passing rule in CS502.

What this file covers — CS502 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)

Frequently asked questions

Where can I download cs502-Midterm-Solved-MCQs.pdf for free?

You can preview and download "cs502-Midterm-Solved-MCQs.pdf" (CS502 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs502-midterm-solved-mcqs-pdf-2) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS502 file?

This document covers Mid-Term Exam Scope (Lectures 1 to 22) across 4 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS502 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS502 solved past papers and handouts verified for 2026 exams?

Yes. All CS502 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

                            CS502- Fundamentals of Algorithms
                                            Solved MCQS                       Dec 09,2012
                                         From Midterm Papers

                                         Solved By Rabia Rauf

( Marks: 1 ) - Please choose one
1.Random access machine or RAM is a/an
Machines build by Al-Khwarizmi
Mechanical machine
Electronics machine
Mathematical model (lec#2 pg#10)

2._______________ is a graphical representation of an algorithm
 Σ notation
 Θ notation
Flowchart( refrence cls10 chapter no1)
Asymptotic notation

3. A RAM is an idealized machine with ______________ random-access memory.
256MB
512MB
an infinitely large (page#10)
100GB

4.What type of instructions Random Access Machine (RAM) can execute? Choose best
Algebraic and logic
Geometric and arithmetic
 Arithmetic and logic(page#10)
Parallel and recursive

5.What will be the total number of max comparisons if we run brute-force maxima
algorithm with n elements.
*n 2
     n
     2
*n
*n
*n 8
Answe is option 3

6. What is the solution to the recurrence T(n) = T(n/2)+n.
 O(logn) (not sure)
 O(n)
                                        Solved By Rabia Rauf

O(nlogn)
O( n 2 )

7. Consider the following code:
For(j=1; j<n;j++)
For(k=1; k<15;k++)
For(l=5; l<n; l++)
{
Do_something_constant();
}
What is the order of execution for this code.
O(n)
O( n 3 )
O( n 2 log n)
O( n 2 )

8. Consider the following Algorithm:
Factorial (n){
if (n=1)
return 1
else
return (n * Factorial(n-1))

Recurrence for the following algorithm is:
T(n) = T(n-1) +1
T(n) = nT(n-1) +1
T(n)= T(n-1) +n
T(n)=T(n(n-1)) +1 (lec#9)

9. What is the total time to heapify?
 (Olog n) (page#43)
 (n log n)
 ( n 2 log n)
 ( log 2 n)

10.When we call heapify then at each level the comparison performed takes time
 It will take (1)
 Time will vary according to the nature of input data
 It can not be predicted
It will take (log n)

11.In Quick sort, we don’t have the control over the sizes of recursive calls
 True(page#49)
 False
 Less information to decide
 Either true or false

                                         Solved By Rabia Rauf

12.Is it possible to sort without making comparisons?
Yes (pge#57)
No
Question No: 13 ( Marks: 1 ) - Please choose one
If there are 𝛉 n 2 entries in edit distance matrix then the total running
 (1)
 ( n 2 ) (pg#84)
 (n)
 (n log n)

14. For Chain Matrix Multiplication we can not use divide and conquer approach because,
 We do not know the optimum k            (pg#86)
 We use divide and conquer for sorting only
 We can easily perform it in linear time
 Size of data is not given

15.The Knapsack problem belongs to the domain of _______________ problems.
 Optimization       (pg#91)
 NP Complete
 Linear Solution
 Sorting

16.Suppose we have three items as shown in the following table, and suppose the
capacity of the knapsack is 50 i.e. W = 50.
The optimal solution is to pick
 item         value       weight
 1           60           10
 2           100          20
 3           120          30

Items 1 and 2
Items 1 and 3
Items 2 and 3
None of these

17 - What type of instructions Random Access Machine (RAM) can execute? Choose best
answer
1. Algebraic and logic
2. Geometric and arithmetic
3. Arithmetic and logic            (rep)
4. Parallel and recursive
Correct Choice : 3 From Lectuer # 1

18 - Random access machine or RAM is a/an
1. Machine build by Al-Khwarizmi
2. Mechanical machine
3. Electronics machine
                                         Solved By Rabia Rauf

4. Mathematical model        (rep)
Correct Choice : 4 From Lectuer # 1

19- _______________ is a graphical representation of an algorithm
1. Segma Notation
2. Thita Notation
3. Flowchart      (rep)
4. Asymptotic notation
Correct Choice : 3 From Lectuer # 2

20 - What will be the total number of max comparisons if we run brute-force maxima?
algorithm with n elements?
1. n^2
2. n^n/2
3. n
4. n^8
Correct Choice : 1 From Lectuer # 3

21 - function is given like 4n^4+ 5n^3+n what is the run time of this
1. theata(n^4)
2. theata(n^3)
3. theata(4n^4+ 5n^3)
4. theata(4n^4+ 5n^3)
Correct Choice : 1 From Lectuer # 4

22 - Let us say we have an algorithm that carries out N2 operations for an input of size N.
Let us say that a computer takes 1 microsecond (1/1000000 second) to carry out one
operation. How long does the algorithm run for an input of size 3000?
1. 90 seconds
2. 9 seconds
3. 0.9 seconds
4. 0.09 seconds
Correct Choice : 2 From Lectuer # 4

23 - The appropriate big θ classification of the given function. f(n) = 4n2 + 97n + 1000 is
1. ?(n)
2. O(2^n)
3. O(n^2)
4. O(n^2logn)
Correct Choice : 3 From Lectuer # 4

24 - Which sorting algorithm is faster
1. O (n log n)
2. O n^2
3. O (n) (pg#26)
4. O n^3
Correct Choice : 3 From Lectuer # 5

                                           Solved By Rabia Rauf

25 - If algorithm A has running time 7n^2 + 2n + 3 and algorithm B has running time 2n^2,
then
1. Both have same asymptotic time complexity
2. A is asymptotically greater
3. B is asymptotically greater
4. None of others
Correct Choice : 1 From Lectuer # 6

26 - What is the solution to the recurrence T(n) = T(n/2)+n .
1. O(logn)
2. O(n)
3. O(nlogn)
4. O(n^2)
Correct Choice : 1 From Lectuer # 8

27- - How much time merge sort takes for an array of numbers?
1. (n^2)
2. T(n)
3. T( log n)
4. T(n log n)
Correct Choice : 2 From Lectuer # 8

28 - Consider the following Algorithm:
Factorial (n){
if (n=1)
return 1
else
return (n * Factorial(n-1))
}
Recurrence for the following algorithm is:
1. T(n) = T(n-1) +1
2. T(n) = nT(n-1) +1
3. T(n)= T(n-1) +n
4. T(n)=T(n(n-1)) +1
Correct Choice : 4 From Lectuer # 9

29 - For the Sieve Technique we take time
1. T(nk) .           (pg#34)
2. T(n / 3)
3. n^2
4. n/3
Correct Choice: 1 From Lectuer # 10

30 - Sieve Technique applies to problems where we are interested in finding a single item
from a larger set of _____________
1. n items             (pg#34)
2. phases

                                             Solved By Rabia Rauf

3. pointers
4. constant
Correct Choice : 1 From Lectuer # 10

More CS502 files

All CS502 files · Midterm Prep 2026 · MCQs Bank