Skip to content
VUBuddy

CS201 Final Term Solved Subjective Set 3 by Junaid

Introduction to Programming PDF 1.4 MBUpdated 23 Oct 2026
Final term past paper CS201 Final Term Solved Subjective Set 3 by Junaid PDF 1.4 MB
vubuddy.com
Type
Final term past paper
Course
CS201 Introduction to Programming
Size
PDF 1.4 MB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 1.4 MB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 2, 3, 4 of 21. Download the file for all 21 pages.

Q1. How can we overcome the issue of dangling reference in a program?

Answer: We can avoid the dangling pointer errors by initialize pointer to NULL, after de-allocating memory, so that pointer will be no longer dangling. Assigning NULL value means pointer is not pointing to any memory location. Pointers The Pointer in C is a variable that stores address of another variable. A pointer can also be used to refer to another pointer function.

Q2. // what will be output of the program below?

int main ()

int i =2;

int j =3;

int k=2*++i*j++;

cout<<k;

  1. What is overloading declaration for a stream extraction (>>) for an integer.

Answer: C++ is able to input and output the built-in data types using the stream extraction operator >> and the stream insertion operator <<. The stream insertion and stream extraction operators also can be overloaded to perform input and output for user-defined types like an object.

  1. Suppose an object of class A is declared as data member of class B.
  •  The constructer of which class will be called first?
  •  The distracter of which class will be declared first?
  •  A
  •  B
  1. //identify and correct error(s) in given code. while (c<=5);

sum + =c; c ++;

Answer: Logical error

  1. Identify each of the following as system software and application software.

Answer: LINUX, DISK CLEANUP, WORD PROCESSOR, WINDOWS, STUDENT INFORMATION

System software: - Linux, Disk cleanup, windows. Application software: - Word Processor, Student information

Q7. //what will be the output of the following code snippet?

int x=10; int &y=x; y+=5; cout<<x;

Q8. Write a function named sum which accepts an integer in the function use a static variable to add the passed to it as arguments with each function call in the end, display the sum of values passed as arguments?

int main(){

All CS201 files →
CS201 Introduction to Programming All CS201 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.