C++ Programming MCQs Test 3 _ Online C++ Programming Test - Studytonight
C++ Programming MCQs Test 3 _ Online C++ Programming Test - Studytonight
(/)
A. Pass by value
B. Pass by reference
C. Pass by value-result
Correct Answer : OPTION B, Pass by reference. As such C does not support pass by reference. But
it can be simulated by using pointers.
A. class output
B. character output
C. common output
D. call output
https://www.studytonight.com/cpp/tests/10# 1/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
#include <iostream>
using namespace std;
void main(void)
{
float m = 1.23;
abc(m);
cout << m;
}
C. prints 1.23
D. prints 1
A. Speed of execu on
https://www.studytonight.com/cpp/tests/10# 2/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
A. protected
B. public
C. private
A. protected
B. public
C. private
Q. For the below declarations, Which of the following statements is/are illegal?
https://www.studytonight.com/cpp/tests/10# 3/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
Declaration 1: char a;
Declaration 2: const char aa ='h';
Declaration 3: char *na;
Declaration 4: const char *naa;
Statement 1: aa = a;
Statement 2: na = &a;
Statement 3: na = &aa;
A. Only 1 and 2
B. Only 2 and 3
C. Only 1 and 3
A. Compila on error
C. Error at link me
https://www.studytonight.com/cpp/tests/10# 4/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
A. rand()%6
B. rand()%6+1
C. rand()%5+1
Correct Answer : OPTION B, rand()%6+1. It should randomly generate any integer between 1 and 6.
rand()%6 returns an integer from 0 to 5. To make it 1 to 6, we need to add 1.
A. rand()%(b-a)
B. (rand()%a) + b
C. (rand()%(b-a)) + a
D. (rand()%(b-a+1)) + a
A. A func on is declared inline by typing the keyword inline before the return value of the func on.
B. A func on is declared inline by typing the keyword inline a er the return value of the func on.
D. Inline func ons are essen ally same as implemen ng a func on as macro.
Correct Answer : OPTION A, A function is declared inline by typing the keyword inline before the
return value of the function.
https://www.studytonight.com/cpp/tests/10# 5/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
A. Compiler
B. Linker
C. Loader
D. Preprocessor
A. passing pointers
https://www.studytonight.com/cpp/tests/10# 6/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
SUBMIT TEST ()
What is Studytonight?
About Us (/about)
Authors (/authors)
Collaborate (/collaborate)
Testimonials (/testimonials)
Terms (/terms)
Contact Us (/contact)
Suggest (/suggest)
Tutorials
Android (/android)
C++ (/cpp)
Python (/python)
Servlet (/servlet)
More... (/library)
Tests
Android (/tests/?subject=android)
C++ (/tests?/?subject=cpp)
DBMS (/tests?/?subject=dbms)
C Language (/tests?/?subject=c)
More... (/tests)
Learn to Code
https://www.studytonight.com/cpp/tests/10# 7/8
9/13/2019 C++ Programming MCQs Test 3 | Online C++ Programming Test - Studytonight
HTML (/code/html)
CSS (/cascading-style-sheet/)
More... (/ ashcards)
https://www.studytonight.com/cpp/tests/10# 8/8