COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of these is an incorrect Statement?
A
It is always necessary to use new operator to initialize an array.
B
Array can be initialized using comma separated expressions surrounded by curly braces.
C
Array can be initialized when they are declared.
D
None of the mentioned
Explanation: 

Detailed explanation-1: -Which of these is an incorrect Statement? Explanation: Array can be initialized using both new and comma separated expressions surrounded by curly braces example : int arr[5] = new int[5]; and int arr[] = 0, 1, 2, 3, 4;

Detailed explanation-2: -The incorrect statement is A) It is necessary to use a new operator to initialize an array. Explanation: A container object called an array carries a predetermined number of values of a single kind. When an array is constructed, its length is predetermined.

Detailed explanation-3: -int arr[] = new int[5]. Explanation: int arr[] = int [5] is an incorrect array declaration because Operator new must be succeeded by array type and array size.

Detailed explanation-4: -Which of these statement is incorrect? Explanation: Every class does not need to have a main() method, there can be only one main() method which is made public.

There is 1 question to complete.