Monday, March 7, 2016

CS8203 - Programing using C++ April May 2014

Anna University CS8203 - Programing using C++ April May 2014, Computer Science and Engineering, Second semester, BE/BTech Semester Examinations, Regulation 2012

Academic Year
April May 2014
Subject Code
CS 8203
Subject Name
Programming using C++
Computer Science and Engineering
Second Semester

Computer Science and Engineering
Second Semester
(Regulation 2012)
Time : 3 Hours                      Answer A L L Questions                Max. Marks 100
PART-A (10 x 2 = 20 Marks)

1. Give 4 expressions to access array elements.
2. Declare a pointer to a function which accepts one integer argument and returns an integer.
3. What is function prototype?
4. Differentiate class and structure.
5. Can a static member function access non static member variables? Justify.
6. How are data members initialized in C++?
7. What is an iterator?
8. Write 4 functions for manipulating file pointers. What is their use?
9. What is a generic function?
10. What is namespace ?

Part-B (5* 16 = 80 Marks)
11. a. Write a C program to swap 2 integers using function swap which takes the 2 integers as parameters. Print the swapped result in main. (8)
b. A file contains letters, digits and special characters. Write a C program to count the number of characters in the file. (8)

12. a.l. Explain the use of default arguments with suitable examples.
12.a.2. A class math has 2 integer members a and b; Initialise and display the data members. A friend function sum finds the sum of a and b and prints the result. Write the complete program to print the sum of the 2 members using sum.
12.b.l. A class X has an integer member a; A class Y has an integer member b; Initialise and display the data members. A friend function sum finds the sum of a and b and prints the result. Write the complete program.
12.b.2. Explain function over loading with examples.

13.a.l. Write a program to count the number of objects created. (5)
13.a.2. Class employee has name and age as data members. Print() is a pure virtual function. Class manager is inherited from employee. Manager is represented by his name, age and salary which is double. Class supervisor is inherited from employee. Supervisor is represented by his name, age and dept_name which is string. Write a program to implement the hierarchy and display the particulars of manager and supervisor objects. (11)
13. b. Explain any 4 forms of inheritance giving an example for each.

14.a.l. Explain the following giving an example for each : (11)
(i) multiple handlers (ii)restricting exceptions (iii) rethrowing an exception
14.a.2. Write a program to divide a/b. Raise an exception if b is 0. (5)
14.b.l. A class contains 2 generic members. Use constructor and show displays the data members. Write a program to display an object with float and int members and another object with int and char members. (8)
14.b.2. Write a generic function to swap the 2 parameters of any data type and display the swapped value in the function itself. Call the generic function from main to swap 2 integer values and 2 char values. (8)

15.a.1. Write a program to access a vector through iterator. Assign elements to the vector, display the vector and modify the contents of vector.
15.a.2. Write a C++ program to create class string with name and int length. Dynamically allocate memory for the data members; method disp() prints the name ; method join() takes 2 string objects as arguments and concatenates the name data member.
15.b.l. Write a C++ program to create a file ITEM and write name and cost fields into the file. Then read the file and display the details.
15.b.2. Explain any 3 ios format functions with an example for each.

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery