VUDESK

¤Virtual University Of Pakistan Network¤



Welcome Visitors to VUDESK Family .Join VUDESK For Free to Get more Access to study material and lot of infotainment stuff. Stay Connected!!

VUDESk ALL Subject CODES
Find Your Subject Code , Join Group And You Will Get ALL related Data
ACC - Fundamentals of auditing and business
ACC311ACC501
ACF - (Accounting And Finance Related)
ACF619ACFI619
COM - (Commerce Related)
COM619COMI619
ECO - (Economics Related)
ECO401 ECO402 ECO403 ECO404
ENG - (English Related)
ENG001 ENG101 ENG201 ENG301 ENG401
ETH201 - Ethics (for Non-Muslims)
ETH201
ISL201 - Islamic Studies
ISL201
IT - (Info Tech Related
IT000IT0001IT430IT619ITI619
MIS - (Project And Internship Report)
MIS619 MISI619MIS620 MISI620
PAD - (Public Administration Related)
PAD619 PADI619
PAK301 - Pakistan Studies
PAK301PAK302
PHY - (Physics Related)
PHY101 PHY301
PSC201 - International Relations
PSC201PSC401
SOC - (Socialogy Related)
SOC101 SOC401
STA - (Statistics and Research)
STA301 STA630
URDU - (Urdu Related)
URD101

CS201 Introduction to Programming-Final Term Papers Spring 2012 -Date 16-July to 27-July

SHARE

Tags: -Date, 16-July, 2012, 27-July, CS201, Introduction, Papers, Programming-Final, Spring, Term, More…to

Views: 320

Replies to This Discussion

Advertise Here

Q: Write down piece of code that will declare a matrix of 3×3 using stream

Q: What is the keyword ‘this’ and what are the uses of ‘this’ pointer?

Q: Write a C++ program that contains a class ‘myClass’ having two data members of type int.

In main function of the program

1. Prompt the user to enter the number of objects to be created.
2. Dynamically allocate memory to objects according to the size entered by user.

3. De-allocate memory that was allocated to objects

Q: one code was to convert in seconds to  hr, min & sec..

Q: new, delet operator, stream insertion, nested classes, templates

THANKS MOON

Classes defined inside other classes are called ________ classes
► looped
► nested
► overloaded
► none of the given options.
When the compiler overloads the assignment (=) operator by default then __________
► compiler does member wise assignment.
► compiler does not allow default overload of assignment (=) operator
► member of the class are not assigned properly
► None of the given options
YA QUESTION ESKSI AUR TARHAN POCHA THA JS KA JAWAB THA MEMBER WISE ASSIGNMENT
MCQ/Q: Copy constructor KY BOHAT QUESTION THAY ES KI CONCEPT CLEAR HONY CHAIN
MCQ: stream insertion and stream extraction operators


MCQ: Unary and binary operators
Q: 2/ 3 number ka tha
How many bytes will the pointer iPtr of type hexadecimal aur sath mai value dee hoi thee
(x—ff51) and jump to the next position and what is the address iPtr += 4 ;

Which programming tool is helpful in tracing the logical errors?
Debugger
A template function must have at least ---------- generic data type
► Zero
► One
► Two
► Three

  • Dynamic memory allocation ky ab kuch question thay MCQ b aur 2 number ki b



  • Constructor enclose the other constructor and tells the how’s destructor call



  • For non-member operator function, object on left side of the operator may be


► Object of operator class
► Object of different class
► Built-in data type
► All of the given options

The operator function will be implemented as _____, if obj1 drive the - operator whereas obj2 is
passed as arguments to - operator in the statement given below.
obj3 = obj1 - obj2;
► Member function
► Non-member function
► Friend function
► None of the given options



Which one of the following is the declaration of overloaded pre-increment operator implemented as
member function?


► Class-name operator +() ;
► Class-name operator +(int) ;
► Class-name operator ++() ;
► Class-name operator ++(int) ;check from book please

The static data members of a class are initialized _______
► at file scope
► within class definition
► within member function
► within main function

life time of static variable?


  • Es tarhan ka question tha lakin values change thee


What will be the output of following function if we call this function by passing int 5?
template <class T>
T reciprocal(T x)
{
return (1/x);
}
Answer:-
The output will zero as 1/5 and its .05 but conversion to int make it
zero
Above is prototype of template class so assume passing an int and

  • Post increment and pre increment k syntax btana thay(2 marks)


Answer:
Classname operator ++(); ---- pre increment
Classname operator ++(int) ---- post increment


  • Es ka pocha tha copy constructor or assignment



Matrix m1 = m2;

  • How many arguments a Unary Operator take? Can we make a binary operator as unary operator?


Answer:-
Unary operator takes only one arguments like i++ or i-- (Post increment or post decrement operators for
integers) or ++i,--i (Pre increment or pre decrement operators for integers) ,we can not make Unary
operator as binary or binary as Unary operator.

  • Simple function and class function explain



  • 5 mark ka ak question tha



To calculate the tax 5% and 7 % to deduct the salary using the switch statement
Full concept of Midterm aur ya question book mai hay kafi ziyda milta hay lakin values change thee lakin idea same tha

5 marks ka 2nd question
-Class String
-Delete pointer
-New sy allocate memory
-Strcpy(s2,s1)

Main()
-String s, *sptr

1. Find the error in following syntax,
while(i<=100)
sum+=i*i;

2. General syntax of declaring and initializing the data members.
3. class String
{
char buf [25];
};
Write code for assignment (=) operator function which assign one String object to other object. Your code should also avoid self assignment.

4. Write a simple program, which will get a stream of character and output the stream of characters using cin and cout.

Q.make a program using getline function(5)
Q.make a program using template function select two floating point number and add them with add() function.(5)
Q.make a program take salary and pay tax of 5% if salary is less than 10,000 and pay 7% if the salary is greater than 10,000 using switch function.(5)
Q.what are the function of new and delete ?(3)
Q.what are the stream insertion overloaded operators?(3)

Friend function of a class is ______________.
Member function
Non-member function
Private function
Public function
A template function must have at least ---------- generic data type
Zero
One
Two
Three
The object _______________may be used both for file input and file output
fstream,
ifstream,
ofstream,
none of the given options
What should be the return type of the constructor?
void pointer
int
same as object type
constructors do not return any thing
Classes defined inside other classes are called ________ classes.
Looped
Nested
Overloaded
none of the given options.
new operator is used to allocate memory from the free store during
Compile Time
Run Time
Link Time
None of the given options
Which kind of functions can access private member variables of a class?
Friend functions of the class
Private member functions of the class
Public member functions of the class
Friend, private and public functions
The normal source of cin object is
File
Disk
Keyboard
RAM
Which value is returned by the destructor of a class?
A pointer to the class.
An object of the class.
A status code determining whether the class was destructed correctl
Destructors do not return a value.
C is widely known as development language of _______ operating system.
Linux
Windows
Unix
Mac OS
Like member functions, ______ can also access the private data members of a class.
Non-member functions
Friend functions
Any function outside class
None of the given options
The stream insertion and stream extraction operators are already overloaded for ______.
User-defined data types
Built-in data types
User-defined and built-in data types
None of the given options
The appropriate data type to store the number of rows and colums of the matrix is____________.
Float
Int
Char
none of the given options.
A Matrix can be composed of ints, floats or doubles as their elements. Best way is to handle this ,
_______________.
Write a separate class to handle each
Use templates
Use strings to store all types
None of the given options
cout setfill(‘0’) setw(7) 128 ;
0000128
0128128
1280000
0012800
Which of the following is the correct way to declare a variable x of integer type?
x int ;
integer x ;
int x;
x integer
Q.1: Using setw and setfill manipulators to display Virtual--------University.
Q.2: Write a program to display:
If you age is less than or equal to 18 then display "you are child"
if your age is above 18 or less than 35 then display "you are adult"
if your age is is above 60 then display "you are senior citizen"

objctv nd subjctv dono k liye stream insertion & stream extraction ke concept bohat ache hone chahiyen.
mooaz file mei se 5-6 objctv they.
total 52 qustn they,
40 were objectives.
5 program they,
qustn 48-52
1-class template add(); 2 variable lene they of float type. unpe add func apply karna tha main mei n then sum return karana tha.
2.what is the difference b/w get() and getline()? explain with coding example.
3.ek program friend function pe tha usko class mei declare kara k cout karana tha.
4.ek program mei +operator ko overload karana tha.and two objcts ka sum karana tha of string type.

most of the questions were from past papers.. from moaz's file
there was one long question
Question statement
that we have to calculate the amount of tax on an item purchased by customer ,, tax is 15% and user should input the item's price ..(5 marks)
2nd question was the same setw and setfill one
3rd there was a question we had to write some template but sorry i cannot remember the exact question..
for 3 Marks
Q1. amongst pointer to character or array for string which one is better for string representation and why??
Q2.Static funtion aur non static function ka output batana tha..

otal 52 Qs.
40 MCQs, 5 Qs of 2 Marks, 5 Qs of 3 Marks, 3 Qs of 5 Marks
Few Mcqs was from past papers mostly was new.
Same with subjective paper.
If p and q are pointers then whats wrong in the given statement? (2)
Cout p=” p “, p+q = “p+q” endl (something like that)
Code was given an we have to find out errors (2)
Suppose an object of class A is declared as data member of class B. (3)
(i) The constructor of which class will be called first?
(ii) (ii) The destructor of which class will be called first?
if program will take 123 in octal, what it will be in hex? (3)
in one Qs we need to write the output of a code given (3)
The whole code was given and we need make changes in “remove” and “print” etc.
Kuch elements ko remove and add krna tha. (5)
2 Qs were same of correcting the given code.

MCQ 20% from past paper
Q Write a program which open a file name “this.txt” and then using write() function, writes the string “Introduction to Programming” at the end of the file.
Q What will be the output of the program:
Int x=10;
Int&y=x;
Y+=5;
Coutx;
Q A two dimensional array has 3 rows and 4 columns. Write down the syntax to initialize first element of all three rows of two dimensional array with value 2.
Q How can we initialize an object which is created as constant data member in another class?
Q An array delare int day[]={1,2,3,4,5,6,7}
How many elements have?
If the declaration ofarray is changed to int days[7]={1,2,3,4,5,6,7}
How many elements have?
Q write general syntax of two way friend relationship between the class(class1, class2).
Give explaination of the code
Martix(int=0,int=0)
Matrix(constMartix&)
~Matrix();
.make a program using getline function(5)

Nice work yasmeen keep it up

RSS

*Member OF Week*

1. Ahssan K

Karachi, Pakistan

=======================

Popular Social Events

=======================

+ Member of the Day

+ Member of the Week

+ Member of the Month

+ Member of the Year

+ Miss VU

+ Mr VU

+ Gold Members

+ Vote for Miss VU

+ Vote for Mr VU

+ Members Points Table

+ Profile Points Allocation

+ Competition Corner

+ Our Fans Club

+ Certificate Winners

---------------------------------------

௵ Scholars Of Desk

 Gold Members

 MR VU,S

௵ MISS VU,S

 Members Of Month

 Team Members

 Moderators 

  ADMINS

ʭAdministrationʭ

Senior Admin : Yasmeen

VUDESK Owner : Ismail Shah

DMCA.com

VUDESK GROUPS

© 2013   Created by ʭIsmail Shahʭ.

Badges  |  Report an Issue  |  Terms of Service

-->