CS201 Final Term Solved Subjective Set 2 by Junaid
- Type
- Final term past paper
- Course
- CS201 Introduction to Programming
- Size
- PDF 927 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extension for 30 a day.
Preview text
Text from pages 2, 3, 4 of 22. Download the file for all 22 pages.
Q1. Identify each of the following as system software and application software. (mark 5) LINUX, DISK CLEANUP, WORD PROCESSOR, WINDOWS, STUDENT INFORMATION
Answer: System software: - Linux, Disk cleanup, windows. Application software:- Word Processor, Student information
Q2. Write a program which defines three variables of type double which store three different values including decimal points, using set precision manipulators to print all these values with different numbers of digits after the decimal number.(5)
Answer: #include #include int main ()
double x1 = 12345624.72345 double x2 = 987654.12345 double x3 = 1985.23456 cout << setprecision (3) << x1<< endl; cout << setprecision (4) << x2 << endl; cout << setprecision (5) << x3<< endl; return 0;
Q3. Define static variable also explain life time of static variable? (3)
Answer: Static variable means maintaining the state of a variable. It exists and lives around even when we are outside the function. It is created and initialized only once during the lifetime of the program and therefore it will be destroyed or taken out of memory only once during the lifetime of the program.
Q4. What do you know about run time error? (3)
Answer: Run-Time Errors rules Example: Accessing a non-existent variable, property, method, object, etc (e.g. a method name is misspelled)
- Sources of these can be determined by a careful
- reading of the code, but unfortunately, not
always
Q5. What is limitation of the friendship between classes? (3)
Answer: Friendship relation between classes is a one way relation that is if one class declare friend another class then the another class is the friend of first class but not the first class if the friend of another class.
Q6. what is the source and destination of cin?(2)
Answer: For cin, the source is normally keyboard and the destination can be an ordinary variable i.e. native-data type variable
Q7. Write the general syntax of allocation memory dynamically to an array using new operator? (2)
Answer: Following is the syntax: new data_type [number_of_locations];
Q8. What is diffrent between pointer and variable?
Answer: normal variable contains tha value of variable either int or float whereas pointer variable contains the address of another variable
Q9. What is difference between Unary and binary operators and how they can be overloaded?
Answer: Unary operator takes one argument. a ++ is an example of unary operator Binary take two operators +,-,* are example of binary operators Overloaded binary operator may return any type Here is general syntax of overloading Return-type operator symbol (parameters); Operator is keyword
Q10. How many types of templates?
Answer: There are two different types of templates in C++ language i.e.’ function templates and class templates.
Q11. What will be the output of following function if we call this function by passing int 5? template T reciprocal(T x) {return (1/x); }
Q12. Identify the errors in the following member operator function and also correct them. math * operator(math m);
math * operator (math m)
math temp; temp.number= number * number; return number;
Answer: The errors are in the arguments of the member operation function and also in the body of operator member function. Correct function should be math *operator(math *m); math *operator (math *m)
math temp; temp = m; temp.number= number * number; return temp.number;
Related CS201 files
All CS201 files →- CS201 Final Term Short Notes by VU Topper RM Final term PDF 816 KB
- CS201 Final Term MCQs Set 5 Final term PDF 4.5 MB
- CS201 Final Term Solved MCQs by Junaid Final term PDF 1.7 MB
- CS201 Final Term Solved MCQs Set 2 by Junaid Final term PDF 2 MB
- CS201 Highlighted Handouts Set 3 Highlighted PDF 3.3 MB
- CS201 Slides Lectures 1-45 Quiz RAR 1.8 MB
Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.