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


Test Description

10 Questions MCQ Test Question Bank for GATE Computer Science Engineering | Test: Programming in C++, C & Java- 1

Test: Programming in C++, C & Java- 1 for Computer Science Engineering (CSE) 2022 is part of Question Bank for GATE Computer Science Engineering preparation. The Test: Programming in C++, C & Java- 1 questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Programming in C++, C & Java- 1 MCQs are made for Computer Science Engineering (CSE) 2022 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Programming in C++, C & Java- 1 below.
Solutions of Test: Programming in C++, C & Java- 1 questions in English are available as part of our Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) & Test: Programming in C++, C & Java- 1 solutions in Hindi for Question Bank for GATE Computer Science Engineering course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Programming in C++, C & Java- 1 | 10 questions in 30 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
1 Crore+ students have signed up on EduRev. Have you?
Test: Programming in C++, C & Java- 1 - Question 1

Choose the correct statements:

Detailed Solution for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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 for Test: Programming in C++, C & Java- 1 - 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.

Use Code STAYHOME200 and get INR 200 additional OFF
Use Coupon Code
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