cs201 Midterm by Tariq.pdf

Verified academic study resource for CS201 (Introduction to Programming) 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
CS201 – Introduction to Programming
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Tags
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 CS201.

What this file covers — CS201 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 cs201 Midterm by Tariq.pdf for free?

You can preview and download "cs201 Midterm by Tariq.pdf" (CS201 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs201-midterm-by-tariq-pdf-2) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS201 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 CS201 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 CS201 solved past papers and handouts verified for 2026 exams?

Yes. All CS201 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

                    CS201 By Tariq Hanif                                      2013
1. Overflow condition occurs when we try to assign a value to a variable which is
__________.
Greater than its maximum size
Within its range
Equal to its size
Less than its maximum size

2. The _break_______ statement interrupts the flow of control.
Switch/loop
continue
goto
break
3. Which of the following operators is used to access the value of variable pointed by
a pointer?
* operator
-> operator
&& operator
& operator
4. Which of the following is not a reserve word for data types in standard C/C++?
int
float
real
double
5.To assigned a value to a character type variable, ________ are used around the value.

parenthesis ( )
single qoutes ' '
double qoutes " "
curly braces { }

6. When x = 7; then the expression x%= 2; will calculate the value of x as
__________.
1
3
7
2
7. What is the highest legal index for the following array?
   int arr[4]
4
3
2
1
8. For which array, the size of the array should be one more than the number of
elements in an array?

int
double
float
char

                                           1

                     CS201 By Tariq Hanif                                        2013
9. In programming, comments are used to explain the functioning of the _______ .
Debugger
Editor
Program
Linker
10. Operating System is a type of a/an ___________.
application software
system software
computer language
interpreter
11._________ are very good tools for code reuse.
operators
loops
functions
variables
12.Identify the correct option which is used for calling the function int square (int *).
square(int &num) ;
square(&num) ;
square(*num) ;
square(num) ;
13. The _________ statement allows us to select from multiple choices based on a set of
fixed values for a given expression.
switch
break
continue
goto
14. The file-open mode __________ is used to open a file for output and move to the end
of the file.
ios::out
ios::app
ios::trunc
ios::binary
15. A function’s single most important role is to ____________.
give a name to a block of code
increases program size
accept arguments and provide a return value
help in organizing a program into conceptual units

16. In C++, Integer calculation occurs in _____ bytes.
1 byte
2 bytes
4 bytes
8 bytes
17. The function write() takes ___________________as parameter(s).
String of pointer type
String of variable lengths, no. of bytes to be read and flags
Pointer array of characters and a delimiter
String and no. of bytes to be written
18. A ________ name includes a primary name and an optional period with an extension.
File

                                            2

                     CS201 By Tariq Hanif                                       2013
Disk
Data
Database
19. In case of pass by reference, _______________.
The values of the variables are passed to the function so that it can manipulate them
The location of variable in memory is passed to the function
The function declaration should contain ampersand (&) in its type declaration
Temporary variables are created to store the values of the variables passed
20. There is a pointer variable named ptr of type float then address of which type of
variable the ptr will store in it?
int
float
char
double
21. If char Array[7]; is a character array then write the statement which store a
character at Fifth location of this array.02
Ans:Array[4] = ‘a’;
22. What happens, if we open an existing file using the default output mode and write the
data into the file?02
It will start writing from start of file. And will overwrite existing data/text.
23. Perform left shift operation on a binary number 0101 and write the result in binary
and decimal.03
Ans:
Binary = 1000
Decimal = 8
25. Write down the output of the code given below?
#include <iostream>
using namespace std;

union Num
{
  int ValueI;
  float ValueF;
  double ValueD;
  char ValueC;
};

void main()
{
  // Optional union keyword
  // ValueI = 100
  Num TestVal = {100};

 cout<<"\nInteger = "<<TestVal.ValueI<<endl;
 TestVal.ValueF = 2.123;
 cout<<"Float = "<<TestVal.ValueF<<endl;
 cout<<"Uninitialzed double = "<<TestVal.ValueD<<endl;
 cout<<"Some rubbish???"<<endl;
 TestVal.ValueC = 'U';

                                            3

                    CS201 By Tariq Hanif                                     2013
  cout<<"Character = "<<TestVal.ValueC<<endl;
} 05
Ans:
Integer = 100
Float = 2.123
Uninitialzed d
Some rubbish??
Character = U

26. Consider the following code segment. What will be the output of the following
program before and after calling the function updateAge?

void updateAge (int []) ;
int main(){
int age[5] ={10};
cout << “Array elements before passing array to function” << endl ;
        for (int i =0; i <5; i++)
                 cout << “Array element”<< i+1 << “:” <<age[i] | << endl ;
        }
updateAge(age);
cout << “Array elements after passing array to function” << endl ;
        for (int i =0; i <5; i++)
                 cout << “Array element”<< i+1 << “:” <<age[i] | << endl ;
        }
}
void updateAge(int age[], int size){
age[3] = 20 ;
}
05

Ans:
Array elements before passing array to function
Array element1:10
Array element2:0
Array element3:0
Array element4:0
Array element5:0
Array elements after passing array to function
Array element1:10
Array element2:0
Array element3:0
Array element4:20
Array element5:0

                                          4

CS201 By Tariq Hanif   2013

            5

More CS201 files

All CS201 files · Midterm Prep 2026 · MCQs Bank