Explore topic-wise MCQs in Makemytrip.

This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Makemytrip knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the complexity of this algorithm? Algorithm Sum (a,n) { s := 0.0; for i := 1 to n do s := s + a [i]; return s;

A. log2n
B. O(n)
C. O(n log n)
D. O(kn)
Answer» C. O(n log n)
2.

Assume that the Point class is existing with the following snippet in the header file Point.h: class Point { Point(); Pont(int, int); int GetX(); int GetY(); void SetX(int); void SetY(int); }; If the objects of Point are created as Point oPointOne, oPointTwo(2,3); Which of the following statements are correct? (i)The statement oPointOne.SetX(20); Will compile and run successfully. (ii) The statement oPointOne.SetX(20).SetY(30); Will compile successfully but will give a run time error.

A. Only (i) is correct
B. Both (i) and (ii) are correct
C. Both (i) and (ii) are incorrect
D. Only (ii) is correct
Answer» B. Both (i) and (ii) are correct
3.

What will be output of following program? #include int main() { int huge *a =(int huge *)0x59990005; int huge *b =(int huge *)0x59980015; if(a == b) printf("power of pointer"); else printf("power of c"); return 0; }

A. power of pointer
B. power of c
C. power of c power of c
D. Compilation error
Answer» B. power of c
4.

Predict the output of following C++ program. #include  using namespace std; class abc { static int x; public: abc() { x++;} static int getX() {return x;} }; int Test::x = 0; int main() { cout << abc::getX() << " "; abc t[5]; cout << abc::getX(); }

A. 55
B. 55
C. 05
D. 50
Answer» D. 50
5.

Which of the following statements is true after execution of the program? int a[10],I,*p; a[0] = 1; a[1] = 2; p = a; (*p)++;

A. a[0] = 2
B. a[1] = 3
C. a[1] = 1
D. a[0] = 3
Answer» B. a[1] = 3
6.

Shantanu wants to make a program to print the sum of the first 7 multiples of 6. He writes the following program: integer i = 0 // statement 1 integer sum // statement 2 while ( i <= 42 ) // statement 3 { sum = sum + i // statement 4 i = i + 6; } print sum // statement 6 Does this program have an error? If yes, which one statement will you modify to correct the program?

A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
Answer» C. Statement 3
7.

What is the complexity of this algorithm? Algorithm Sum (a,n) { s := 0.0; for i := 1 to n do s := s + a [i]; return s;

A. log2n
B. O(n)
C. O(n log n)
D. O(kn)
Answer» C. O(n log n)
8.

Assume that the Point class is existing with the following snippet in the header file Point.h: class Point { Point(); Pont(int, int); int GetX(); int GetY(); void SetX(int); void SetY(int); }; If the objects of Point are created as Point oPointOne, oPointTwo(2,3); Which of the following statements are correct? (i)The statement oPointOne.SetX(20); Will compile and run successfully. (ii) The statement oPointOne.SetX(20).SetY(30); Will compile successfully but will give a run time error.

A. Only (i) is correct
B. Both (i) and (ii) are correct
C. Both (i) and (ii) are incorrect
D. Only (ii) is correct
Answer» B. Both (i) and (ii) are correct
9.

What will be output of following program? #include int main() { int huge *a =(int huge *)0x59990005; int huge *b =(int huge *)0x59980015; if(a == b) printf("power of pointer"); else printf("power of c"); return 0; }

A. power of pointer
B. power of c
C. power of c power of c
D. Compilation error
Answer» B. power of c
10.

Predict the output of following C++ program. #include  using namespace std; class abc { static int x; public: abc() { x++;} static int getX() {return x;} }; int Test::x = 0; int main() { cout << abc::getX() << " "; abc t[5]; cout << abc::getX(); }

A. 55
B. 55
C. 05
D. 50
Answer» D. 50
11.

Which of the following statements is true after execution of the program? int a[10],I,*p; a[0] = 1; a[1] = 2; p = a; (*p)++;

A. a[0] = 2
B. a[1] = 3
C. a[1] = 1
D. a[0] = 3
Answer» B. a[1] = 3
12.

Shantanu wants to make a program to print the sum of the first 7 multiples of 6. He writes the following program: integer i = 0 // statement 1 integer sum // statement 2 while ( i <= 42 ) // statement 3 { sum = sum + i // statement 4 i = i + 6; } print sum // statement 6 Does this program have an error? If yes, which one statement will you modify to correct the program?

A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
Answer» C. Statement 3