Sponsored Links


+ Reply to Thread
Results 1 to 1 of 1

Thread: cs201 Introduction to Programming final term solve mega files paper 2012

  1. #1
    Super Moderator Vuhelper's Avatar Users Flag!
    Join Date
    Apr 2011
    Posts
    7,773

    18 cs201 Introduction to Programming final term solve mega files paper 2012

    Sponsored Links


    Its not compulsory, only min we have one generic data type but we can have native data type as well.

    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.
    Only the registered members can see the link. Register here
    ► 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
    Attached Files
      Please register or login to download the attachments.

+ Reply to Thread

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: 02-03-2012, 03:15 PM
  2. Replies: 0
    Last Post: 01-15-2012, 05:18 PM
  3. Replies: 3
    Last Post: 01-15-2012, 12:50 PM
  4. Replies: 0
    Last Post: 07-09-2011, 04:40 PM
  5. Replies: 0
    Last Post: 08-16-2010, 12:29 AM

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.
Pknews |Vugurus|Online Education