Sponsored Links


Results 1 to 2 of 2

Thread: CS201- Introduction to Programming

  1. #1
    Senior Member Awais's Avatar
    Join Date
    May 2010
    Posts
    111

    CS201- Introduction to Programming

    Sponsored Links


    FINALTERM EXAMINATION

    Fall 2009

    CS201- Introduction to Programming


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


    In C/C++ if we define an array of size eight (8) i.e. int Arr [8]; then the last element of this array will be stored at,

    ► Arr[0]

    ► Arr[8]

    ► Arr[7]

    ► Arr[-1]

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

    When an array is passed to a function then default way of passing this array is,

    ► By data

    ► By reference

    ► By value

    ► By data type


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


    Array is a data structure which store

    ► Memory addresses

    ► Variables

    ► Data Type

    ► Data


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


    We can also create an array of user define data type.


    ► True

    ► False

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


    When we define an array of objects then,


    ► Destructor will call once for whole array


    ► Destructor will call for each object of the array


    ► Destructor will never call


    ► Depends on the size of array


    Question No: 6 ( 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: 7 ( Marks: 1 ) - Please choose one

    Sponsored Links



    We can delete an array of objects without specifying [] brackets if a class is not doing dynamic memory allocation internally.


    ► True

    ► False

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


    The second parameter of operator functions for << and >> are objects of the class for which we are overloading these operators.



    ► True

    ► False

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

    Which of the following is correct way to initialize a variable x of int type with value 10?


    ► int x ; x = 10 ;

    ► int x = 10 ;

    ► int x, x = 10;

    ► x = 10 ;

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

    Default mechanism of function calling in case of array is _____ and in case of variable is ___.

    ► Call by value, call by reference


    ► Call by referene, call by reference


    ► Call by reference, call by value


    ► Call by value, call by value

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

    What does STL stand for?



    ► Source template library


    ► Standard template library


    ► Stream template library


    ► Standard temporary library

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

    Skill(s) that is/are needed by programmers _______________________.

    ► Paying attention to detail

    ► Think about the reusability

    ► Think about user interface

    ► All of the given options

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

    For which array, the size of the array should be one more than the number of elements in an array?


    ► int

    ► double

    ► float

    ► char

    Question No: 14 ( Marks: 1 ) - Please choose one
    new and delete are _____ whereas malloc and free are _____.

    ► Functions, operators

    ► Classes, operators

    ► Operators, functions

    ►perators, classes

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

    Friend functions are _____ of a class.

    ► Member functions

    ► Public member functions

    ► Private member functions

    ► Non-member functions

    Question No: 16 ( Marks: 1 ) - Please choose one
    he prototype of friend functions must be written ____ the class and its definition must be written ____

    ► inside, inside the class

    ► inside, outside the class

    ► outside, inside the class

    ► outside, outside the class

    Question No: 17 ( Marks: 1 ) - Please choose one
    If overloaded plus operator is implemented as non-member function then which of the following statement will be true for the statement given below? obj3 = obj1 + obj2 ;
    ► obj2 will be passed as an argument to + operator whereas obj2 will drive the + operator

    ► obj1 will drive the + operator whereas obj2 will be passed as an argument to + operator

    ► Both objects (obj1, obj2) will be passed as arguments to the + operator

    ► Any of the objects (obj1, obj2) can drive the + operator
    Question No: 18 ( 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: 19 ( Marks: 1 ) - Please choose one
    For cin, the source is normally a ________ and destination can be ______.

    ► File, native data type

    ► Disk, user-define type

    ► Keyboard, variable

    ► File, user-define type

    Question No: 20 ( Marks: 1 ) - Please choose one
    We can also do conditional compilation with preprocessor directives.

    ► True

    ► False
    Question No: 21 ( Marks: 1 ) - Please choose one
    The programs, in which we allocate static memory, run essentially on ________

    ► Heap

    ► System Cache

    ► None of the given options

    ► Stack

    Question No: 22 ( 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.
    Question No: 23 ( Marks: 1 ) - Please choose one
    While calling function, the arguments are assigned to the parameters from _____________.

    ► left to right.
    ► right to left

    ► no specific order is followed

    ► none of the given options.

    Question No: 24 ( Marks: 1 ) - Please choose one
    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
    Question No: 25 ( Marks: 1 ) - Please choose one
    With user-defined data type variables (Objects), self assignment can produce __________.
    ► Syntax error
    ► Logical error
    ► Link error
    ► Non of the given options
    Question No: 26 ( Marks: 1 ) - Please choose one
    Assignment operator is used to initialize a newly declared object from existing object.

    ► True

    ► False
    Question No: 27 ( Marks: 1 ) - Please choose one
    When an object of a class is defined inside an other class then,
    ► Constructor of enclosing class will be called first
    ► Cnstructor of inner object will be called first
    ► Constructor and Destructor will be called simultaneously
    ► None of the given options
    Question No: 28 ( Marks: 1 ) - Please choose one
    In the member initializer list, the data members are initialized,
    ► From left to right
    ► From right to left
    ► In the order in which they are defined within class
    ► None of the given options
    Question No: 29 ( Marks: 1 ) - Please choose one
    new operator allocates memory from free store and return _____________.
    ► A pointer

    ► A reference
    ► An integer
    ► A float
    Question No: 30 ( Marks: 1 ) - Please choose one


    "new" and "delete" keywords are _____________ in C++ language.


    ► Built-in- Function


    ► Operators


    ► Memory Allocation Function


    ► None of the given options






    Question No: 31 ( Marks: 1 )


    What is a constructor in class?

    Ans:
    Class constructor, is the method specific to a type as a whole that run after the type is loaded and before any of the type's members are accessed. Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention. Normally, class constructors are never called from the IL code. If a type has a class constructor, this constructor is executed automatically after the type is loaded. However, a class constructor, like any other static method, can be called explicitly. As a result of such a call, the global fields of the type are reset to their initial values. Calling class constructor explicitly does not lead to type reloading.


    Question No: 32 ( Marks: 1 )


    What are the two types of conversion for user-defined data types?



    Question No: 33 ( Marks: 2 )


    Is there a way to increase the size of already allocated memory chunk ? Can the same chunk be increased or not?

    Ans:




    Question No: 34 ( Marks: 2 )


    Give the general syntax of class template.


    Question No: 35 ( Marks: 3 )


    What is the difference between structure and class?


    Question No: 36 ( Marks: 3 )


    How many arguments does binary member operator function and binary non-member operator function take?

    Question No: 37 ( Marks: 3 )


    Find the error in the given code
    for ( int i=0; i<numRows; i++)
    {
    for(int j=0; j<numCols; j++)
    {
    elements[i , j] = m.elements[j];
    }
    }




    Question No: 38 ( Marks: 5 )


    Write the C++ syntax for making a class friend of other class.



    Question No: 39 ( Marks: 5 )


    What is a template function? Give the general syntax of writing a template function.


    Question No: 40 ( Marks: 10 )

    [JUSTIFY]Write a program which contains a class student. The class should contain two char pointer variables Name, and department. The class should further contain constructors, overload the stream insertion operator (<<) for this class.


    In main function create two objects and display these objects.

  2. #2
    PLZ answer this post ....<!!>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 01-25-2011, 04:31 PM
  2. CS201 - Introduction to Programming
    By Xpert in forum Virtual University Announcenments
    Replies: 0
    Last Post: 01-12-2011, 04:11 PM
  3. Replies: 0
    Last Post: 05-16-2010, 05:26 AM
  4. CS201 Introduction to Programming Assignment 3 May13,2010
    By viki in forum Assignments & Solutions
    Replies: 0
    Last Post: 05-13-2010, 10:43 PM
  5. CS201 Introduction to Programming papers
    By viki in forum MCQ's & Quiz Discussion
    Replies: 0
    Last Post: 05-10-2010, 10:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft