Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Test  >  GATE Computer Science Engineering(CSE) 2027 Mock Test Series  >  Test: Programming in C++, C & Java- 1 - Computer Science Engineering (CSE) MCQ

GATE Computer Science Engineering(CSE) 2027 Test: Programming in C++, C


MCQ Practice Test & Solutions: Test: Programming in C++, C & Java- 1 (10 Questions)

You can prepare effectively for Computer Science Engineering (CSE) GATE Computer Science Engineering(CSE) 2027 Mock Test Series with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: Programming in C++, C & Java- 1". These 10 questions have been designed by the experts with the latest curriculum of Computer Science Engineering (CSE) 2026, to help you master the concept.

Test Highlights:

  • - Format: Multiple Choice Questions (MCQ)
  • - Duration: 30 minutes
  • - Number of Questions: 10

Sign up on EduRev for free to attempt this test and track your preparation progress.

Test: Programming in C++, C & Java- 1 - Question 1

Choose the correct statements:

Detailed Solution: Question 1

Enum variable type is a special flavor of a long type variable with an enum, we can specify a number of valid values for that variable and descripted constant names for the values of the enum. These values are used instead of constant. Enum variable can be declared. The advantage of enum is it provide logical clarity of a program.

Test: Programming in C++, C & Java- 1 - Question 2

Consider the following statements:
# define hypotenuse (a, b) sqrt (a*a + b*b);
The macro-call hypotenuse (a + 2, b + 3);

Detailed Solution: Question 2

The macro call will be expanded as
sqrt (a + 2 * a + 2 + b + 3 * b + 3)
i.e. sqrt (3 * a + 4 * b + 5).

Test: Programming in C++, C & Java- 1 - Question 3

For the previous question, which of the following macro-calls, will find the hypotenuse of a right angled triangle with sides a + 1 and b + 1 ?

Detailed Solution: Question 3

Hypotenuse of right angles triangle (a+1), (b+1) will be
h = (a + 1)2 + (b + 1)2
= a2 + 2a + 1 + b2 + 2b + 1
= a2 + b2 + 2a + 2b + 2
which is not generated by any option.

Test: Programming in C++, C & Java- 1 - Question 4

If p is pointer to an integer and t is a pointer to a character then size of (p) will be

Detailed Solution: Question 4

Pointer to an integer and pointer to a character are equivalent when the context of size of operator is used.

Test: Programming in C++, C & Java- 1 - Question 5

Which of the following comments about arrays and pointers is/are true?
1. Both are exactly same.
2. Array is a constant pointer.
3. Pointer is an one-dimensional array.
4. Pointer is a dynamic array.

Detailed Solution: Question 5

Array and pointer are same in implementation. By using pointer we can access any of the index array. Array is a constant pointer and pointer is a one dimensional dynamic array.

Test: Programming in C++, C & Java- 1 - Question 6

It is not advisable to use macros instead of functions because

Detailed Solution: Question 6

With macro no recursion is possible, pointers cannot be used with macro identifiers and no type checking will be done and it increase the code size. So, function will be advisable to used instead of macro.

Test: Programming in C++, C & Java- 1 - Question 7

Use of macro instead of function is recommended

Detailed Solution: Question 7

Macro will reduce the execution time and can be used when there is a loop with a function call inside.

Test: Programming in C++, C & Java- 1 - Question 8

The number of additions performed by the above program fragment is

Detailed Solution: Question 8

Addition will performed: 
d = d + 1
= 9000 times
++z = 30 times
++j = 30 x 30 times
++K = 30 x 30 x 30 times
i + j + k = (30 x 30 x 30) x 2 
So,
Total = 9000 + 900 + 30 + (27000 + 2 x 27000)
= 9930 + (3 x 27000)

Test: Programming in C++, C & Java- 1 - Question 9

The following program: 

Detailed Solution: Question 9

Like array name, name of a function is a pointer to it. The given program results in starting address of function main (), which is pointer to it.

Test: Programming in C++, C & Java- 1 - Question 10

Which of the following is false?

Detailed Solution: Question 10

Since address to some of the variable assigned at run time which is assigned by operating system. Two variable can have same address at different instance of time.

56 docs|215 tests
Information about Test: Programming in C++, C & Java- 1 Page
In this test you can find the Exam questions for Test: Programming in C++, C & Java- 1 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Programming in C++, C & Java- 1, EduRev gives you an ample number of Online tests for practice
Download as PDF