• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 36 pages
Exam (elaborations)

M-Commerce 512

Document preview thumbnail
Preview 4 out of 36 pages

What punctuation ends most lines of C++ code? Select one: a. '(single quote) b. :(colon) c. .(dot) d. ;(semi-colon) Feedback The correct answer is: ;(semi-colon) Question 2 Not answered Marked out of 1.00 Flag question Question text If you use same variable for two getline statements Select one: a. You can not use same variable for two getline statements b. The second input attempt fails since the variable already got its value c. Both the inputs are stored in that variable d. The second input overwrites the first one Feedback The correct answer is: The second input overwrites the first one Question 3 Not answered Marked out of 1.00 Flag question Question text What is polymorphism in object oriented programming? Select one: A. Pogramming using objects and classes to provide a well documented program. B. Is a form of software reuse in which new classes absorb the data and behaviors of existing classes and embellish these classes with new capabilities. C. Involves a base-class pointer or reference to invoke virtual functions on base-class and derived-class object. D. Classe that provides a base class from wich other classes can inherit. Feedback The correct answer is: Involves a base-class pointer or reference to invoke virtual functions on base-class and derived-class object. Question 4 Not answered Marked out of 1.00 Flag question Question text Which of the following is selection statement in C++? Select one: a. exit b. break c. switch d. goto Feedback The correct answer is: switch Question 5 Not answered Marked out of 1.00 Flag question Question text When following piece of code is executed, what happens? b = 3; a = b++; Select one: a. a contains 4 and b contains 3 b. a contains 3 and b contains 4 c. a contains 3 and b contains 3 d. a contains 4 and b contains 4 Feedback The correct answer is: a contains 3 and b contains 4 Question 6 Not answered Marked out of 1.00 Flag question Question text When deriving a class from a base class with protected iheritance, public members of base class become________members of the derived class, and protected members of the base class become________members of the derived class. Select one: A. protected, public B. protected, protected C. public, protected D. public, public Feedback The correct answer is: protected, protected Question 7 Not answered Marked out of 1.00 Flag question Question text What is the final value of x when the code int x; for(x=0; x10; x++) {} is run? Select one: a. 10 b. 1 c. 9 d. 0 Feedback The correct answer is: 10 Question 8 Not answered Marked out of 1.00 Flag question Question text Which of the following is not a looping statement in C++? Select one: a. until b. do c. while d. for Feedback The correct answer is: until Question 9 Not answered Marked out of 1.00 Flag question Question text If an array of objects is of size 10 and a data value have to be retrieved from 5th object then ________________ syntax should be used. Select one: A. Array_Name[4].data_variable_name; B. Array_Name[4].data_variable_; C. Array_Name[4].data_variable_name(value); D. Data_Type Array_Name[4].data_variable_name; Feedback The correct answer is: Array_Name[4].data_variable_name; Question 10 Not answered Marked out of 1.00 Flag question Question text What will be the output of the following C++ code? #include iostream using namespace std; void square (int *x, int *y) { *x = (*x) * --(*y); } int main ( ) { int number = 30; square(&number, &number); cout number; return 0; } Select one: A. 870 B. 9 C. 920 D. 30 Feedback The correct answer is: 870 Question 11 Not answered Marked out of 1.00 Flag question Question text You must specify void in parameters if a function does not have any arguments. Select one: a. False b. True Feedback The correct answer is: False Question 12 Not answered Marked out of 1.00 Flag question Question text Which of the following is output statement in C++? Select one: a. write b. cin c. cout d. print Feedback The correct answer is: cout Question 13 Not answered Marked out of 1.00 Flag question Question text Variables inside parenthesis of functions declarations have _____ level access. Select one: a. Universal b. Global c. Module d. Local Feedback The correct answer is: Local Question 14 Not answered Marked out of 1.00 Flag question Question text A template class Select one: a. is designed to be stored in different containers b. generates objects which must be identical c. generates classes with different numbers of member functions. d. works with different data types Feedback The correct answer is: works with different data types Question 15 Not answered Marked out of 1.00 Flag question Question text Observe following function declaration and choose the best answer: int divide ( int a, int b = 2 ) Select one: a. Variable b is international scope and will have value 2 b. Variable a and b are of int type and the initial value of both variables is 2 c. Variable b will have value 2 if not specified when calling function d. Variable b is of integer type and will always have value 2 Feedback The correct answer is: Variable b will have value 2 if not specified when calling function Question 16 Not answered Marked out of 1.00 Flag question Question text A virtual class is the same as Select one: a. a base class b. an abstract class c. a class with a virtual function d. none of the option. Feedback The correct answer is: none of the option. Question 17 Not answered Marked out of 1.00 Flag question Question text Predict the output of following C++ program #includeiostream using namespace std; class Empty {}; int main() { cout sizeof(Empty); return 0; } Select one: A. Runtime Error B. 0 C. A non-zero value D. Compiler Error Feedback The correct answer is: A non-zero value Question 18 Not answered Marked out of 1.00 Flag question Question text A copy constructor takes Select one: a. arbitrary no. of arguments b. two arguments c. one argument d. no argument Feedback The correct answer is: one argument Question 19 Not answered Marked out of 1.00 Flag question Question text The major goal of inheritance in c++ is: Select one: a. To extend the capabilities of a class. b. To facilitate the conversion of data types. c. To hide the details of base class. d. To help modular programming. Feedback The correct answer is: To extend the capabilities of a class. Question 20 Not answered Marked out of 1.00 Flag question Question text Name the header file to be included for the use of built in function isalnum() Select one: a. process.h b. string.h c. dos.h d. ctype.h Feedback The correct answer is: ctype.h Question 21 Not answered Marked out of 1.00 Flag question Question text What will be the result of the expression 13 & 25? Select one: a. 38 b. 12 c. 25 d. 9 Feedback The correct answer is: 9 Question 22 Not answered Marked out of 1.00 Flag question Question text Which of the following statement is valid? Select one: a. We can change the associativity of the C++ operators. b. We can not change operator templates. c. We can change the precedence of the C++ operators. d. We can create new C++ operators. Feedback The correct answer is: We can not change operator templates. Question 23 Not answered Marked out of 1.00 Flag question Question text What is the syntax to use explicit class specialization? Select one: A. template int class myClassint{ } B. template class myClassint{ } C. template int class myClass{ } D. template class myClass{ } Feedback The correct answer is: template class myClassint{ } Question 24 Not answered Marked out of 1.00 Flag question Question text What is the output of given code fragment? int f=1, i=2;while(++i5) f*=i; coutf; Select one: a. 3 b. 24 c. 6 d. 12 Feedback The correct answer is: 12 Question 25 Not answered Marked out of 1.00 Flag question Question text What is the output of this program? #include iostream using namespace std; class poly { protected: int width, height; public: void set_values(int a, int b) { width = a; height = b; } }; class Coutput { public: void output(int i); }; void Coutput::output(int i) { cout i; } class rect:public poly, public Coutput { public: int area() { return(width * height); } }; class tri:public poly, public Coutput { public: int area() { return(width * height / 2); } }; int main() { rect rect; tri trgl; _values(3, 4); _values(4, 5); t(()); t(()); return 0; } Select one: a. none of the mentioned b. 1210 c. 1212 d. 1010 Feedback The correct answer is: 1210 Question 26 Not answered Marked out of 1.00 Flag question Question text Does following code show multiple inheritance? class A { int a; }; class B { int b; }; class C:public A, public B { int c; }; class :public C { int d; }; Select one: A. No, multiple inheritance is used with class A, B and C B. Yes, class C and class D C. Yes, All together it’s multilevel D. No, 4 classes are used Feedback The correct answer is: No, multiple inheritance is used with class A, B and C Question 27 Not answered Marked out of 1.00 Flag question Question text What is the output of this program? #include iostream using namespace std; int main() { char arr[20]; int i; for(i = 0; i 10; i++) *(arr + i) = 65 + i; *(arr + i) = '0'; cout arr; return(0); } Select one: a. AAAAAAAAAA b. none of the mentioned c. ABCDEFGHIJ d. JJJJJJJJ Feedback The correct answer is: ABCDEFGHIJ Question 28 Not answered Marked out of 1.00 Flag question Question text Which of the following advantages we lose by using multiple inheritance? Select one: a. Dynamic binding b. Polymorphism c. Dynamic binding & Polymorphism d. None of the option mentioned Feedback The correct answer is: Dynamic binding & Polymorphism Question 29 Not answered Marked out of 1.00 Flag question Question text Which one of the following is not a possible state for a pointer. Select one: a. point to a tye b. hold the address of the specific object c. point one past the end of an object d. zero Feedback The correct answer is: point to a tye Question 30 Not answered Marked out of 1.00 Flag question Question text What is meant by multiple inheritance? Select one: a. None of the option mentioned b. Deriving a derived class from base class c. Deriving a derived class from more than one base class d. Deriving a base class from derived class Feedback The correct answer is: Deriving a derived class from more than one base class Question 31 Not answered Marked out of 1.00 Flag question Question text What is the output of this program? #include iostream #include vector using namespace std; class Component { public: virtual void traverse() = 0; }; class Leaf: public Component { int value; public: Leaf(int val) { value = val; } void traverse() { cout value ' '; } }; class Composite: public Component { vector Component * children; public: void add(Component *ele) { _back(ele);


Document information

Uploaded on
April 13, 2025
Number of pages
36
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Terry75
4.5
(14)
Sold
79
Followers
1
Items
1378
Last sold
2 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions

Whoops! We can’t load your doc right now. Try again or contact support.