CS201 Introduction To Programming Online Solved MCQ's Quizzes File 1



The function overloading
requires __________________ .
Select correct option :
no arguments
the argument list to be the same
the arguments of integer type only
the argument list to be different .

In if structure the block of
statements is executed only ,
1 . Type letters
2 . When it contain arithmetic operators
3 . When it contain logical operators
4 . When the condition is true

suppose we have int y[10]; To access the 4th element of the array we write_______

y[4];
y[3];
y[2];
none of given
From the following; which one is the range of Random number generator function rand()?
0 – 32768
1 – 32768
0 – 32767
1 – 32767


What is the output of the following statement?int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
(a) 510
(b) 5
(c) 48
(d) error

To access the data members of structure _______ is used.
       ► dot operator (.) 
       ► * operator
       ► à operator
       ► None of given.
  
Question No: 2    ( M - 1 )    .
 What does 5 ^ 6 , evaluate to in decimal where ‘^’ is Exclusive OR operator?
       ► 1
       ► 2
       ► 3
       ► 4
   
Question No: 3    ( M - 1 )    .
 If constructor contains a return statement in its body then compiler will give __________
       ► No error
       ► Syntax error
       ► Logical error
       ► Run time error
   
Question No: 4    ( M - 1 )    .
  We can use New keyword inside of Class Constructor. 
        ►True
        False
Question No: 2 ( Marks: 1 ) - Please choose one
What does !(7) evaluate to in decimal where ! is a NOT operator?(a) 7(b) 8
(c) 9
(d) 10

Question No: 3 ( Marks: 1 ) - Please choose one
The condition in while loop may contain logical expression but not relational expression.(a) True
(b) False


From following; which one is the correct syntax of an array initialize: Array size is 10 and it is of double data type to value 0?
arr[10] = {0.0};
double arr[10]= 0.0;
double arr[10] = {0.0};
double arr[] = 0.0;
The string in the array is terminated by a_____
zero
nil
null
one


What will be the output of the given
code ? # include # define MAX ( A , B )
(( A) > ( B ) ? (A ) : (B )) void main ()
{ int i , x , y; x = 23 ; y = 45 ; i = MAX ( x
+ + , y+ + ); / / Side - effect : // larger
value incremented twice cout " x = " x "
y = " y '\n '; }
Select correct option :
x = 23 y = 45
x = 24 y = 46
x = 24 y = 47
x = 22 y = 47


When an operator function is define as member function for a Unary operator then the number of argument it take is/are,
        ►Zero
        One
        Two
        N arguments
  
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: 7    ( M - 1 )    .
 Friend function of a class is ______________ .         ►Member function         ►Non-member function                          ►Private function         ►Public function     

Computer can do ,
1 . More than what we tell it
2 . Less then what we tell it
3 . Like human being
4 . Exactly what we tell it


we can control our program while it
is running by using
1 . Debugger
2 . Linker
3 . Loader
4 . Editor

Searching is easier when an array is already sorted(a) True(b) False
Question No: 5 ( Marks: 1 ) - Please choose one
If an array has 100 elements, what is allowable range of subscripts?(a) 0 - 99(b) 1 - 99
(c) 0 - 100
(d) 1 - 100

We can also create an array of user define data type.
          True
          ►False
   
Question No: 9    ( M - 1 )    .
 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: 10    ( M - 1 )    .
 Deleting an array of objects without specifying [] brackets may lead to memory leak
          ►True
          ►False
   
Question No: 11    ( M - 1 )    .
 Which of the following data type(s) can operate on modulus operator ‘%’?
         ► float, int
         ► float, double
         ► int
         ► char
  
Question No: 12    ( M - 1 )    .
 Array is passed by value to a function by default.
         ►True
         ►False
   
Question No: 13    ( M - 1 )    .
 With template function, the compiler automatically detects the passed data and generates a new copy of function using passed data.
         ►True
         
False
Question No: 6 ( Marks: 1 ) - Please choose one
What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3;
b = a++;
(a) 3, 4
(b) 4, 4
(c) 3, 3
(d) 4, 3

Unary operator implemented as member function takes ____ arguments whereas non-member function takes _____ arguments.
         One, zero
         ►Zero, one
         ►One, two
         ►Two, one
   
Question No: 22    ( M - 1 )    .
 The input/output streams cin and cout are ________ therefore have _______.
        ► Structures, function
        ► Objects, member functions
        ► Functions, objects
        ► None of the given options
 
Question No: 23    ( M - 1 )    .
 If a symbolic constant has been defined, it will be an error to define it again.
       ► True
       ► False
   
Question No: 24    ( M - 1 )    .
 Every class contains _______________.
       ► Constructor
       ► Destructor
       ► Both a constructor and a destructor
       ► None of the given options
Question No: 7 ( Marks: 1 ) - Please choose one
What will be the correct syntax to initialize all elements of two-dimensional array to value 0?(a) int arr[2][3] = {0,0} ;
(b) int arr[2][3] = {{0},{0}} ;(c) int arr[2][3] = {0},{0} ;
(d) int arr[2][3] = {0} ;

Default constructor generated by
______________does
______________for us .
Select correct option :
compiler , initialization
compiler , no initialization
classes , initialization
main program , memory management

getche () is a _____________ function
and defined in ___________ header
file .
Select correct option :
user- define function , conio .h
built - in function , conio .h
built - in function , stlib . h
built - in function , iostream .h

 Static variable which is defined in a function is initialized __________.
       ► Only once during its life time
       ► Every time the function call
       ► Compile time of the program
       ► None of the above
  
    www.vuzs.info
Question No: 29    ( M - 1 )    .
 Wecan not define a variable of user-defined data type in the class.
      ►True
      ►False
   
Question No: 30    ( M - 1 )    .
 A constructor that will create a new object with a full copy of the other object, is copy is known as ___________
        ►deep copy
        ►shallow copy
        ►constructor copy
        ►none of the options


How many times is a do while loop
guaranteed to loop?
1 . 0
2 . Variable
3 . Infinitely
4 . 1


The heap memory structure
__________.
Select correct option :
remains constant
contains no space
constantly changes in size
is just like stack


Which of the following functionreturns the size of a string variable?(a) strlength()
(b) stringlen()
(c) strlen()(d) strLength()
Question No: 9 ( Marks: 1 ) - Please choose one
What will be the range of numbers generated by function rand () % 9?(a) 0 to 9
(b) 1 to 9
(c) 0 to 8(d) 1 to 8

Operator overloading can be performed through__________________.
        Classes
        Functions
        Operators
        Reference

Question No: 2      ( Marks: 1 ) - Please choose one
When a value is referred by a normal variable then it is known as,
        Direct Reference
          Indirect Reference
        Partial Reference
        Proper Reference
When a value is referred by a normal variable is known as direct reference
Question No: 3      ( Marks: 1 ) - Please choose one
Which of the following function is used to increase the size of already allocated memory chunk?

         malloc   wrong
        calloc
        realloc
        free
Question No: 4      ( Marks: 1 ) - Please choose one
Which of the following is NOT a preprocessor directive?
        #error
        #define
        #line
       ► #ndefine
Question No: 11 ( Marks: 1 ) - Please choose one
Computer can understand only machine language code.(c) True(d) False
Question No: 13 ( Marks: 1 ) - Please choose one
What does 5 ^ 6 , evaluate to in decimal where ‘^’ is Exclusive OR operator?(a) True
(b) False

Question No: 5      ( Marks: 1 ) - Please choose one
The stream objects cin and cout are included in which header file?
          iostream.h
        fstream.h
        istream.h
        ostream.h

Question No: 6      ( Marks: 1 ) - Please choose one
Overloaded delete operator function takes the same parameter as an argument returned by new operator function.
         True
        False

Question No: 7      ( Marks: 1 ) - Please choose one
When an array of object is created dynamically then there is no way to provide parameterized constructors for array of objects.
          True
        False

Question No: 8      ( Marks: 1 ) - Please choose one
C is widely known as development language of _______ operating system.
        Linux
        Windows
          Unix
   Mac OS
Question No: 14 ( Marks: 1 ) - Please choose one
If the file is not properly closed in the program, the program ____________.(a) Terminate normally
(b) Indicate Runtime error
(c) Indicate Compile time error
(d) Crashes


In a NULL pointer , all zeros are
_____________ memory addresses
Select correct option :
valid and constant
variable
invalid
None of the above


The function calloc takes two
arguments , first argument is the
______________ and the second
argument is the ____________ .
Select correct option :
required space in terms of numbers
, size of space
size of space , number of bytes
space in terms of string character,
size of list
size of array , number of bytes

The conditional compilation directives
help in _____________ the program
Select correct option :
executing
compiling
debugging
running

Which of the following header file include string conversion functions?(a) string.h
(b) stdlib.h (c) ctype.h
(d) sconvert.h

In flow chart process is
represented by
1 . Rectangle
2 . Arrow symbol
3 . Oval
4 . Circle

The object code of our program is
combined with the _______________
Select correct option :
source program
machine code of the operating
system
object code of the library functions
with header files




Application Softwares are use to
1 . Type letters
2 . Control computer hardware
3 . Solve end user problems
4 . Develop Graphics




 _______ are part of system
software
1 . Linker and loaders
2 . Opreating System and Linker
3 . Drivers
4 . None of the Given


The remainder ( % ) operator is,
1 . An arithmetic operator
2 . A logical operator
3 . A relational operator
4 . A division operator


int x = 2 * 3 + 4 * 5 ; What value
will x contain in the sample code
above?
1 . 22
2 . 26
3 . 46
4 . 50

Question No: 14      ( Marks: 1 ) - Please choose one
new and delete are _____ whereas malloc and free are _____.
        Functions, operators
        Classes, operators
        Operators, functions
        Operators, classes

Question No: 15      ( 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: 16      ( Marks: 1 ) - Please choose one
Which situation would require the use of a non-member overloaded operator?
        The overloaded operator is an Assignment operator.
       ► The left most operand is an object of a class.
        The left operand is built-in data type.
        The operator returns a reference.

Question No: 17      ( Marks: 1 ) - Please choose one
The stream insertion and stream extraction operators are already overloaded for ______.

        User-defined data types
        Built-in data types
        User-defined and built-in data types
        None of the given options
Question No: 18      ( Marks: 1 ) - Please choose one
If we define an identifier with the statement #define PI 3.1415926 then during the execution of the program the value of PI __________.
        can not be replaced
        None of the given options
        Remain constant.
        can be changed by some operation



What is the correct value to return
to the operating system upon the
successful
completion of a program ?
1 . - 1
2 . 1
3 . 0
4 . Programs do not return a value .



What is the only function all C+ +
programs must contain ?
1 . start ()
2 . system ()
3 . main()
4 . program ()


What punctuation is used to signal
the beginning and end of code blocks ?
1 . { }
2 . - > and < -
3 . BEGIN and END
4 . ( and )


What punctuation ends most lines
of C + + code ?
1 . (dot )
2 . (semi - colon)
3 . (colon )
4 . (single quote)


Which of the following is a
correct comment ?
1 . * / Comments */
2 . ** Comment **
3 . / * Comment * /
4 . { Comment }


Which of the following is not a
correct variable type ?
1 . float
2 . real
3 . int
4 . double


Which of the following is the
correct operator to compare two
variables?
1 . :=
2 . =
3 . equal
4 . ==


In C/C++; by default arguments are passed by_____to a function.
Reference
Value
Type
Data
1
char name [] = “Hello World” ; In the above statement, a memory of_______characters will be allocated
13
11
12
10
_______Keyword is used to return some value from a function.
break
return
continue
goto
Which of the function call is call by value for the following function prototype? float add(int);
add(&x);
add(x);
add(int x);
add(*x);
The increment of a pointer depends on its_________.
variable
value
data type
None of the given

The ASCHI code of null character is_________

000
010
111
110

Pointers are a special type of __________in which a memory address is storedvariables
Location
Characters
None of the given
just for copy paste


Identify the correct statement
1 . Programmer can use comments to
include short explanations within the
source
code itself.
2 . All lines beginning with two slash
signs are considered comments .
3 . Comments very important effect on
the behavior of the program
4 . both


There is a unique function in C+ +
program by where all C + + programs
start their
execution
1 . Start ()
2 . Begin()
3 . Main()
4 . Output ()



Every statement in C + + program
should end with
1 . A full stop ( .)
2 . A Comma ( ,)
3 . A Semicolon (;}
4 . A colon ( :)


A variable is / are
1 . String that varies during program
execution
2 . A portion of memory to store a value
3 . Those numbers that are frequently
required in programs
4 . None of these


The value of 2 * 15 / 3 *7 + 3 * 2 is
1 . 146
2 . 76
3 . 8
4 . 70


Transpose of a matrix means that when we interchange rows and columns_____________

the first row becomes the Last column
the first row becomes the first column
the Last row becomes the first column
the first column becomes the first row


Pointers store the ____________________
value of a variable
memory address
characters
None of the given


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      ( M - 1 ) .
 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      ( M - 1 ) .
 Array is a data structure which store
 
      ► Memory addresses
      ► Variables
      ► Data Type
      ► Data
Which of the following function call is “call by reference” for the following function prototype? int add (int *);
add(&x);
add(int x);
add(x);
add(*x);

The name of the array is a constant pointer which contains the memory address of the ____________of the array.
first element
Last element
second element
None of the given

We can also create an array of user define data type.
 
       ► True
       ► False
 
Question No: 5      ( M - 1 ) .
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      ( M - 1 ) .
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      ( M - 1 ) .
We can delete an array of objects without specifying [] brackets if a class is not doing dynamic memory allocation internally.
 
       ► True
       ► False

array name always contains the memory address of the ___________of the array

entire elements
last element
first element
None of the given

The size of a double variable is
1 . 2 bytes
2 . 4 bytes
3 . 8 bytes
4 . 10 bytes


Which of the following are NOT
relational operators ?
1 . >
2 . / p >
3 . ==
4 . >=

If NULL is returned by the calloc
function , it should be handled
___________________ So that program
exit safely .
Select correct option :
according to logic
with if- else statements
with sizeof function
with Void pointer

Which of the following can not be
used as identifiers ?
1 . Letters
2 . Digits
3 . Underscores
4 . Spaces


result of " number = number /
10 ; " will be equel to The " number =
number % 10 ; "
1 . TRUE
2 . FALSE

int x ,y = 10 ; cout x endl ; The value
of the x will be in the above code
1 . 0
2 . 10
3 . unknown Value
4 . - 1




Which of the following is the
boolean operator for logical - and ?
1 . &
2 . &&
3 . |
4 . | &


The second parameter of operator functions for are objects of the class for which we are overloading these operators.
 
       ► True
       ► False
 
Question No: 9      ( M - 1 ) .
 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      ( M - 1 ) .
 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      ( M - 1 ) .
 What does STL stand for?
 
       ► Source template library
       ► Standard template library
       ► Stream template library
       ► Standard temporary library
 
Question No: 12      ( M - 1 ) .
 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
 

Evaluate ! (1 && !( 0 || 1 )) .
1 . TRUE
2 . FALSE
3 . Unevaluatable
4 . None Of The Above


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      ( M - 1 ) .
 new and delete are _____ whereas malloc and free are _____.
 
       ► Functions, operators
       ► Classes, operators
       ► Operators, functions
       ► Operators, classes
 
Question No: 15      ( M - 1 ) .
 Friend functions are _____ of a class.
 
       ► Member functions
       ► Public member functions
       ► Private member functions
       ► Non-member functions
 
Question No: 16      ( M - 1 ) .
 The 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


Which one of the following
operators is a unary operator ?
1 . OR ( || )
2 . AND ( && )
3 . XOR ( ^ )
4 . Logical NOT ( ! )



Which of the following shows the
correct syntax for an if statement ?
1 . if expression
2 . if{ expression
3 . if( expression)
4 . expression if



The programs, in which we allocate static memory, run essentially on ________
 
       ► Heap
       ► System Cache
       ► None of the given options
       ► Stack

Question No: 22      ( M - 1 ) .
 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      ( M - 1 ) .
 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      ( M - 1 ) .
 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      ( M - 1 ) .
 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      ( M - 1 ) .
 Assignment operator is used to initialize a newly declared object from existing object.
 
       ► True
       ► False
 
Question No: 27      ( M - 1 ) .
 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


Loader transfers the executable
code from main memory to hard disk .
1 . TRUE
2 . FALSE

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      ( M - 1 ) .
 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      ( M - 1 ) .
 We can also do conditional compilation with preprocessor directives.
 
      ► True
      ► False

What is the final value of x when
the code int x ; for (x = 0 ; x < 10 ; x + + ) {}
is run ?
1 . 10
2 . 9
3 . 0
4 . 8

When does the code block
following while (x < 100 ) execute?
1 . When x is less than one hundred
2 . When x is greater than one hundred
3 . When x is equal to one hundred
4 . While it wishes

Which is not a loop structure ?
1 . For
2 . Do while
3 . While
4 . Repeat Until

for (int n = 10 ; n > 0 ; n + + ) { cout n
" , "; } How many Time Loop will run
1 . 100
2 . Infinite Time
3 . 1000
4 . 10000000

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      ( M - 1 ) .
 new operator allocates memory from free store and return _____________.
 
       ► A pointer
       ► A reference
       ► An integer
       ► A float
 
Question No: 30      ( M - 1 ) .
 "new" and "delete" keywords are _____________ in C++ language.
 
       ► Built-in- Function
       ► Operators
       ► Memory Allocation Function
       ► None of  the given options

When break statement is
encountered in switch statement, it
1 . Stops the entire program
2 . Stops the execution of current
statement
3 . Exits from switch statement
4 . None of the given options

A for loop usually consist of
__________ expressions.
1 . 1
2 . 3
3 . 2
4 . 4



x = x + 4 ; Is Equal to
1 . x + = 4 ;
2 . x = + 4 ;
3 . x == 4 ;
4 . x =! 4 ;

The first expression in a for loop
is
1 . The test expression.
2 . The step value of the loop.
3 . The first value of our counter
variable .
4 . None of the above.

What is the break statement used
for ?
1 . To quit the program .
2 . To quit the current iteration .
3 . To stop the current iteration and
begin the next iteration.
4 . None of the above.



Post a Comment

Previous Post Next Post