100% found this document useful (3 votes)
9K views14 pages

CS201P Quiz File

This document contains 100 multiple choice questions about C++ programming concepts. The questions cover topics like classes, functions, operators, arrays, pointers, loops, and file handling. Common question types include true/false, fill in the blank, and selecting the correct answer from answer choices. The questions are formatted as a quiz to test understanding of fundamental C++ concepts.

Uploaded by

SAIM ALI RASHID
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
9K views14 pages

CS201P Quiz File

This document contains 100 multiple choice questions about C++ programming concepts. The questions cover topics like classes, functions, operators, arrays, pointers, loops, and file handling. Common question types include true/false, fill in the blank, and selecting the correct answer from answer choices. The questions are formatted as a quiz to test understanding of fundamental C++ concepts.

Uploaded by

SAIM ALI RASHID
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

CS201P

Quiz File
Q.1 We cannot declare a function as a a friend of --------------
classes
Ans: istream or ostream
Q.2 Automatic variable are created constantly and destroyed
Ans: All the time
Q.3:--------are a conditional complication process that is used to
replace a piece of code by its definition in a programe
Ans: function
Q.4: calloc () functions allocates multiple blocks of memory
and each block have-------------?
Ans: same size
Q.5: in C++ sizeof operator is used to determine---------------
Ans: not confirm
Q.6:which of the following header file deals with stream
extraction?
Ans: iostream.h
Q.7: Type to use getch() function without including
#include<conio.h> header file in the program is a ------ error
Ans: compilation
Q.8: in C++ the default constructor takes------------
Ans: Only one argument
Q.9: in C++ the name of the ---------- is the same as that of a class
with a preceding tild (~) sign.
Ans: Destructor
Q10: which of the following option returns the state of end file?
Ans: cin.eof()
Q.11: If the memory in the free store is not sufficient enough to
fulfill the request , malloc () function return-----------
Ans; Null
Q.12: in C/C++ language . memory at runtime is allocated from -
-----------
Ans: Stack
Q.13: When overloading assignment (=) operator, which of the
following syntax is correct?
Ans: void operator(=) const string &other:
Q.14: which of the following code:
Ans :***7
Q.15: For overloading minus (-) operator, which member
operator function will be correct?
Ans: complex operator-(complex c)
Q:16: In C++ which operator is used far memory allocated ?
Ans: New
Q.17:The Statement char array [10]; is an example of a type of --
------------ memory allocation
Ans: staic
Q.18:which of the following option not a source of the output
steam?
Ans: file
Q.19: A sequare matrix has-----------
Ans: Equal number of rows and columns
Q.20:The statement *double** elements; * says that *elements*
is a / an ------ to double.
Ans: Array of pointers
Q.21: A matrix is nothing but a --------- of numbers.
Ans: Two- dimensional array
Q.22: A programmer can ------- the simple matrix class to handle
the integer, float, or double data type as elements of the given
matrix.
Ans: Hide
Q.23: in C and C++ language, every expression has a --------- of its
own?
Ans: Value
Q.24: The cycle of testing and --------- continues until the
program is working perfectly without any problem.
Ans: Bug fixing
Q.25: Default scope for members of structures is -------- and
default visibility for class members is ----
Ans: Public, Private
Q.26: If A and B are two matrices of order M*N to be added then
their resultant matrix will have an order of
Ans: M*N
Q.27: if *m* is a matrix object, then self-assignment can be
avoided by using following code statement
Ans: If (&m!=this);
Q.28: Which of the following is correct formate of template
function?
Ans: Template <class T>
Q.29: In template class, compiler makes a copy of ---- and
convert in to -----
Ans: Source code , Object code
Q.30: Far a matrix, the variables of Rows and Columns should
always be a -------
Ans: Whole Number
Q:31: After implementation of code is completed, we do its -----
to verify that it is behaving properly in all scenarios.
Ans: Testing
Q.32: which three constructs do we need to solve any
problem?
Ans: Classes, structures, functions
Q.33: Declaration and definition of a template function should
be in the -------- file
Ans: same
Q.34: For template function, we must have at least ---------
generic argument.
Ans: One
Q.35: In C++ , which of the following option has the correct
meaning of the expression”a<=b”?
Ans: a is less than or equal to b
Q.36: which of the following code?
Ans: 2 4 6 8
Q.37: What will be the output of the following code?
Int x=15;
Iny y=10;
Int z= 5;
Cout<< x*x-4*y*z;
Ans: 25
Q.38:Which of the following expression is correct in C/C ++
language?
Ans: X=X+3
Q.39: Which of the following C++ statements I used take input
from the user?
Ans: cin
Q.40: Which of the following is an example of logical operator?
Ans: &&,II
Q.41: in C/C ++ , which of the following data type is used to
store real numbers?
Ans: Float
Q.42: C/C++ has many libraries which contain variables and
function names normly starting with ------
Ans: Underscore
Q.42: The coding of a program is translated into machine
language by -------
Ans: Compiler
Q.43:Learning “How to program” is important, because it
develops------- and problem solving abilities.
Ans: Analytical
Q.44: in C/C++ , the algebraic expression (b2-4ac)/2a cab be
written as:
Ans: (b*b-4*a*c)(2*a)
Q.45: In C/C++, which of the following data type is used to store
real member?
Ans: Float
Q.46: To understand programming concepts,------------
programming language being used as a vehicle in cs201
“Introduction to programming” course.
Ans: C/C++
Q.47: The bit manipulators operator------------ is used to check
weather a specific bit is set or not.
Ans: &
Q48.: in C++, which operator is used while accessing through
the pointer to structure?
Ans: ->
Q.49: Function seekg() and seekp() require an argument of
type------ to let them know how many bytes to move forward
backword.
Ans: Long
Q:50: Macro is defined by ------------ preprocessor directive.
Ans: #define
Q.51: In C++ , when accessing files randomly, which function is
used at get current pointer position inside a file?
Ans: tellg()
Q.52:Which is not a preprocessor directive of C-Language?
Ans: # Startif
Q.53:The statement char arr [10]; is an example of a type of -----
-- memory allocation
Ans: Built-in
Q.54: What would be the output of the following statement?
C=13%2;
Ans= 1
Q.55: Which of the following two array are copy-able?
Ans: int a[5],int b[5]
Q.56: A variable declared inside a code block becomes the -------
variable for that block.
Ans: Local
Q.57: Which type of arrays are used while dealing with
sentences?
Ans: Character arrays
Q.58: In the call by reference method, which operator is used to
get the address of a variable?
Ans: &
Q.59: Which of the following is the correct method to declare an
array?
Ans: data-type array-name[size];
Q.60: char name []= “Hello World”;
In the above statement, a memory of -------- characters will be
allocated to the array name.
Ans: 12
Q.61 In C++ , what is the correct syntax for accessing the fifth
element of an array?
Ans: a(4)
Q.62: Which of the following shows the memory address of the
first element in an array?
Ans: array[0]
Q.63 In C++ , the precise way to declare a pointer is ,
Ans: int*ptr;
Q.64: Identify the invalid option.
Ans: int *pi=0;
Q.65: ------------ character is used to terminate a string.
Ans: Null
Q.66: which of the following is an example of repetition
structure?
Ans: while
Q.67: Function declaration is a one-line statement in which we
write the return type,---------- of the function and the--------------
of arguments
Ans: Name, Data type
Q.68: If the condition is not made false in while loop, what will
happen?
Ans: Program will terminate only
Q.69: Which of the following optio gives the [value] stored at
the address pointed to by the pointer “ptr”?
Ans: *ptr
Q.70: in C++ , cout is known as ------------
Ans: output stream
Q.71: Which of the following is not a file opening mode?
Ans: ios:: trunk
Q.72: In C++ , the precise way to declared a pointer is.
Ans: int*ptr;
Q.73: --------------statement is necessary in switch structure.
Ans: Break
Q.74: Normally, the float data type is half of the size of -----------
Ans: Double
Q.75: which of the following option is used when working with
completed expression in c++?
Ans: ()
Q.76: A binary operator has ---------- operands.
Ans: Two
Q.77:which of the following is the default function calling
mechanism of C/C++?
Ans: Call by value
Q.78: which function is automatically called when an object of a
class is initialed?
Ans: constructor
Q.79: in C++, the default constructor takes----------
Ans: No arguments
Q.80: In C++, which of the following option is used to declare a
class?
Ans: class
Q.81:in C++ which of the following function causes the full
definition of the function to be inserted in each place when it
gots called?
Ans: Inline function
Q.82:Bool data type takes ---------values.
Ans: 2
Q.83: In the syntax of the overloaded operator function given
below
Complex operator + (Complex &);
What is operator?
Ans: keyword
Q.84:which operator can be overloaded?
Ans: not confirm
Q.85:Complex codd (complex c1, complex c2);
Which statement is true far above code?
Ans: Creating object of class complex with name codd with
parameters.
Q.86: Which of the following operator can be overloaded?
Ans: ?
Q.87:Which of the following is assignment operator?
Ans: =
Q.88: which option will be correct in order to free the space of
memory allocated to a buffer (but)?
Ans: Delete but
Q.89: When overloading assignment (=) operator, which of the
following syntax is correct?
Ans: void operator=( const String &s);
Q.90:Complex codd ( Complex c1, Complex c2);
Which of statement is true for above code?
Ans: It accepts two complex numbers as parameters and
returns back the resultant complex number.
Q.91: What is correct example of binary operator?
Ans: -
Q.92: Which of the following options not a source of the output
stream?
Ans: region in the memory
Q.93: How many option are initialized for the class?
Date my Dates[10];
Ans: 10
Q.94:which statement about pointer is not true?
Ans: pointer can be void
Q.95:Representing logical depiction of the solution to the
problem is known as a -----------
Ans: Structure
Q.96: Which statement about manipulators is not true?
Ans: it automatically gets that object as parameter passed in to
the function
Q.97:which of the following structure is correct for WHILE
loop?
Ans: While (condition)
Q.98:which of the following is true about the switch statement?
Ans: It cannot handle the compound conditions which use
logical operators
Q.99: If the condition is not made false in while loop, what will
happen?
Ans: Loop will become infinite
Q.100: If a function does not return anything, its return type
will be -------
Ans: void
Q.101:which of the following is the first step in FOR loop?
Ans: Initialization condition
Q.102: When we call a function and pass an argument, an object
or variable to the function, it is called ?
Ans: call by value
Q.103: Stream insertion(<<) and extraction operators (>>) are
always implemented as -------- function.
Ans: Non-member
Q104: which of the following statement is not true about over
loading stream extraction operator(>>)?
Ans: it can be a member operator.
Q.105: endl is a type of ---------manipulator.
Ans: Parameterized less

You might also like