Describe the Data Types Supported by C++. |
|
University | Amity blog |
Service Type | Assignment |
Course | |
Semester | |
Short Name or Subject Code | SUB-Introduction to Object Oriented Programming and C++ |
Product | of Assignment (Amity blog) |
Pattern | Section A,B,C Wise |
Price | Click to view price |
SUB-Introduction to Object Oriented Programming and C++
SECTION A
S.NO Questions
1 (a) Describe the data types supported by C++.
(b) Write a program to arrange the given set of numbers in ascending order using pointer.
2. What is structure in C++? Why we use structure? Write a program by using structure3. (a) Explain the loop structures available in C++.
(b) Write a program to print prime numbers between two limits
4 (a) Explain the different types of inheritance supported by C++.
(b) When do you use a virtual function? Explain with suitable example
5 (a) What is Compile time polymorphism? Explain with an example
(b) Write a program to perform complex number arithmetic operations using operator overloading
6 (a) Explain the use of pointers in C++.
(b) Create a class MAT of size m x n. Define all possible matrix operations for MAT type objects
7 (a) What is a friend function? What are the merits and demerit of using friend function?
(b) Explain the different types of constructors in C++
8 (a) Describe the basic concepts of object-oriented programming
(b) Illustrate with an example, how the endl and setw manipulator works?
SECTION B
Write a program in C++ to count the number of words in a line of text
How will you transfer values from derived class constructor to base class constructor? Explain with suitable illustration
SECTION C
Question No: 1
1. Which of the following is the Boolean operator for logical-and?
&
&&
|
|&
Question No: 2
How long does this loop run: for(int x=0; x=3; x++)
Never
Three times
Forever
None of above
Question No: 3
Which of the following is not a looping statement in C?
while
until
do
Question No: 4
Which of the following is not a jump statement in C++?
break
goto
exit
switch
Question No: 5
Which of the following is selection statement in C++?
break
goto
exit
switch
Question No: 6
The difference between while structure and do structure for looping is--
In while statement the condition is tested at the end of first iteration
In do structure the condition is tested at the beginning of first iteration
The do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not
In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop
Question No: 7
Looping in a program means--
Jumping to the specified branch of program
Repeat the specified lines of code
Both of above
None of above
Question No: 8
The “return 0;” statement in main function indicates--
The program did nothing; completed 0 tasks
The program worked as expected without any errors during its execution
Not to end the program yet.
None of above
Question No: 9
The size of following variable is not 4 bytes in 32 bit systems.
int
long int
short int
float
Question No: 10
What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
Question No: 11
Which of the following is not a reserve keyword in C++?
Mutable
Default
Readable
Volatile
Question No: 12
Identify the correct statement regarding scope of variables.
Global variables are declared in a separate file and accessible from any program.
Local variables are declared inside a function and accessible within the function only.
Global variables are declared inside a function and accessible from anywhere in program
Local variables are declared in the main body of the program and accessible only from functions.
Question No: 13
If you use same variable for two getline statements.
Both the inputs are stored in that variable
The second input overwrites the first one
The second input attempt fails since the variable already got its value
You can not use same variable for two getline statements
Question No: 14
To increase the value of c by one which of the following statement is wrong?
c++;
c = c + 1;
c + 1 => c;
c += 1
Question No: 15
When following piece of code is executed, what happens?
b = 3;
a = b++;
a contains 3 and b contains 4
a contains 4 and b contains 4
a contains 4 and b contains 3
a contains 3 and b contains 3
Question No: 16
The result of a Relational operation is always--
Either True or False
Is less than or is more than
Is equal or less or more
All of these
Question No: 17
Which of the following is not a valid relational operator?
==
=>
>=
>=
Question No: 18
What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?
10
9
0
1
Question No: 19
When does the code block following while(x<100) execute?
When x is less than one hundred
When x is greater than one hundred
When x is equal to one hundred
While it wishes
Question No: 20
Which is not a loop structure?
for
do while
while
repeat until
Question No: 21
How many times is a do while loop guaranteed to loop?
0
Infinitely
1
Variable
Question No: 22
What punctuation ends most lines of C++ code?
. (dot)
; (semi-colon)
: (colon)
' (single quote)
Question No: 23
Which of the following is a correct comment?
*/ Comments */
** Comment **
/* Comment */
{Comment}
Question No: 24
Which of the following is not a correct variable type?
float
real
int
double
Question No: 25
Which of the following is the correct operator to compare two variables?
:=
=
equal
==
Question No: 26
A variable is/are--
String that varies during program execution
A portion of memory to store a determined value
Those numbers that are frequently required in programs
None of these
Question No: 27
Which of the following can not be used as identifiers?
Letters
Digits
Underscores
Spaces
Question No: 28
Which of the following identifiers is invalid?
papername
writername
typename
printname
Question No: 29
Which of the following can not be used as valid identifier?
bitand
bittand
bittand
band
Question No: 30
The difference between x and ‘x’ is--
The first one refers to a variable whose identifier is x and the second one refers to the character constant x
The first one is a character constant x and second one is the string literal x
Both are same
None of above
Question No: 31
Which of the following is not a valid escape code?
\t
\v
\f
\w
Question No: 32
The file iostream includes--
The declarations of the basic standard input-output library.
The streams of includes and outputs of program effect.
Both of these
None of these
Question No: 33
There is a unique function in C++ program by which all C++ programs start their execution--
Start()
Begin()
Main()
Output()
Question No: 34
Every function in C++ are followed by--
Parameters
Parenthesis
Curly braces
None of these
Question No: 35
Every statement in C++ program should end with--
A full stop (.)
A Comma (,)
A Semicolon
A colon
Question No: 36
Which of the following statement is true about preprocessor directives?
These are lines read and processed by the preprocessor
They do not produce any code by themselves
These must be written on their own line
They end with a semicolon
Question No: 37
Question No: 38
Which of the following header file does not exist?
Question No: 39
A block comment can be written by--
Question No: 40
When writing comments you can—