Classical

Compiler Design - Runtime environments

16:  

 In some programming languages, an identifier is permitted to be a letter followed by any number of letters or digits. If L and D denotes the sets of letters and digits respectively, which of the following expressions define an identifier ?

A.

( L∪ D ) *

B.

L ( L ∪  D)*

C.

( L . D )*

D.

L . ( L . D )*

 
 

Option: B

Explanation :


17:  

A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which one of the following is true ?

A.

a compiler using static memory allocation can be written for L

B.

a compiler cannot be written for L ; an interpreter must be used

C.

a compiler using dynamic memory allocation can be written for L

D.

none of these

 
 

Option: C

Explanation :


18:  

What are x and y in the following macro definition?
macro                            
  Add x, y
  Load y
  Mul x
  Store y
end macro

A.

variables

B.

identifiers

C.

actual parameters

D.

formal parameters

 
 

Option: D

Explanation :


19:  

 What is the value of X printed by the following program ?

program COMPUTE ( input, output );

var X : integer ;

procedure FIND ( X: real ) ;
             begin
                  X : = sqrt ( X ) ;
                                  end ;
              begin
                            X : = 2
                          FIND ( X )
                          writeln ( X )
             end

A.

2

B.

√2

C.

Run-time error

D.

none of these

 
 

Option: A

Explanation :


20:  

Which of the following macros can put a macro assembler into an infinite loop ?

A.

MACRO                    M1, X
IF EQ, X                    if X = 0 then....
M1  X + 1
ENDC
IF NE, X :                   IF X ≠ 0 then......
WORD X :                 address (X) is stored here
ENDC
ENDM

B.

MACRO M2, X
IF EQ, X
M2 X
ENDC
IF NE, X
WORD X + 1
ENDC
ENDM

C.

both (a) and (b)

D.

none of these

 
 

Option: B

Explanation :




Suggest an improvement