CS201 lec 30 to 39 QUiz 2022.pdf
Verified academic study resource for CS201 (Introduction to Programming) under the Computer Science at Virtual University of Pakistan. This PDF document (Live Quiz Dumps & Solved Objective Bank) covers Quizzes & Objective Exam Scope spanning approximately 180 pages across 8 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
- Type
- Quiz
- Coverage
- Quizzes & Objective Exam Scope
Quiz questions often repeat with modified parameter values in both Midterm and Final exams. Practice with our 45-second timed simulator to master exam pacing.
What this file covers — CS201 syllabus roadmap
- Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
- Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
- Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
- Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)
- Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
- Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
- Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
- Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)
Frequently asked questions
Where can I download CS201 lec 30 to 39 QUiz 2022.pdf for free?
You can preview and download "CS201 lec 30 to 39 QUiz 2022.pdf" (CS201 PDF, ~180 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs201-lec-30-to-39-quiz-2022-pdf) with 100% free high-speed downloads and zero registration requirements.
What syllabus chapters and lectures are covered in this CS201 file?
This document covers Quizzes & Objective Exam Scope across 8 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22, Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), 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 – Introduction to Programming
CS201 QUIZ 3
WITH MOAZ,JUNAID
FILES
Final term preparation
2022
Introduction to Programming CS201
1
© Copyright Virtual University of Pakistan
CS201 – Introduction to Programming
Lecture No. 30
Reading Material
Deitel & Deitel - C++ How to Program Chapter. 3
3.17
Summary
1) Reference data type
2) Example 1
3) Difference Between References and Pointers
4) Dangling References
5) Example 2
Reference data type
Out today’s topic is about references. This is a very important topic from the C++
prospective. Today we will see what is a reference, how can we use them. C++
defines a thing by which we can create an alias or synonym of any data type. That
synonym is called reference. How do we declare a reference? We declare it by using
& operator. Now it is little bit confusing. We have used & as address-of operator and
here we are using it for referencing. We will write as
int &i;
It means that i is a reference to an integer. Keep that statement very clear in your
mind. It is easier to read from right to left. A reference is a synonym. If we want to
give two names to same thing then we use reference. Reference has to be initialized
when it is declared. Suppose if we have an integer as i and we want to give it second
name. We will reference it with j as:
int &j = i;
We declared an integer reference and initialized it. Now j is another name for i. Does
it mean that it creates a new variable? No, its not creating a new variable. Its just a
new name for the variable which already exists. So if we try to manipulate i and j
individually, we will came to know that we have been manipulating the same number.
2
© Copyright Virtual University of Pakistan
CS201 – Introduction to Programming
Lets take a look at a very simple example. In the main function we take an int variable
i and then we write int &j = i; Now we assign some value (say 123) to i. Now display
the value of i using cout. It will show its value as 123. Display the value of j using
cout. We will not use & operator to display the value of j. We will only use it at the
time of declaration and later we don’t need it. The & is not reference operator rather it
acts as reference declarator. The value of j will be same as of i i.e. 123.
int i;
int &j = i;
i = 123;
cout << “\n The value of i = “ << i;
cout << “\n The value of j = “ << j;
Now what will happen if we increment i as i++; and print the values of i and j. You
will note that the value of i and j both have been incremented. We have only
incremented i but j is automatically incremented. The reason is that both are referring
to the same location in the memory. j is just another name for i.
What is the benefit of reference and where can we use it? References are synonyms
and they are not restricted to int’s, we can have reference of any data type. We can
also take reference of a class. We wrote a function to show the use of pointers. That
function is used to interchange two numbers. If we have two integers x and y. We
want that x should contain the value of y and y should get the value of x. One way of
doing this is in the main program i.e.
int x = 10;
int y = 20;
int tmp;
tmp = y;
y = x;
x = tmp;
The values of both x and y have been interchanged. We can also swap two numbers
using a function. Suppose we have a swap function as swap(int x, int y) and we write
the above code in it, what will happen? Nothing will be changed in the calling
program. The reason is call by value. So when the main function calls the function
swap(x, y). The values of x and y will be passed to the swap function. The swap
function will get the copies of these variables. The changes made by the swap
function have no effect on the original variables. Swap function does interchange the
values but that change was local to the swap function. It did not effect anything in the
main program. The values of x and y in the main program remains same.
We said that to execute actual swap function we have to call the function by
reference. How we did that. We did not send x and y rather we sent the addresses of x
and y. We used address operator to get the addresses. In the main function we call
swap function as swap(&x, &y); In this case we passed the addresses of two integers.
The prototype of the swap function is swap(int*, int*) which means that swap
function is expecting pointers of two integers. Then we swap the values of i and j
using the * notations. It works and in the main program, the values are interchanged.
This was a clumsy way. We can use reference in this case with lot of ease. Let us see
3
© Copyright Virtual University of Pakistan
CS201 – Introduction to Programming
how we can do that. Lets rewrite the swap function using references. The prototype
will be as:
swap (int &i, int &j);
Swap is a function that is expecting i as a reference to an integer and the second
argument is j which is also a reference to an integer. The calling function has to pass
references. What will we write in the body of the function? Here comes the elegance
of the references. In the body we will treat i and j as they are ordinary integers. We
will take a temporary integer and interchange the values of i and j.
swap (int &i, int &j)
{
int temp;
temp = x;
x = y;
y = temp;
}
More CS201 files
- .trashed-1665071865-cs201p Lab quiz 13.pdf (PDF · Quiz)
- .trashed-1665071865-cs201p Lab quiz 13.pdf (PDF · Quiz)
- CS201 1st Quiz 10 MCQs.docx (DOC · Quiz)
- CS201 2nd Quiz By Qalb-e-Momin.pdf (PDF · Quiz)
- CS201 GRAND QUIZ FILE (NEW) BY NIMRA KHAN.pdf (PDF · Quiz)
- CS201 GRAND QUIZ FILE (NEW) BY NIMRA KHAN.pdf (PDF · Quiz)
- CS201 Grand QUIZ Solved BY Sonu.pdf (PDF · Quiz)
- CS201 Grand QUIZ Solved BY Sonu.pdf (PDF · Quiz)