Its not compulsory, only min we have one generic data type but we can have native data type as well.View more random threads:
- Eng301 VU Midterm Current Papers Spring May 2012 of Virtual...
- Mgt603 VU Midterm Current Papers Spring May 2012 of Virtual...
- Fin621 VU Midterm Current Papers Spring May 2012 of Virtual...
- cs403 database management final term paper preparation...
- Fin623 VU Midterm Current Papers Spring May 2012 of...
- CS504 Midterm Current Papers Spring May2012 Virtual...
- Mgt603 VU Midterm Current Papers Spring May2012 of Virtual...
- Mgt402 VU Midterm Current Papers Spring 17th May 2012...
- Mgt610 VU Midterm Current Papers Spring May 2012 of Virtual...
- MGT 603 CURRENT PAPER spring May 2012 virtual university...
Question No: 12 ( Marks: 1 ) - Please choose one
Template class can not have static variables.
► True
► False
Question No: 13 ( Marks: 1 ) - Please choose one
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] ;
Question No: 14 ( Marks: 1 ) - Please choose one
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
try this demo program to confirm result I wrote for you.
2 option will print the reference rest 1,3 are righ options
#include
#include
// #include
main()
{
int myarr [4]= {0,1,2,3};
int *ptr ;
ptr = myarr;
cout<
cout<<*(ptr+3);
cout<<(ptr+3);
int i = 0;
cin>> i;
}
Question No: 15 ( Marks: 1 ) - Please choose one
If most significant bit of un-signed number is 1 then it represents a positive number.
► True
► False
The most significant bit is used as a sign bit. If this bit is zero, the number is considered positive. However, if it is 1, the number will be considered negative.
Question No: 16 ( Marks: 1 ) - Please choose one
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 see a data type followed by & sign, it’s a reference. And when the & sign is being used in the code with a variable name then it is the address of the variable
Question No: 17 ( Marks: 1 ) - Please choose one
We can also do conditional compilation with preprocessor directives.
► True
► False
Question No: 18 ( Marks: 1 ) - Please choose one
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.
The default value of a parameter is provided inside the function prototype or function definition.
Question No: 19 ( Marks: 1 ) - Please choose one
Classes defined inside other classes are called ________ classes
► looped
► nested
► overloaded
► none of the given options.
Question No: 20 ( Marks: 1 ) - Please choose one
What purpose do classes serve?
► Data encapsulation
► Providing a convenient way of modeling real-world objects
► Simplifying code reuse
► All of the given options
Question No: 21 ( Marks: 1 ) - Please choose one
vuzs
Every class contains _______________.
► Constructor
► Destructor
► Both a constructor and a destructor
► None of the given options
Question No: 22 ( Marks: 1 ) - Please choose one
new operator is used to allocate memory from the free store during
► Compile Time
► Run Time
► Link Time
► None of the given options
Question No: 23 ( Marks: 1 ) - Please choose one
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
Question No: 24 ( Marks: 1 ) - Please choose one
It is possible to define a class within another class.
► True
► False
Question No: 25 ( Marks: 1 ) - Please choose one
New and Delete are also used with ___________ and data types as well.
► Class, Objects
► Structures, Pointers
► Both Class and structures
► None of above
we prefer to use new and delete operators as they are designed to work with classes and objects
Question No: 26 ( Marks: 1 ) - Please choose one
With New keyword, data types and class members are initialized with meaningful values instead of garbage.
vuZs Virtual University Community |VU Papers | MCQs | Quiz | Assignments | GDB
► True
► False
Question No: 27 ( Marks: 2 )
How many arguments a Unary Operator take? Can we make a binary operator as unary operator?
Ans: Unary operator takes only one aurgument like i++ or i— (Post increment or post decrement operators for intergers) or ++i,--i (Pre increment or pre decrement operators for intergers) ,we can not make Unary operator as binary or binary as Unary operator.
Question No: 28 ( Marks: 2 )
Which arithmetic operators cannot have a floating point operand?
Ans:
Modulus operator
This operator can only be used with integer operands ONLY
Question No: 29 ( Marks: 2 )
What are manipulators? Give one example.
Ans:
The manipulators are like something that can be inserted into stream, effecting a change in the behavior. For example, if we have a floating point number, say pi (л), and have written it as float pi = 3.1415926 ; Now there is need of printing the value of pi up to two decimal places i.e. 3.14 . This is a formatting functionality. For this, we have a manipulator that tells about width and number of decimal points of a number being printed.
Some manipulators are parameter less. We simply use the name of the manipulator that works. For example, we have been using endl, which is actually a manipulator, not data. When we write cout << endl ; a new line is output besides flushing the buffer. Actually, it manipulates the output stream.
Question No: 30 ( Marks: 2 )
Write down piece of code that will declare a matrix of 3x3. And initialize all its locations with 0;
Ans:
int matrix [3] [3] ;
matrix [0] [0] = 0;
matrix [0] [1] = 0;
matrix [0] [2] = 0;
matrix [1] [0] = 0;
matrix [1] [2] = 0;
matrix [1] [2] = 0;
matrix [2] [0] = 0;
matrix [2] [1] = 0;
matrix [2] [2] = 0;
we can also do it as given below
int matrix [3][3] = { 0 }; //all elements 0
Question No: 31 ( Marks: 3 )
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;
Ans:
1) Matrix m1 (m2); copy constructor
2) Matrix m1, m2;
m1 = m2; assignment operator
Sponsored Links
There are currently 1 users browsing this thread. (0 members and 1 guests)