Programming 621 CA 23 test
Question 1 Not answered Marked out of 1.00 Flag question Question text 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; x<10; 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 #include<iostream> 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
Escuela, estudio y materia
- Institución
- Programming
- Grado
- Programming
Información del documento
- Subido en
- 11 de abril de 2025
- Número de páginas
- 36
- Escrito en
- 2024/2025
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
programming
-
programming 621 ca 23 test