KING'S IT WORLD
please register to watch content in detail
THANKS
ADMIN KINGSIT WORLD

KING'S IT WORLD


 
HomeHome  CalendarCalendar  GalleryGallery  FAQFAQ  SearchSearch  UsergroupsUsergroups  RegisterRegister  Log inLog in  
Search
 
 

Display results as :
 
Rechercher Advanced Search
kings it world text ad
KINGSITWORLD CALENDAR
Follow me on G+
KINGSITWORLD WEATHER
Latest topics
» QURAN MAJEED KE TAFSEER
Mon Aug 20, 2012 2:59 am by YOUSUFHALI

» PHY301 CIRCUIT THEORY REFERENCE BOOK
Wed Jul 25, 2012 11:36 am by shabbir1915

» MTH202 ASSIGNMENT NO 3 SOLUVED
Mon Jun 11, 2012 9:51 am by jaffarhussain

» Retrieve the DTC In the Jewel Module of 1995 Ford
Thu May 31, 2012 11:51 am by obd2tool

» How you can Obvious the Check Engine Light on the
Thu May 31, 2012 11:43 am by obd2tool

» send free sms and send free sms update on facebook
Tue May 15, 2012 8:33 pm by rizwan269

» United Bank Limited (UBL) - Fee Deposit
Thu May 10, 2012 3:33 pm by irumnaz

» PHOTO MIXER SOFTWARE
Fri Apr 20, 2012 10:02 am by sacredwkb

» Entrepreneurship Survey
Thu Mar 08, 2012 2:20 pm by Admin

» Fall 2011 Semester Result Announced
Thu Mar 08, 2012 2:19 pm by Admin

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
kings it world text ad
Social bookmarking
Social bookmarking Digg  Social bookmarking Delicious  Social bookmarking Reddit  Social bookmarking Stumbleupon  Social bookmarking Slashdot  Social bookmarking Yahoo  Social bookmarking Google  Social bookmarking Blinklist  Social bookmarking Blogmarks  Social bookmarking Technorati  

Bookmark and share the address of KING'S IT WORLD on your social bookmarking website
visitors counter
Powered by website analytics technology.
Keywords
MGT502
kings it world text ad
FLAG COUNTER
free counters
LIVE TRAFFIC

Share | 
 

 CS304 FINALTERM PAPERS 2010

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin
avatar

Scorpio
Posts : 638
Points : 2155
Reputation : 19
Join date : 2010-05-15
Age : 29
Location : islamabad

PostSubject: CS304 FINALTERM PAPERS 2010   Sun Aug 08, 2010 10:17 pm


Question No: 1 ( Marks: 1 ) - Please choose one
Classes like TwoDimensionalShape and ThreeDimensionalShape would normally be concrete, while classes like Sphere and Cube would normally be abstract.
► True
► False

Question No: 2 ( Marks: 1 ) - Please choose one
Virtual functions allow you to




► create an array of type pointer-to-base class that can hold pointers to derived classes.
► create functions that can never be accessed.
► group objects of different classes so they can all be accessed by the same function code.
► use the same function call to execute member functions of objects from different classes

Question No: 3 ( Marks: 1 ) - Please choose one
A pointer to a base class can point to objects of a derived class.




► True
► False

Question No: 4 ( Marks: 1 ) - Please choose one
A copy constructor is invoked when






► a function do not returns by value.
► an argument is passed by value.
► a function returns by reference.
► an argument is passed by reference.

Question No: 5 ( Marks: 1 ) - Please choose one
Each try block can have ______ no. of catch blocks.

► 1
► 2
► 3
► As many as necessary.


Question No: 6 ( Marks: 1 ) - Please choose one
Non Template Friend functions of a class are friends of ________instance/s of that class.

► All
► One specific
► All instances of one date type
► None of the given options


Question No: 7 ( Marks: 1 ) - Please choose one
Template functions use _________ than ordinary functions.

► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options


Question No: 8 ( Marks: 1 ) - Please choose one
The find() algorithm




► finds matching sequences of elements in two containers.
► finds a container that matches a specified container.
► takes iterators as its first two arguments.
► takes container elements as its first two arguments.

Question No: 9 ( Marks: 1 ) - Please choose one
The copy() algorithm returns an iterator to





► the last element copied from.
► the last element copied to.
► the element one past the last element copied from.
► the element one past the last element copied to.

Question No: 10 ( Marks: 1 ) - Please choose one
If you define a vector v with the default constructor, and define another vector w with a one-argument constructor to a size of 11, and insert 3 elements into each of these vectors with push_back(), then the size() member function will return ______ for v and _____ for w.

► 11 for v and 3 for w.


► 0 for v and 0 for w.
► 0 for v and 3 for w.
► 3 for v and 11 for w.

Question No: 11 ( Marks: 1 ) - Please choose one
Which is not the Advantage of inheritance?





► providing class growth through natural selection.
► facilitating class libraries.
► avoiding the rewriting of code.
► providing a useful conceptual framework.


Question No: 12 ( Marks: 1 ) - Please choose one
class DocElement
{
public:
virtual void Print() { cout << "Generic element"; }
};
class Heading : public DocElement
{
public:
void Print() { cout << "Heading element"; }
};
class Paragraph : public DocElement
{
public:
void Print() { cout << "Paragraph element"; }
};
void main()
{
DocElement * p = new Paragraph();

p->Print();
}

When you run this program, it will print out a single line to the console output.

What will be in that line?

Select one correct answer from the following list:

► Generic element

► Heading element

► Paragraph element

► Nothing will be printed.

Question No: 13 ( Marks: 1 ) - Please choose one
Which type of inheritance is being represented by the following statement,
class X : public A, public B { ... ... };






► Single inheritance
► Multiple inheritance
► Double inheritance
► None of the given options

Question No: 14 ( Marks: 1 ) - Please choose one
When we write a class template the first line must be:




► template < class class_name>
► template < class data_type>
► template < class T >
Here T can be replaced with any name but it is preferable.
► class class-name()
class template



Question No: 15 ( Marks: 1 ) - Please choose one
Function templates should be used where code and behavior must be identical.


► True
► False

Question No: 16 ( Marks: 1 ) - Please choose one
Which of the following is/are advantage[s] of generic programming?









► Reusability
► Writability
► Maintainability
► All of given

Question No: 17 ( Marks: 1 ) - Please choose one
The specialization pattern after the name says that this specialization is to be used for every,





► data type
► meta type

► virtual type
► pointer type

Question No: 18 ( Marks: 1 ) - Please choose one
A range is often supplied to an algorithm by two _______ values.





► italic
► iteration
► iterator
► None of given

Question No: 19 ( Marks: 1 ) - Please choose one
Which of the following is an integral part of an object?




► State

► Behavior
► Unique identity
► All of the given

Question No: 20 ( Marks: 1 ) - Please choose one
Consider the following statement

Cupboard has books

What is the relationship between Cupboard and books?






► Composition
► Aggregation
► Inheritance
► None of the given options

Question No: 21 ( Marks: 1 ) - Please choose one
Which sentence clearly defines an object?







► one instance of a class.
► another word for a class.
► a class with static methods.
► a method that accesses class attributes.

Question No: 22 ( Marks: 1 ) - Please choose one
___________, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.






► Friendship is one way only
► Friendship is two way only
► NO Friendship between classes
► Any kind of friendship

Question No: 23 ( Marks: 1 ) - Please choose one
The statement objA=objB; will cause a compiler error if the objects are of different classes.

► True
► False

Question No: 24 ( Marks: 1 ) - Please choose one
Consider the call given below of an overloaded operator "+",
Rational_number_1 + Rational_number_2
Where Rational_number_1 and Rational_number_2 are the two objects of Rational_number class (a user defined class). Identify which of the above two objects will be passed as an argument to the overloaded operator function?








► Rational_number_1
► Rational_number_2
► Both Rational_number_1 & Rational_number_2
► any of the two objects, randomly

Question No: 25 ( Marks: 1 ) - Please choose one
If a class D has been derived using protected inheritance from class B (If B is a protected base and D is derived class) then public and protected members of B -------- accessed by member functions and friends of class D and classes derived from D
► can be
► cannot be
► does restirct to be
► not given

Question No: 26 ( Marks: 1 ) - Please choose one
In Private -------------- only member functions and friend classes or functions of a derived class can convert pointer or reference of derived object to that of parent object

► specialization
► inheritance
► abstraction
► composition

Question No: 27 ( Marks: 2 )
Give two uses of a destructor.


Question No: 28 ( Marks: 2 )
Describe the way to declare a template class as a friend class of any other class.


Question No: 29 ( Marks: 2 )
Give the name of two basic types of containers collectively called First class containers?


Question No: 30 ( Marks: 2 )
State any conflict that may rise due to multiple inheritance?

Question No: 31 ( Marks: 3 )
What will be the output after executing the following code?

class c1{
public:
virtual void function(){
cout<<”I am in c1”<}


};
class c2: public c1{
public:
void function(){
cout<<”I am in c2”<
}

};
class c3: public c1 {
public:
void function(){
cout<<”I am in c3”<}

};

int main(){

c1 * test1 = new c2();
c1 * test2 = new c3();
test1->function();
test2->function();
system(“PAUSE”);
return 0;
}

Answer: I am in c2
I am in c3

Question No: 32 ( Marks: 3 )
If we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class.


Question No: 33 ( Marks: 3 )
Tell the logical error/s in the code given below with reference to resource management; also describe how we can correct that error/s.

class Test{

public:
int function1(){
try{
FILE *fileptr = fopen(“filename.txt”,“w”);
throw exception();
fclose(fileptr);
return 0;
}
catch(Exception e){
...
}
}
};

Question No: 34 ( Marks: 5 )
What is the output produced by the following program?

#include

void sample_function(double test) throw (int);

int main()
{
try
{
cout <<”Trying.\n”;
sample_function(98.6);
cout << “Trying after call.\n”;
}
catch(int)
{
cout << “Catching.\n”;
}

cout << “End program.\n”;
return 0;
}
void sample_function(double test) throw (int)
{
cout << “Starting sample_function.\n”;
if(test < 100)
throw 42;
}


Question No: 35 ( Marks: 5 )
The code given below has one template function as a friend of a template class,
1. You have to identify any error/s in this code and describe the reason for error/s.
2. Give the correct code after removing the error/s.

template
void Test(U);
template< class T >

class B {
int data;
public:
friend void Test<>( T );
};

template
void Test(U u){
B < int> b1;
b1.data = 7;
}
int main(int argc, char *argv[])
{
char i;
Test(i);
system("PAUSE");
return 0;
}


Question No: 36 ( Marks: 5 )
Consider the following class,
class Base
{
char * p;
public:
Base() { p = new char[10]; }

~Base() { delete [] p; }
};
class Derived : public Base
{
char * q;
public:
Derived() { q = new char[20]; }

~Derived() { delete [] q; }
};
void foo()
{
Base* p = new Derived();

delete p;
}

With this program, every time function foo is called, some memory will leak.
Explain why memory will leak. Also, explain how to fix this problem.



Back to top Go down
View user profile
 
CS304 FINALTERM PAPERS 2010
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Mercredi 10 mars 2010 : l'horoscope
» Last years' Q Papers & Suggested Answers
» aptech online test sample papers
» Test papers are compulsory to get attempt in executive programme
» RE: GPPB Resolution No. 06-2010

Permissions in this forum:You cannot reply to topics in this forum
KING'S IT WORLD :: EDUCATION :: PAPERS :: SPRING 2010 FINAL TERM PAPERS (updated daily)-
Jump to: