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 :

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

shadab khan said: (3:28pm on Wednesday 20th November 2013)
plz explain the reason....why x and y are formal parameters....
saritha said: (11:39pm on Sunday 25th March 2018)
Formal parameters are the identifiers used in a method to stand for the values that are passed into the method by a caller.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here: