Monday, July 4, 2011

Good After Noon Pic

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);
}

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
 When each outcome of a sample space has equal chance to occur as any other, the outcomes are called:
       ► Mutually exclusive
       ► Equally likely
       ► Not mutually exclusive
       ► Exhaustive
   
Question No: 2    ( Marks: 1 )    - Please choose one
 The mean of the F-distribution is:


       ►
       ►
       ►
       ►
   
Question No: 3    ( Marks: 1 )    - Please choose one
 The LSD test is applied only if the null hypothesis is:

       ► Rejected
       ► Accepted
       ► No conclusion
       ► Acknowledged
   




Question No: 4    ( Marks: 1 )    - Please choose one
 Analysis of variance is a procedure that enables us to test the equality of several:

       ► Variances
       ► Means
       ► Proportions
       ► Groups
   
Question No: 5    ( Marks: 1 )    - Please choose one
 ANOVA was introduced by :

       ► Helmert
       ► Pearson
       ► R.A Fisher
       ► Francis
   
Question No: 6    ( Marks: 1 )    - Please choose one
 For testing of hypothesis about population proportion , we use:

       ► 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
 If a random variable X denotes the number of heads when three distinct coins are tossed, the X assumed the values:

       ► 0,1,2,3
       ► 1,3,3,1
       ► 1, 2, 3
       ► 3, 2
   
Question No: 8    ( Marks: 1 )    - Please choose one
 If X and Y are independent variables, then E (XY) is:

       ► E(XX)
       ► E(X).E(Y)
       ► X.E(Y)
       ► Y.E(X)

   
Question No: 9    ( Marks: 1 )    - Please choose one
 The parameters of the binomial distribution b(x; n, p) are:

       ► x & n
       ► x & p
       ► n & p
       ► x, n & p

   
Question No: 10    ( Marks: 1 )    - Please choose one
 If P (E) is the probability that an event will occur, which of the following must be false:
       ► 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
 An estimator T is said to be unbiased estimator of  if

       ► 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
 The best unbiased estimator for population variance  is:

       ► Sample mean

       ► Sample median

       ► Sample proportion

       ► Sample variance

   
Question No: 13    ( Marks: 1 )    - Please choose one
 The sample variance  is:

       ► 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
 When c is a constant, then E(c) is:

1
0
c
-c

       ► 0
       ► 1
       ► c THE EXPECTION OF A CONSTATNT IS ALWAYS CONSTANT
       ► -c
   
Question No: 15    ( Marks: 1 )    - Please choose one
 If f (x, y) is bivariate probability density function of continuous r.v.'s X and Y then
 is:





       ►
       ►
       ►
       ►
   
Question No: 16    ( Marks: 1 )    - Please choose one
 The analysis of variance technique is a method for :

       ► Comparing F distributions
       ► Comparing three or more means
       ► Measuring sampling error
       ► Comparing variances
    
Question No: 17    ( Marks: 1 )    - Please choose one
 The continuity correction factor is used when:

       ► 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
 Stem and leaf is more informative when data is :
       ► Equal to 100

       ► Greater Than 100

       ► Less than 100

       ► In all situations

   
Question No: 19    ( Marks: 1 )    - Please choose one
 The branch of Statistics that is concerned with the procedures and methodology for obtaining valid conclusions is called:

       ► Descriptive Statistics
       ► Advance Statistics
       ► Inferential Statistics

       ► Sampled Statistics
   
Question No: 20    ( Marks: 1 )    - Please choose one
 Which of the following is a systematic arrangement of data into rows and columns?
       ► Classification
       ► Tabulation
       ► Bar chart
       ► Component bar chart
   
Question No: 21    ( Marks: 1 )    - Please choose one
 In normal distribution Q.D =





       ►
       ►
       ►
       ►
   
Question No: 22    ( Marks: 1 )    - Please choose one
 In normal distribution

       ► 1
       ► 2
       ► 3
       ► 0
   
Question No: 23    ( Marks: 1 )    - Please choose one
 If you connect the mid-points of rectangles in a histogram by a series of lines that also touches the x-axis from both ends, what will you get?

       ► Ogive
       ► Frequency polygon
       ► Frequency curve
       ► Historigram
   
Question No: 24    ( Marks: 1 )    - Please choose one
 Which one of the following statements is true regarding a population?
       ► 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
 When ,what is the value of Median, if the distribution is symmetrical:

       ► 1
       ► 2
       ► 3
       ► 4
   
Question No: 26    ( Marks: 1 )    - Please choose one
 In a simple linear regression model, if it is assumed that the intercept parameter is equal to zero, then:
       ►     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
 The degrees of freedom for a t-test with sample size 10 is:

       ► 5
       ► 8
       ► 9 n-1
       ► 10
   
Question No: 28    ( Marks: 1 )    - Please choose one
 In testing of  hypothesis, we always begin it with assuming that:

       ► 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
 A failing student is passed by an examiner is an example of:

       ► Type I error

       ► Type II error

       ► Correct decision

       ► No information regarding student exams

   
Question No: 30    ( Marks: 1 )    - Please choose one
 How to find?
       ► 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 )
 How many parameters are involved in hypergeometric distribution?

Three N n k

Poission mean is np and variance and mean are equal

   
Question No: 32    ( Marks: 2 )
 If an automobile is driven on the average no more than 16000 Km per year, then formulate the null and alternative hypothesis.



   
Question No: 33    ( Marks: 2 )
 Write down the test statistic when chi- square goodness of fit test is performed.            

   
Question No: 34    ( Marks: 3 )
 Find the value of  F(table value), when ,  and α= 0.05         

3.37                         

   
Question No: 35    ( Marks: 3 )
 If X = 327, n = 634, 0.50 then find the z-test statistic for proportion.

   
Question No: 36    ( Marks: 3 )
 If population proportions are given as:






Find    ,where n = 10
   
= p1q1/n1+p2q2/n2
Question No: 37    ( Marks: 5 )
 A candidate for mayor in a large city hires the services of a poll-taking organization, and they found that 62 of 100 educated voters interviewed support the candidate, and 69 of 150 uneducated voters support him.
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 )
 If we have RCBD with MSE=3.19, no.of.treatments = 4, no.of.blocks = 5; then find the value of LSD (least significant difference) for treatments by using α=0.05 and error degrees of freedom is 12.

   
Question No: 39    ( Marks: 5 )
 Find the mean and variance for the sampling distribution given below.


F()
F()
 F()
0
1/20



1/3
9/20



2/3
9/20



1
1/20



1









Mean=

Variance=

Contact Form

Name

Email *

Message *