Object Oriented Programming - Dec 2014
Computer Engg (Semester 3)
TOTAL MARKS: 100
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks.
Answer any one question from Q1 and Q2
1 (a) What is a friend function? How do you declare one? When is friend function compulsory? Give an example.(6 marks)
1 (b) What is virtual function? Why do we need virtual functIon When do we make a virtual function 'pure' ? What are the implications of making a function a pure virtual function?(6 marks)
2 (a) Write short notes on:
i) 'this' pointer
ii) Copy constructor.(6 marks) 2 (b) What is operator overloading? Name the operators that cannot be overloaded in C++? How do you declare an overloaded stream insertion and extraction operator?(6 marks)
Answer any one question from Q3 and Q4
3 (a) Distinguish between overloaded functions and function templates. Write a function template for finding the minimum value contained in an array.(6 marks) 3 (b) Draw the state diagram for the process. Explain each process state briefly.(6 marks) 4 (a) What is an exception ? How is an exception handled in C++ ? What are the advantages of using exception handling mechanism in program?(6 marks) 4 (b) How can we create a child process from parent process ?Describe parent-child relation.(6 marks)
Answer any one question from Q5 and Q6
5 (a) What do you mean by threads? Write a threaded program in C++ and explain Pthread_join( ) function.(7 marks) 5 (b) Compare threads and processes. Describe thread attributes.(6 marks) 6 (a) How can we pass command line arguments to the thread function? Determine the number of threads using command line argument.(7 marks) 6 (b) What are the types of thread? Describe in brief.(6 marks)
Answer any one question from Q7 and Q8
7 (a) What is meant by critical section? How can we manage critical section using mutex semaphor?(6 marks) 7 (b) Enlist concurrency models. Write a short note on any two.(7 marks) 8 (a) Can all threads in the process share global data, variables, and data structure? If yes, explain with an example.(6 marks) 8 (b) Describe the basic functions of POSIX message queue.(7 marks)