Solution of Assignments,GDBs,MCQs, Mid Term & Final Term Past Papers of Virtual University
Saturday, July 9, 2011
Wednesday, July 6, 2011
Tuesday, July 5, 2011
Monday, July 4, 2011
CS201 Final Term Past Solved Paper 6
FINALTERM EXAMINATION
Spring 2010 CS201- Introduction to Programming
If it is required to copy an array to another array then,
► Both arrays must be of the same size and data type ► Both arrays may be of different size ► Both arrays may be of different data type
► Both arrays may be of different size and type
Dealing with structures and functions passing by reference is the most economical method
► True ► False
eof( ), bad( ), good( ), clear( ) all are manipulators.
► True ► False
Overloaded new operator function takes parameter of type size_t and returns
► void (nothing) ► void pointer
► object pointer ► int pointer
When new operator is overloaded at global level then corresponding built-in new operator will not be visible to whole of the program.
► True ► False
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
► parentheses ( ) ► braces { } ► brackets [ ] ► arrows < >
The return type of a function that do not return any value must be ________
► float ► int ► void ► double
UNIX has been developed in ________ language.
► JAVA ► B ► C ► FORTRAN
Like member functions, ______ can also access the private data members of a class.
► Non-member function ► Friend functions ► Any function outside class ► None of the given options
Which of the following statement is best regarding declaration of friend function?
► Friend function must be declared after public keyword.
► Friend function must be declared after private keyword.
► Friend function must be declared at the top within class definition.
► It can be declared anywhere in class as these are not affected by the public and private keywords.
The operator function overloaded for an Assignment operator (=) must be
► Non-member function of class ► Member function of class
► Friend function of class ► None of the given options
The endl and flush are _______
► Functions ► Operators ► Manipulators ► Objects
If a symbolic constant has been defined, it will be an error to define it again.
► True ► False
The operator used for casting, in C, is standard ________ operator.
► none of the given options. ► cast ► cost ► const
Constructors can not be overloaded like ordinary functions.
► True ► False
Which of the following function call is correct for the function prototype?
defaultParameters ( int a, int b = 7, char z = ‘*’ );
► defaultParameters (5); ► defaultParameters (5, ‘8’);
► defaultParameters (6, ‘#’); ► defaultParameters (0, 0, ‘*’, 0);
When an operator function is defined as member function for a binary Plus (+) operator then the number of argument it take is/are.
► Zero ► One ► Two ► N arguments
Wecan not define a variable of user-defined data type in the class.
► True ► False
When an object of a class is defined inside an other class then,
► Constructor of enclosing class will be called first
► Constructor of inner object will be called first
► Constructor and Destructor will be called simultaneously
► 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.
Class is a user defined___________.
► data type ► memory referee ► value ► none of the given options.
A class is a user defined data type
Question No: 22 ( Marks: 1 ) - Please choose one
A pointer variable can be,
► Decremented
► Incremented
► Multiplied
► Both Decremented and Decremented
Question No: 23 ( Marks: 1 ) - Please choose one
NULL value has been defined in ______ and _________ header files.
► strings.h and iostream.h
► ctype.h and conio.c
► conio.c and conio.h
► stdlib.h and stddef.h
NULL has been defined in the header files stdlib.h and stddef.h.
Question No: 24 ( Marks: 1 ) - Please choose one
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
Question No: 25 ( Marks: 1 ) - Please choose one
"setprecision" manipulator will set
► The number of digits after the decimal point
► The number of digits before the decimal point
► The number of digits in a number
► None of the given options
setprecision. This is the parameterized, inline- manipulator that sets the places after the decimal point.
Question No: 26 ( Marks: 1 ) - Please choose one
Which of the following option will be true, if we overload "-=" operator?
► only - operator needs to be overloaded (not sure)
► Minus (-) and = operators need to be overloaded
► the -= operator need to be overloaded explicitly
► the - and = operators need to be overloaded implicitly
Question No: 27 ( Marks: 2 )
Suppose there is a template function ‘func’ having argument of type U and return type T. What will be the C++ syntax to call this function, passing a variable ‘x’ of type double and returning an int type?
Question No: 28 ( Marks: 2 )
Which variable will be used in inner code block if we have the same names of variable at outer code block and inner code block?
Question No: 29 ( Marks: 2 )
What is the benefit of reference and where can we use it?
Question No: 30 ( Marks: 2 )
Write the C++ code for the declaration of overloaded stream insertion and stream extraction operator for the object d of type Date.
Question No: 31 ( Marks: 3 )
What will be the output of following functions if we call these functions three times?
1)
void func1(){
int x = 0;
x++;
cout << x << endl;
}
2)
void func2(){
static int x = 0 ;
x++;
cout << x << endl ;
}
Question No: 32 ( Marks: 3 )
If the requested memory is not available in the system then what does calloc/malloc and new operator return?
Question No: 33 ( Marks: 3 )
Suppose an object of class A is declared as data member of class B.
(i) The constructor of which class will be called first?
(ii) The destructor of which class will be called first?
Question No: 34 ( Marks: 5 )
What is difference between Unary and binary operators and how they can be overloaded?
Question No: 35 ( Marks: 5 )
Suppose we have the following class.
class Matrix
{
private:
int Elements[3][3];
};
Write the operator function of stream extraction operator (>>) for this class.
Question No: 36 ( Marks: 5 )
What is meant by user interface and class interface in C++ ? And what role a class interface can play in user interface [Marks 5]
CS201 Final Term Past Solved Paper 5
CS201 Final Term Past Solved Paper
*.doc is _____________ by type.
.► Sequential File ► Random Access File ► Data File ► Record File
Which of the following is NOT a preprocessor directive?
► #error ► #define► #line ► #ndefine
The return type of operator function must always be void.
► True ► False
What does (*this) represents?
► The current function of the class ► The current pointer of the class
► The current object of the class ► A value of the data member
The statement cin.get (); is used to,
► Read a string from keyboard ► Read a character from keyboard
► Read a string from file ► Read a character from file
When we do dynamic memory allocation in the constructor of a class, then it is necessary to provide a destructor.
► True► False
Overloaded new operator function takes parameter of type size_t and returns
► void (nothing) ► void pointer ► object pointer ► int pointer
The second parameter of operator functions for << and >> are objects of the class for which we are overloading these operators.
► True ► False
C++ is a case-sensitive language
► True ► False
To include code from the library in the program, such as iostream, a directive would be called up using this command.
► #include “iostream.h” ► include <iostream.h>
► include <iostream.h> ► #include <iostream.h>
A template function must have only generic data types.
► True ► False
Template class can not have static variables.
► True ► False
What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?
► *ptr = arr ; ► ptr = arr ; ► *ptr = arr[5] ; ► ptr = arr[5] ;
What will be the correct syntax to access the value of fourth element of an array using pointer ptr?
► ptr[3] ► (ptr+3) ► *(ptr+3) ► Both 1and 3
If most significant bit of un-signed number is 1 then it represents a positive number.
► True ► False
If there is a symbol (& sign) used with the variable name followed by data type then it refers to _____ and if & is being used with variable name then it refers to _____.
► Address of variable, reference variable ► Reference variable, value of variable
► Reference variable, address of variable ► Address of variable, value of variable
We can also do conditional compilation with preprocessor directives.
► True ► False
The default value of a parameter can be provided inside the ________________
► function prototype ► function definition
► both function prototype or function definition ► none of the given options.
Classes defined inside other classes are called ________ classes
► looped ► nested ► overloaded ► none of the given options.
What purpose do classes serve?
► Data encapsulation ► Providing a convenient way of modeling real-world objects
► Simplifying code reuse ► All of the given options
Every class contains _______________.
► Constructor ► Destructor
► Both a constructor and a destructor ► 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
When an object of a class is defined inside another class then,
► Destructor of enclosing class will be called first
► Destructor of inner object will be called first
► Constructor and Destructor will be called simultaneously ► None of the given options
It is possible to define a class within another class.
► True ► False
New and Delete are also used with ___________ and data types as well.
► Class, Objects ► Structures, Pointers ► Both Class and structures ► None of above
With New keyword, data types and class members are initialized with meaningful values instead of garbage.
► True ► False
How many arguments a Unary Operator take? Can we make a binary operator as unary operator?
Which arithmetic operators cannot have a floating point operand?
What are manipulators? Give one example.
Write down piece of code that will declare a matrix of 3x3. And initialize all its locations with 0;
Which one (copy constructor or assignment operator) will be called in each of the following code segment?
1) Matrix m1 (m2); 2) Matrix m1, m2; m1 = m2; 3) Matrix m1 = m2;
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);
}
T reciprocal(T x)
{
return (1/x);
}
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;
}
Write a program which defines three variables of type double which store three different values including decimal points, using setprecision manipulators to print all these values with different number of digits after the decimal number.
What are the advantages and disadvantages of using templates?
Suppose a program has a math class having only one data member number.
Write the declaration and definition of operator function to overload + operator for the statements of main function.
math obj1, obj2;
obj2= 10 + obj1 ;
Saturday, July 2, 2011
STA301 Final Term Past Paper 3
FINALTERM EXAMINATION
STA301- Statistics and Probability (Session - 4)
Question No: 1 ( Marks: 1 ) - Please choose one
► Mutually exclusive
► Equally likely
► Not mutually exclusive
► Exhaustive
Question No: 2 ( Marks: 1 ) - Please choose one
► 
► 

► 
► 
Question No: 3 ( Marks: 1 ) - Please choose one
► Rejected
► Accepted
► No conclusion
► Acknowledged
Question No: 4 ( Marks: 1 ) - Please choose one
► Variances
► Means
► Proportions
► Groups
Question No: 5 ( Marks: 1 ) - Please choose one
► Helmert
► Pearson
► R.A Fisher
► Francis
Question No: 6 ( Marks: 1 ) - Please choose one
► Z-test PROPORTIONS ARE TESTED AND MEAN
► t-Test MEAN IS TESTED
► Both Z & T-test
► F test VARIANCE AND STANDARD DEVIATION
Question No: 7 ( Marks: 1 ) - Please choose one
► 0,1,2,3
► 1,3,3,1
► 1, 2, 3
► 3, 2
Question No: 8 ( Marks: 1 ) - Please choose one
► E(XX)
► E(X).E(Y)
► X.E(Y)
► Y.E(X)
Question No: 9 ( Marks: 1 ) - Please choose one
► x & n
► x & p
► n & p
► x, n & p
Question No: 10 ( Marks: 1 ) - Please choose one
► P(E)= - 1 ROBIBILITY SHOULD NEVER BE NEGATIVE AND NOT BE GREATER THAN ONE
► P(E)=1
► P(E)=1/2
► P(E)=1/3
Question No: 11 ( Marks: 1 ) - Please choose one
► E (T) =
EXPECTION OF STATISTIC IS EQUAL TO PARAMETER THAT IS ESTIMATED THEN STATISTIC IS CALLED UNBIASED OTHER WISE BIASED.
► E (T) =T
► E (T) =0
► E (T) =1
Question No: 12 ( Marks: 1 ) - Please choose one
► Sample mean
► Sample median
► Sample proportion
► Sample variance
Question No: 13 ( Marks: 1 ) - Please choose one
► Unbiased estimator of 
► Biased estimator of 
IF IT IS DI VIDED BY N-1 THEN IT IS CALLED UNBIASED OTHER WISE BIASED
► Unbiased estimator of 
► None of these
Question No: 14 ( Marks: 1 ) - Please choose one
1
0
c
-c
► 0
► 1
► c THE EXPECTION OF A CONSTATNT IS ALWAYS CONSTANT
► -c
Question No: 15 ( Marks: 1 ) - Please choose one
► 
► 

► 
► 
Question No: 16 ( Marks: 1 ) - Please choose one
► Comparing F distributions
► Comparing three or more means
► Measuring sampling error
► Comparing variances
Question No: 17 ( Marks: 1 ) - Please choose one
► The sample size is at least 5
► Both nP and n (1-P) are at least 30
► A continuous distribution is used to approximate a discrete distribution
► The standard normal distribution is applied
Question No: 18 ( Marks: 1 ) - Please choose one
► Equal to 100
► Greater Than 100
► Less than 100
► In all situations
Question No: 19 ( Marks: 1 ) - Please choose one
► Descriptive Statistics
► Advance Statistics
► Inferential Statistics
► Sampled Statistics
Question No: 20 ( Marks: 1 ) - Please choose one
► Classification
► Tabulation
► Bar chart
► Component bar chart
Question No: 21 ( Marks: 1 ) - Please choose one
► 
► 
► 
► 
Question No: 22 ( Marks: 1 ) - Please choose one
► 1
► 2
► 3
► 0
Question No: 23 ( Marks: 1 ) - Please choose one
► Ogive
► Frequency polygon
► Frequency curve
► Historigram
Question No: 24 ( Marks: 1 ) - Please choose one
► It must be a large number of values
► It must refer to people
► It is a collection of individuals, objects, or measurements
► It is small part of whole
Question No: 25 ( Marks: 1 ) - Please choose one
► 1
► 2
► 3
► 4
Question No: 26 ( Marks: 1 ) - Please choose one
► The regression line will pass through the origin
► The regression line will pass through the point (0,10).
► The regression line will pass through the point (0,-10).
► The slope of the line will also be equal to 0.
Question No: 27 ( Marks: 1 ) - Please choose one
► 5
► 8
► 9 n-1
► 10
Question No: 28 ( Marks: 1 ) - Please choose one
► Null hypothesis is true
It is shown by h0 and first we assumption is h0
► Alternative hypothesis is true
► Sample size is large
► Population is normal
Question No: 29 ( Marks: 1 ) - Please choose one
► Type I error
► Type II error
► Correct decision
► No information regarding student exams
Question No: 30 ( Marks: 1 ) - Please choose one
► f(0, 0) + f(0, 1) + f(1, 2)
► f(2, 0) + f(0, 1) + f(1, 0)
► f(0, 0) + f(1, 1) + f(1, 0)
► f(0, 0) + f(0, 1) + f(1, 0)
Question No: 31 ( Marks: 2 )
Three N n k
Poission mean is np and variance and mean are equal
Question No: 32 ( Marks: 2 )
Question No: 33 ( Marks: 2 )
Question No: 34 ( Marks: 3 )
3.37
Question No: 35 ( Marks: 3 )
Question No: 36 ( Marks: 3 )
Find
,where n = 10
= p1q1/n1+p2q2/n2
Question No: 37 ( Marks: 5 )
At the 0.05 significance level, test the following
Book Example # 16.17 on Page 155
Professor sher Muhammad Chaudhry
Question No: 38 ( Marks: 5 )
Question No: 39 ( Marks: 5 )

F(
| ||||
0
|
1/20
| |||
1/3
|
9/20
| |||
2/3
|
9/20
| |||
1
|
1/20
| |||
1
|
Mean=
Variance=
Subscribe to:
Posts (Atom)































