Professional Documents
Culture Documents
Assignment 1
Assignment 1
Assignment 1
i) cin>>a>>b;
ii) c = a + b;
iii) cout<<c;
iv) c = a – b;
2. “C++ uses the only compiler whereas, in Java, compiler and interpreter both
are used” – is this statement correct? Explain your answer briefly.
3. Discuss the base class access control mechanism.
4. What is polymorphism? How can we achieve polymorphism in C++?
Discuss different types of polymorphism with example.
5. Design a class named "Student" which have the following properties:
a. Name
b. Roll
c. CGPA
Now, declare an array of student so that information of 60 students can be
stored. Then, take input for every student and sort the array with respect to
Name.
6. What are the differences between pointer and reference? (Give example)
7. What is ambiguity in function overloading? Can we achieve overloading
without declaring multiple functions?
8. What is virtual inheritance? Explain with example.
9. "Static data member needs to be defined outside class but static function
members don’t need to be defined outside of class" - do you agree with the
statement? Write explanation to defend your answer.
10. Write a program that prints the following loop i) using for loop ii) using
while loop in C++ and JAVA.
1
23
456
7 8 9 10