Bcs201 CPP Model QP
Bcs201 CPP Model QP
Section A
Answer the following Questions. (1*25=25)
1. What is a programming paradigm?
a) Steps of solving a problem
b) Steps to programming
c) Steps to a programming language
d) Both a method of problem solving and an approach to programming language
design
2. This paradigm tells how to do something rather than what to do:
a) object-oriented
b) procedural
c) scripting
d) functional
3. Which of the following is the correct syntax to print the message in C++ language?
a) cout <<"Hello world!";
b) Cout << Hello world! ;
c) Out <<"Hello world!;
d) None of the above
4. Which of the following is the address operator?
a) @
b) #
c) &
d) %
5. Which of the following features must be supported by any programming language to
become a pure object-oriented programming language?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) All of the above
6. Which of the following is the original creator of the C++ language?
a) Dennis Ritchie
b) Ken Thompson
c) Bjarne Stroustrup
d) Brian Kernighan
7. Which of the following is the correct syntax to read the single character to console in the
C++ language?
a) Read ch()
b) Getline vh()
c) get(ch)
d) Scanf(ch)
8. Which of the following comment syntax is correct to create a single-line comment in the
C++ program?
a) //Comment
b) /Comment/
c) Comment//
d) None of the above
9. For inserting a new line in C++ program, which one of the following statements can be
used?
a) \n
b) \r
c) \a
d) None of the above
10. Which of the following is the correct syntax for declaring the array?
a) init array []
b) int array [5];
c) Array[5];
d) None of the above
11. Which types of arrays are always considered as linear arrays?
a) Single-dimensional
b) Multi-dimensional
c) Both A and B
d) None of the above
12. Which of the following can be considered as the members that can be inherited but
not accessible in any class?
a) Public
b) Protected
c) Private
d) Both A and C
13. Which of the following statement is not true about C++?
a) Members of a class are public by default
b) A class cannot have the private members
c) A structure can have the member functions
d) All of the above
14. Which of the following is not a kind of inheritance?
a) Distributed
b) Multiple
c) Multi-level
d) Hierarchal
15. What is a copy constructor?
a) A constructor that allows a user to move data from one object to another
b) A constructor to initialize an object with the values of another object
c) A constructor to check the whether to objects are equal or not
d) A constructor to kill other copies of a given object.
16. What happens if a user forgets to define a constructor inside a class?
a) Error occurs
b) Segmentation fault
c) Objects are not created properly
d) Compiler provides a default constructor to avoid faults/errors
17. What is the role of destructors in Classes?
a) To modify the data whenever required
b) To destroy an object when the lifetime of an object ends
c) To initialize the data members of an object when it is created
d) To call private functions from the outer world
18. What happens when objects s1 and s2 are added?
string s1 = "Hello";
string s2 = "World";
string s3 = (s1+s2).substr(5);
a) Error because s1+s2 will result into string and no string has substr() function
b) Segmentation fault as two string cannot be added in C++
c) The statements runs perfectly
d) Run-time error
19. What is operator overloading in C++?
a) Overriding the operator meaning by the user defined meaning for user defined
data type
b) Redefining the way operator works for user defined types
c) Ability to provide the operators with some special meaning for user defined data
type
d) All of the mentioned
20. Which of the following operator cannot be overloaded?
a) +
b) ?:
c) –
d) %
21. What is meant by multiple inheritance?
a) Class Re-usability
b) Creating a hierarchy of classes
c) Extendibility
d) All of the above
23. What is the scope of the variable declared in the user defined function?
a) Whole program
b) Only inside the {} block
c) The main function
d) None of the above
24. Constant function in C++ can be declared as
a) void display()
b) void display() const
c) const void display()
d) void const display()
25. Unary scope resolution operator is denoted by
a) !!
b) %%
c) :
d) ::
Section B
Answer any FIVE of the Questions. (10 *5=50)
26. What are the basics of object-oriented programming? Explain
27. What are the various categories of Operators available in C++? Explain.
28. Compare and contrast for, while and do-while looping statements.
29. Explain the concept of polymorphism by an example in C++
30. What is the significance of static data and member functions in C++?
31. Discuss the role of access specifies in inheritance and show their visibility when they are
inherited as public, private and protected.
32. Write a note on Constructors and destructors
33. What are virtual functions? Explain with an example.