php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cs201 Introduction to Programming final term solve paper January 2012
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#4
FINALTERM EXAMINATION

Fall 2008

CS201- Introduction to Programming

Time: 120 min Marks: 75



Question No: 1 ( Marks: 1 ) - Please choose one

There are mainly -------------------- types of software

► Two

► Three

► Four

► Five

Question No: 2 ( Marks: 1 ) - Please choose one

seekg() and write() are functionally _________________ .

► Different

► Identical

► Two names of same function

► None of the above

Question No: 3 ( Marks: 1 ) - Please choose one

When a pointer is incremented, it actually jumps the number of memory addresses

► According to data type

► 1 byte exactly

► 1 bit exactly

► A pointer variable can not be incremented

Question No: 4 ( Marks: 1 ) - Please choose one

setw is a parameterized manipulator.

► True

► False

Question No: 5 ( Marks: 1 ) - Please choose one

eof( ), bad( ), good( ), clear( ) all are manipulators.

► True

► False

Question No: 6 ( Marks: 1 ) - Please choose one

In functions that return reference, use __________variables.

► Local

► Global

► Global or static

► None of the given option

Question No: 7 ( Marks: 1 ) - Please choose one

The declarator of Plus (+) member operator function is

► Class-Name operator + (Class-Name rhs)

► operator Class-Name + ( )

► operator Class-Name + ( rhs)

► Class-Name operator + ( )

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

The compiler does not provide a copy constructor if we do not provide it.

► True

► False


Question No: 9 ( Marks: 1 ) - Please choose one

What is the functionality of the following syntax to delete an array of 5 objects named arr allocated using new operator?

delete arr ;

► Deletes all the objects of array

► Deletes one object of array

► Do not delete any object

► Results into syntax error

Question No: 10 ( Marks: 1 ) - Please choose one

What is the sequence of event(s) when allocating memory using new operator?

► Only block of memory is allocated for objects

► Only constructor is called for objects

► Memory is allocated first before calling constructor

► Constructor is called first before allocating memory

Question No: 11 ( Marks: 1 ) - Please choose one

What is the sequence of event(s) when deallocating memory using delete operator?

► Only block of memory is deallocated for objects

► Only destructor is called for objects

► Memory is deallocated first before calling destructor

► Destructor is called first before deallocating memory

Question No: 12 ( Marks: 1 ) - Please choose one

new and delete operators cannot be overloaded as member functions.

► True

► False

Question No: 13 ( Marks: 1 ) - Please choose one

The operator function of and >> operators are always the member function of a class.

► True

► False

Question No: 14 ( Marks: 1 ) - Please choose one

A template function must have at least ---------- generic data type

► Zero

► One

► Two

► Three

Question No: 15 ( Marks: 1 ) - Please choose one

If we do not mention any return_value_type with a function, it will return an _____ value.

► int

► void

► double

► float

Such function which do not return any value are called:

► int

► void

► double

► float


Question No: 16 ( Marks: 1 ) - Please choose one

Suppose a program contains an array declared as int arr[100]; what will be the size of array?

► 0

► 99

► 100

► 101

Question No: 17 ( Marks: 1 ) - Please choose one

The name of an array represents address of first location of array element.

► True

► False

Question No: 18 ( Marks: 1 ) - Please choose one

Reusing the variables in program helps to save the memory

► True

► False

Question No: 19 ( Marks: 1 ) - Please choose one

Which of the following option is true about new operator to dynamically allocate memory to an object?

► The new operator determines the size of an object

► Allocates memory to object and returns pointer of valid type

► Creates an object and calls the constructor to initialize the object

► All of the given options

Question No: 20 ( Marks: 1 ) - Please choose one

new and delete are _____ whereas malloc and free are _____.

► Functions, operators

► Classes, operators

► Operators, functions

► Operators, classes

Question No: 21 ( Marks: 1 ) - Please choose one

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

Question No: 22 ( Marks: 1 ) - Please choose one

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.

Question No: 23 ( Marks: 1 ) - Please choose one

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


Question No: 24 ( Marks: 1 ) - Please choose one

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

Question No: 25 ( Marks: 1 ) - Please choose one

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

Question No: 26 ( Marks: 1 ) - Please choose one

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

Question No: 27 ( Marks: 1 ) - Please choose one

The static data members of a class are initialized _______

► at file scope

► within class definition

► within member function

► within main function

Question No: 28 ( Marks: 1 ) - Please choose one

Class is a user defined___________.

► data type

► memory referee

► value

► none of the given options.

Question No: 29 ( Marks: 1 ) - Please choose one

We can also define a user-defines manipulators.

► True

► False

Question No: 30 ( Marks: 1 ) - Please choose one

Automatic variable are created on ________.

► Heap

► Free store

► static storage

► stack

Question No: 31 ( Marks: 1 )

How do we provide the default values of function parameters?



Answer: The default value of a parameter is provided inside the function prototype or function definition. For example, we could declare the default function arguments for a function while declaring or defining it.



Question No: 32 ( Marks: 1 )

Why do java consider pointer as dangerous

Answer:

The concept of pointers is very important but quite limited to C and C++. The modern languages, for example JAVA, describe pointers as dangerous. We can go anywhere in the memory and can change a value. There is another problem with pointers, which is that these could be pointing to nowhere.



Question No: 33 ( Marks: 2 )

What is memory leak?

Answer: size. When there is no memory on heap, the computer will stop running and there may be a system crash. This situation is called a memory leak.



Question No: 34 ( Marks: 2 )

What does optimization the of code means?

Answer:

Header file is a nice mechanism to put function prototypes and define constants (global constants) in a single file. That file can be included simply with a single line of code.



Question No: 35 ( Marks: 3 )

What is the difference between structure and class?
Answer:

In structures, some data variables are gathered, grouped and named as a single entity. Class and structure are very closely related. In classes, we group some data variables and functions. These functions normally manipulate these variables. Before going ahead, it is better to understand what a class is: “A class includes both data members as well as functions to manipulate that data”



Question No: 36 ( Marks: 3 )

See the following code segment.

template <class T>

class myclass {

private:

T x;

public:

myclass (T a) {

x = a;

}

};

Write the main function which creates two objects of class for int and double data types.

Question No: 37 ( Marks: 3 )

Is it possible to define two functions as given below? Justify your answer.

func(int x, int y)

func(int &x, int &y)

Solution:

No, it is impossible to define two functions as in the main function the way to call both functions is same. How does the compiler know that which functions is being called? There is no way for the compiler to find out. Therefore there is an ambiguity and that is not allowed. The only thing to realize is the side effect. Side effects are critical to take care of whenever you are doing call by reference.



Question No: 38 ( Marks: 5 )

Write a program using getline() member function to inputs a string up to delimiter character comma (,) and then display the string on the screen.

Question No: 39 ( Marks: 5 )



Do you think that friend functions violate encapsulation? Justify your answer.

Answer:

The friend functions of a class have access to the private data members of class. Despite being a good thing, there is possibility of vulnerability. We are opening our thoughts, inside view for somebody else. Without having 100% trust, it will be risky to make our thoughts and feelings public. We want that our private data is accessible to someone outside, not public for everybody. Otherwise, the data encapsulation and data-hiding concept will be violated. We keep the data members private and declare some specific functions that are not member of the class but friend of the class. As friends, they have access to the inside data structure of the class despite not being members.



Question No: 40 (Marks: 10 )





Write a simple program using the get() member function of cin object reading a text of 30 characters from the keyboard, store them in an array and then using put() member function of cout object to display them on the screen.



Question No: 41 (Marks: 10 )





Write a small program which defines two user-defined manipulators named octal and hexadecimal. These manipulators should display the decimal numbers into octal and hexadecimal.

In the main function, input a decimal number from the user and then display this decimal number into octal and hexadecimal using user-define manipulators named octal and hexadecimal.



0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Messages In This Thread
cs201 Introduction to Programming final term solve paper January 2012 - by Vuhelper - 01-15-2012, 05:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VU Mid Term and Final Term Solved Papers: How to Use Past Papers Without Relying on T admin 0 21 11-03-2026, 05:24 PM
Last Post: admin
  MCM301 MIDTERM solve paper 2011 Vuhelper 4 24,832 03-07-2015, 04:34 PM
Last Post: Xpert
  mgt602 midterm paper 3000 mcq's Xpert 5 11,422 05-30-2013, 02:16 PM
Last Post: Vuhelper
  All Solved Past Papers Mid & Final Term 2008 And 2009 viki 19 16,112 06-09-2012, 05:38 PM
Last Post: gr8touchstone@hotmail.com
  MID TERM PAST PAPER CS401 - Computer Architecture and Assembly SOLVE AND UNSOLVED usmanali126 2 6,439 04-13-2012, 03:27 PM
Last Post: Xpert
  Solved Paper MGT101 Fall 2009 Final Term viki 12 55,783 02-07-2012, 10:52 PM
Last Post: Xpert
  CS304 final term current paper spring Jily 2011 Vuhelper 1 3,565 02-04-2012, 10:34 PM
Last Post: roshi786
  Solved Paper of Final Term 2009 MTH101 Calculus And Analytical Geometry viki 8 12,086 02-04-2012, 12:47 AM
Last Post: Xpert
  CS101 Introduction to Computing FINAL TERM PAPERS SOLVED MCQS January 2012 Vuhelper 2 7,134 02-04-2012, 12:46 AM
Last Post: Xpert
  eng 201 final term paper Business and Technical English Writing January 2012 Vuhelper 3 7,322 01-30-2012, 06:52 PM
Last Post: Xpert

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support