Kerala University 2009 M.Sc Mathematics Computer Programming in C ++ - Question Paper
IHHHRU (Pages : 2) 4694
Reg. No. : Name :.....
Second Semester M.Sc. Degree Examination, August 2009 Branch : MATHEMATICS MM 224 : Computer Programming in C ++ (2005 Admn. Onwards)
Time: 3 Hours Max. Marks: 75
Instructions : Answer all questions choosing Part A or Part B from each question. All questions carry equal marks.
I. A) i) Explain user defined data types in C++ with appropriate examples. 8
ii) Write a program to accept 3 digits (0 - 9) and print all possible combinations from these digits. 7
OR
B) i) What is the difference between fundamental data types and derived data
types ? Explain with examples. 8
ii) Write a program to read two numbers and print their quotient and remainder. 7
II. A) i) What types of expressions can be formed in C++ ? Discuss each one of
them with examples. 8
ii) Write a C++ program to input a number. If the number is even, print its
square otherwise print its cube. 7
OR
B) i) Discuss console I/O function in detail. Support your answer with example. 8
ii) Write a C++ program to read a line of text from the keyboard and display the following information on the screen : i) Number of words ii) Number of characters. 7
III. A) i) Write a program to reverse a string : 8
i) Using another array ii) Without another array
ii) What is an array ? What is the need for array ? What are different types of array ? 7
OR
B) i) Write a program to print Fibonacci series. 8
ii) What is the purpose of brake statement ? Explain neatly using examples. 7
IV. A) i) Write a program that uses a function power ( ) to raise a number m to power n.
The function takes int value for m and n and returns the result correctly. Use a default value for 2 for n to make the function to calculate squares when this argument is omitted. Write a main ( ) to get the value for m and n from the user and to display the calculated result. 8
ii) Comment on passing of array as argument to C++ function. Support your answer taking an example. 7
OR
B) i) List the steps you would follow before using a function. Answer your question with the help of an example. What is the role of void keyword in declaring the function ? 8
ii) Write a C++ program that prints pyramid of digits. 7
V. A) i) Discuss the similarities and difference between global and local variable in
terms of their lifetime and scope. 8
ii) How can we use pointers to object of derived class ? Support your answer with an example. 7
OR
B) i) What does this pointer point to ? What are its applications ? Give example. 8 ii) What does polymorphism mean in C++ language ? 7
Attachment: |
Earning: Approval pending. |