You are on page 1of 16

St.

Mary's College
(Autonomous) - Thoothukudi
EndSemester Examination
B.Sc. Computer Science
Core 1 - C+ Programming Sub. Code : 21UCSC21

Semester II April 2022


Time: 3 hours Max : 75 marks

Answer all questions


Section A (10 x 1 = 10 marks )
Choose the corTect answer:
1. A function which is part of a class, is called a
a) mermber b) member function
c)static member d) independent function
2. The extraction operator >> can be cascaded with
a) shift left b) shift right c) cin d) cout
3. Which of the following function cannot have default parameters?
a) Member function of class b) Main function
c) Member function of structure d) subroutine function
4 Copy constructor must receive its arguments by
a) either pass-by-value or pass-by-reference b) only pass-by-value
c) only pass-by-reference d) only pass by address
5. What is the type of elements of array of objects?
a) Class b) Void c) String d) Null
6. What is the syntax of overloading operator+ for class A?
a) A operator {argumentlist){ } b) A operator[+](argumentlist) {
c) int (argumentlist) } d) int (+(argumentlist){}
7. Class X, class Y and class Z are derived from class BASE. This is inheritance.
a) Multiple b)Multilevel c) Hierarchical d) Single
8 The this' pointer is accessible
a) withín all the member functions of the class
b)only within functions returning void
c) only within non-static functions
dwithin the member functions with zero arguments

9 Apure virtua! function is


a) a virtual function defined inside the base class
b)a virtual function that has no definition relative to the base class
c) a virtual function that is defined inside the derived class
) any function that is made virtual
10. Dynanic bending is done using the keyword.
a) virtual b) inline c) static d) void
:2:
Section B (5x2 =10 marks )
Answer any FIVE questions :
11. What are relationships between c and
C++?
12. Write the general
structure of a C+t program.
13. List the uses of functions.
14. Define static data item.
15. Write the declarator for an inline function named student() that
float and returns type float takes onc argument of type
16. Write the uses of 'new' and 'delete'
operator in C++.
17. What is a stream in C++?

Section C (5 x5= 25marks )


Answer all questions choosing either (a) or (b) :
18. a) Write the characteristics of object
oriented languages.
(or)
b) Write a C++ program to demonstrate the Library
Functions in C++.
19. a) Explain pass by reference with an
example.
(or)
b) Write a C++ program to return objects from a
function.
20. a) Define an array. Explain about
(or)
two-dimensional array handling in C+t with example.
b) Write a C++ code to demonstrate
overloading binary operator.
21. a) Describe about pointers to object with example.
(or)
b) Write a C++ code to demonstrate overriding
member functions.
22. a) Describe the file handling operations in C+t.
(or)
b) Explain friend function.
Section D (3x 10 =30 marks )
Answer any THREE questions :
23. Explain the different types of variables supported in C++
with example.
24. Describe the constructors with example.
25. Explain array of objects with example
26. Explain multiple inheritance with example program.
27. Describe the following functions with example code
i)Virtual functions ii) Static functions
(for those who joined in July 2018 and after)
Time :3 hours Max : 7Smarks
Answer allquestions
Section A (10x1= 10 )
Choose the correct answer :

1. Which one is not an OOP language?


a)C# b) Java c) C++ d) C

2. Whichof the following correctlydeclares an array?


a) int array[ 10]: b) int array, c) array{ 10}: d) array array[10};
3. Which of the following accesses the seventh clement stored in array?
a)array[6]: b) array[7]: c) array( 7); d) array,

4. The members of a class are by default


a)public b) protccted c) friend d) private

S. String characters can be accessed using the function.

a)at() b) find) c)substr() d) allof these

6. The basic meaning of the overloaded operator


a)can change b)cannot change c)partially change d) none of these

The member function fill) belong to class.


7.
a)istream b) fstream c) ostream d) iostream

8. Arguments supplied to main()at the time of invoking are known as argument.

a) default b) command line c) formal d) none of these

9. The keyword to refer a constant is


a)constant b)const c) Cont_st d) none of these

10. Apure virtual function is avirtual function that


a) causes itsclass to be abstract b)returns nothing
c) it is used in base class d) takes no argument
Section B (5x5 = 25 )

Ansmer all questions choosing either (a) or (b) :


I1. a) Compare Structure Programming and Object Oriented Programming
(or)
b) Write notes on user defined and derived data types withexampie.
12. a) What is meant by Inline Function? Given example
(or)
b) Explain copy constructer with example.
13. a) Write a Ctt program to find sum of diagonals of matrix
(or)
b) Write a C++ program to arrange the names in alphabetical order.
14. a) Explain simple and multilevel inheritance with example.
(or)
b) What is Overriding? Explain with an example.

15. a) Explain C++ Streams with example.


(or)
b) Explain about Virtual Function.
Section C (518= 40)
Answer any FIVE qaestions :

16. Explain in detail about structure of C++program with example.


17. Discuss about the characteristics of OOPs
18. Discuss about classes and objects with example.
19. Discuss in detail about constructor overloading.
20. What is meant by operator overioading? Explain with suitable example.
21. Write aC++ program to compare 2strings sing ==overioading.
22. Describe in detail about mutiple inheritance.

23. Write a program to create a linked list.


24. Explain in detail about command line argument.
25. Write a C+t program to Swp two umbers using friend functinn
ST.MARY'S COLLEGE (Autonomous) - THOOTHUKUDI
END SEMESTEREXAMINATION
B.Sc. Computer Science
Core 1 - C++ Programming Sub.Code : 15UCSC21
Semester II April 2018
(for those who joined in July 2015 and after)
Max : 100 marks
Time: 3hours
Answer allquestions

Section A (20 x 1 =20 )

Choose the correct answer :

1. InC++, afunction contained within a class is called d)a method


a) a member fünction b) an operator c) a class function

2. provides an important extension to the idea of reusability. d) Binding


a) Class b) Polymorphism c) Inheritance

3. The operator << is called the operator.


b) insertion c)cout d) output
a)extraction
source file.
4. The directive tells the compiler to insert another file into the present
d) none of these
a) #define b) #include c) #import

5. Function declarators are also called d) allof these


a) implementation b)declaration c) prototype

referred to as the
6. The first line of a function definition is
b) function body c) function call d) prototype
a) declarator
type
7. Afunction that doesn't retum anything has return d) char
b)void c) float
a)int
of a class.
S. Anobject is said to be a /an c)instance d)none of these
b) visitor
a)copy
called
9. The items in an array are c) elements d) none of these
a) members b) objects

type
10. Strings are arrays of b) float c) char d) string
a) int

11.
operator cannot be used to concatenate strings. d) &&
b) & c).
a) +

12. The keyword isused to overload the operator. d) overload


a) operator b) friend c) override
:2:

13. To be accessed from a member function ofthe derived class, data or functions in the base
class must be public or
a) protected b) private c) static d) all of these

14. Aclass that can be derived from more than one base class is called
a) multilevel b) multiple c) hierarchical d) singleinheritance.
15. Which operator is the indirection operator?
a) * b) & c). d) >
16. A
pointer is
a) variable that hold address values b) contents of a variable
c) datatype of a variable d) indication of variable
17. Another name of late binding is
a) static binding b) compile-time binding
c) dynamic binding d) early binding
18. A function can access aclass private data even though it is not a
the class. member function of
a) friend b)abstract c) virtual d) none of these
19. A is a flow of data.
a) stream b) byte c) file d) none of these
20. The istream and ostream classes are
derived from
a) iostream b) ios c) fstream d) ifstream
Section B (7x2 =14)
Answer any SEVEN questions :
21. Define object.
22. Define expression.
23. What is an argument?
24. Define destructor.

25. Mention the function of strcpy) function.


26. Write about unary operators.
27. Write the difference between structures and
classes.
28. Write the use of new and delete operator.
29. Define abstract class.

30. Write any 4 mode bits for open() function.


:3:

Section C (5x6= 30 )

Answer allquestions choosing either (a) or (b) :


naming variable.
31. a) How to declare varjables? Write down the rules for
(or)
b) Write about manipulators.
32. a) Write about overloaded function with example.
(or)
b) Write a note on constructor.
of array elements.
33. a) Write a program to calculate average
(or)
b) Write about unary operators.

34. a) Write about multiple level inheritance.


(or)
b) Explain pointers and arrays.
35. a) Write about friend class.
(or)
b) How to read and write disk files?
Section D (3x 12 =36 )

Answer any THREE questions :

36. Explain arithmetic operators.


37. Give an account on storage classes.
overloading.
38. Explain pitfall of operator
strings.
39. Explain in detail pointers and
40. Explain file pointers.
ST.MARY'S COLLEGE (Autonomous) - THOOTHUKUDI
END SEMESTER EXAMINATION
B.Se. Computer Science
A2019
Core 1 - C++ Programming Sub Code: 18UCSC21

Semester II April 2019


(for thosewho joined in July 2018)
Time : 3 hours Max: 100 marks
Answer all questions
Section A (20 x 1 = 20 )
Choose the correct answer :
1 The concept of provides an importantextension to the idea of reusability.
a) encapsulation b)polymorphism c) casting d) inheritance

Grouping number of functions together into a larger entity is called a


a) procedure b)module c) structure d) methods

3. The pre-processor directive starts with a sign.


a) * b) < c) $ d) #
4. header file is included with your program program to use setw.
a) stdmanip.h b) stdiomanip.h ) iomanip.h d) manip.h
Number of values returned from a function is
a) 1 b) 2 c) 3 d) 4

6. variables are called global variables.


a) External b) Automatic c) Static d) Dynamic
7. The operator is also called the class member access operator.
a)+ b) .(dot) c) << d) ?

8. The nembers of aclass are by default.


a) pablic b) protected c)private d) friend

9. What is the index nunber of the last element of an array with 9 elements?
a) 9 b) 8
c)0 d) programmer-defined

10. The items in a structure are called


a) members b) elements c)components d) records

13. Which of the following operator can be overloaded? d) ++


a) .(dot) b)?: c) ::

12. Astring in Ct+ is an of type char.


b) element c) enumeration d) item
a) array
:2:

13. Inheritance trees are also called


a)ADG b) DAG c) TAG d) ATG
14 is the expression for the address of var.
a) *var b) &var c) ->var d) var->

13. The content of two pointers points to adjacent variables of type float differ by
a) 2 bytes b) 4 bytes c) 8 bytes d) 16 bytes
16. class cannot be instantiated.
a) Pure b) Abstract c) Concrete d) Real
17. Choosing functions during runtime is called binding.
a) early b) static c) late d) quick
18.
object is used to display error messages while its output is also buffered.
a) log b)err c) clog d) cerr
19. A virtual function is a virtual function that has no body.
a) concrete b) abstract c) pure d) real
20. function returns the current position of the get pointer.
a) tellg b) seekg c) tellp d) seekp
Section B (10 x2 =20 )
Answer any TEN questions:
21. Mention any four object oriented languages.
22. What are the two ways to use #include?

23. Delineate the purpose of scope resolution operator.


24. Give the four components of function.
25. Present the syntax of array definition.
2.6. What are the two approaches used in the conversion between the user
defined types to basic
types?
27. List down the advantages of inheritance.
28. Write a definition for an array number of pointers to string "one", two" and
three".
29. Draw thestream class hierarchy.
30. When a copy constructor is invoked?
31. Define Abstract class.

32. What is Virtual function?


:3:

Section C (5r6= 30 )
Answer all questions choosing either (a) or (b) :
33. a) Explain any two characteristics of object oriented language.
(or)
b) Write about the basic C+tt variable types.

34. a) Explain constructor withexample.


(or)
b) Write notes on overloaded function.
conversion.
35. a) List down the pitfails of operator overloading and
(or)
Point up.
b) Illustrate array of objects with an example.
with an exampl.
36. a) Explain multiple inheritance
(or)
aray using pointer.
b) Write a Ctt program to sort an
Discuss about the FRIEND function with examples.
37. a)
(or)
Explain the various modes for open ) function of fstream class.
b)
Section D (31 10 =30 )
Answer any THREE questions :
38. Discuss on C++ arithmetic operators.

39. Explain in detail about the three storage classes in Ctt.

40. Write a C++ prograrm to overload '<* operator to


i) cormpare two distances ii) compare two strings

41. Define inheritance. Explain multi-level inheritance with examples.


in C++?
42. How towrite an object to disk and read an object from disk
ST.MARY'S COLLEGE (Autonomous)
END SEMESTER EXAMINATION

B.Sc. Computer Science


Sub. Code: 15UCSC21
Core 1- C+ Programming
Semester II April 2017
(for those who joined in July 2015 and after)
Time: 3 hours Max.: 100 marks

Answer all questions

Section A (20 x l= 20 )

Choose the correct answer :

The members of a class are by default d) None of these


a) Private b)Public c) Protected
2. Encapsulation means
a) protecting data b) allowing global access
d) both (a) and (c)
c) data hiding
3. When alanguage has the capability to produce new data types, it issaid to be
overloaded d) extensible
a) reprehensible b)encapsulated c)

4. Preprocessor directive consists of instructions to the d) None of these


a) Compiler b) Computer c) Loader

S. can be legitimately passed to the function


a) A constant b) A variable c) A structure d) allof these
6. When an argument is passed by reference,
a) a variable is created in the function to hold the argument's value
b) the function cannot access the argument's value argument's value
c) atemporary variable is created in the calling progran to hold the
d) the functionaccess the argument'soriginal value in thecaling program
7. The dot operator connects the two entities b) aclass object and a class
a) a class member and a class object
c) a class and a member of that
class d) a class object and a member of that class

8. C+ provides inline functions to facilitate reduce function call overhead, mainly forthese
a) small functions b) large functions c) member functions d) None of

The element int reg[6]is which element of the anray?


9.
a) The sixth b) The seventh c) The eighth d) Impossible to tell
is
10. When a multidimensional array is accessed, each array index
a)Separated by commas commas
b) Surrounded by brackets and separated by brackets
c) Separated by commas and surounded by
d) Surrounded by brackets
The keyword operator is used to overioad an d) None of
these
a) Operator b) Function c) Class
:2:

12. Which one of the following conversion is automatically carried by


the
a) Conversion from basic data type touser-defined data type (class tyne)
b)Conversion from class type to basic data type
compiler?
c) Conversion from one class type to another class type
d) None of the above
13. Which ofthe following constructor related concepts is non-relevant in C++2
a)Conversion constructor b) Copy constructor
c) Overloaded constructor d) Virtual constructor
14. Which of the following statement is true about this pointer?
a) It is not taken into consideration while computing the size of the
b) It cannot be modified object
c) lt cannot be accessed by static member functions
d) all of these
15. Which of the following is not supported by
a) Automatic garbage collection C++?
b) Multiple inheritances
c) Smart pointer d) Virtual destructor
16. Apointer is
a) the address of a value b)an indication of the
c) a variable for storing addresses variable to be
d) the data type of an address variableaccessed ne
17. The Statement fl.write ((char ) &
a)the member functions of objl to flobj1,size of (objl); writes
b) the data in objl to fl
c) the member functions and data of objl to fl
d) the address of objlto fl
18. Redirection redirects
a) a stream from a file to the screen
b)a file from a device to a
c) a device from the screen to a file stream
d) the screen from a device to a
19. The feofO
stream
function returns which of the
indicator associated with the passed streamfollowing
is set?
values if it finds that the end of file
a) 0 b) 1 c) Any positive value d) Any non-zero value
20. fstream refers
a) Input b) Output c) Both a and b d) None of these
Section B (7x2= 14 )
Answer any SEVEN questions :

21. List the names of popular OOP languages.


22. Distinguish between cin )and cout()
23. What is void function?

24. What is the difference between object and variable?


ns Whbat is the difference between operator overloading and function
overloading
:3:
26.
What are arrays?
27. What is the
difference between nprivate and protected access specifier?
28. What are the uses of
pointers?
29. Describe the syntax of open (0 function with its arguments.
30. What is a
stream?
Section C (5x6=30 )
Answer all questions choosing either (a) or (b) :
31. a) What is object oriented programming? Discuss its pros and cons
(or)
b) Write a program tocalculate simple interest and total amount
32. a) What is the difference betwveen call by value and callby reference?
Illustrate them with examples
(or)
b) Write a program to declare a class with three integer public data variables.
Initialize and display them.
33. a) What are the rules for overloading operators?
(or)
pointer.
b) Write a program to declare an integer array. Display the contents of the array using
class?
34. a) What do you mean by base class and derived
(or)
using pointers.
b) Write a program to find the determinant of a 2x2 matrix
function?
35. a) What are the limitations of using put ) and get ()
(or)
b) What are command line arguments?
Section D (3xl2 = 36 )

Answer any THREE questions :


36. Describe different parts of C++ programs.
member functions.
37. Explain the features of
38. i) What do you mean by operator overloading?
overload = operator.
ii) Write a program to
inheritances with example. tothefile.
39. Describe various types of Accept data and write
Write a programto open afile in output and input mode.
40.
Display the contents of the file.
CampabrSeunet
THOOTHUKUDI
ST.MARY'SCOLLEGE (Autonomous) -
END SEMESTER EXAMINATION

B.Sc. Computer Science


Sub Code: 15UCSC21
Core 1 - C+ Programming
Semester II April2016
(for those who joined in July 2015)
Max : 100 marks
Time :3 hours
Answer all questions
Section A (20 x 1= 20 )
Choose the correct answer :
larger entity is called as
Grouping a number of functions together into ac) module d)none
a) subroutine b) objects

2. C++ is a of C Language. d) voidset


b) nullset c) superset
a) subset
file into the present source file.
3 directive tells the compiler to insertc)another
#define d) none
b) #include
a) using
The Stream is a of the above
4.
a) flow of data b) flow of integers c) flow of statements d) none
mainly for
facilitate reduce function call overhead,
5. C+t provides inline function to function c) member function d) none
a) small functions b) large
then the returm type is
6. When a Function returns nothing, c) char d) void
a) int b) float
cannot be overloaded. d) none
7.
b) destructor c) function
a) constructor

8. Class member access operator is c) :: d) &


a b).
brackets.
array, the values should be enclosed within
9. In order to initialize an c) {} d) o
a) [) b) ()
being entered in exponent format. d) none
10. flag prevents numbers from c) setprecision
a) fixed b) showpoint
function in UML is called d) Navigability
11. The member b) Association c) Operation
a) Attribute
members.
keyword is used to modify class c) static
d)exterm
12. b) explicit
a) implicit
12

13. Base Class is also called as


a) Subelass b) Super ola98 )Child
14. Classes for which instance cannot be erealed is eulled
a) supet b) suh 6) abstract
I5. Another name for dereferenc6 operator is
a) direction operator b)outdirection ) indireetion
l6. What is the output of the following
int "p: statemente?
int x-10,y-20;
p&x;
cout<<*p,
a) 10766 b) 20 6) 1024
17
is apointer which points to object itself.
a)
b)this c)
18. Conslder the statenent
a) pure member functionvitual void display() 0, The display () funin is
c) pure virtual function b)normal funedion
d) all of the sbove
19.
a) cndlmanipulator used to insert a null character to terminatw an
is
b)ends c) endw output sring
20,
d) ende
mode bit is used to start
a)trunc
b) app
writing at end of file.
() ate d) out
Answer any SEVEN questions : Section B(7x2=14)
21. Define Integer
(Constant,
22. What are the two
ways to use linclude
23. List out the directive?
differences betweon function and inline code.
24. What is a Destructor?
25, List outthe two
steps necessAry to obtain
26. List the random number.
operaorsthat cannot be overloaded,
27. What istthe
difference between publicly derived and
28. Discuss about newand delete privately derived elass?
operator.
29. Explain Virtual Function,
30, Write about tellg () functin,
:3:
Section C (5x6=30 )
or (b) :
Answer all questionschoosing either (a)
with example.
Discuss about Constants and its various types
31. a)
(or)
Manipulator with example.
b) Explain setw)
Recursion with example.
32. a) Discuss about
(or)
Constructors with example.
b) Discuss about
Explain Array of Objects with an example.
33. a) overloading unary minus
(or) number using
program to negate a given
b) Write a C++
operator. inhertitance.
display Student details using Multiple
program to
34. a) Write a C+t (or)
Discuss about Pointers and Arrays.
b)
concept of Friend Classes with an example.
35. a) Explain the (or)
class.
b) Explain fstream
Section D (3x12 =36 )
questions :
Answer any THREE Programming.
Characteristics of Object Oriented
about
36. Describe in detail
Discuss about Scope and Storage Class.
37.
concatenate twO strings using operator overloading.
to
38. Write a C++ Program
about a) Address of operator b) Pointer to objects.
39. Discuss
Arguments.
Explain in detail about Command Line
40. $$$$***

You might also like