Run-Time-Environments

Question 1
Which one of the following is NOT performed during compilation?
A
Dynamic memory allocation
B
Type checking
C
Symbol table management
D
Inline expansion
       Compiler-Design       Run-Time-Environments       Gate 2014 Set -02
Question 1 Explanation: 
Dynamic memory allocation is not performed during compilation, it occurs at run time only. At the time of compilation, compiler only compiles the instructions for dynamic memory allocation, like calloc, malloc….
Question 2
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.
Program main;
  Var ...
  
    Procedure A1;
     Var ...
     Call A2;
    End A1
    
    Procedure A2;
      Var ...
  
      Procedure A21;
        Var ...
        Call A1;
        End A21
        
    Call A21;
  End A21
  
    Call A1;
  End main.
Consider the calling chain : Main->A1->A2->A21->A1 The correct set of activation records along with their access links is given by :
A
B
C
D
       Compiler-Design       Run-Time-Environments       Gate 2012
Question 2 Explanation: 

Main → A1 → A2 → A21 → A1
Since, Activation records are created at procedure exit time.
A1 & A2 are defined under Main ( ). So A1 & A2 access links are pointed to main.
A21 is defined under A2, hence its access link will point to A2.
Question 3
Which languages necessarily need heap allocation in the runtime environment?
A
Those that support recursion
B
Those that use dynamic scoping
C
Those that allow dynamic data structures
D
Those that use global variables
       Compiler-Design       Run-Time-Environments       2010
Question 3 Explanation: 
Dynamic memory is allocated on the heap by the system. So the languages which allow dynamic data structure require heap allocation at runtime.
Question 4
The use of multiple register windows with overlap causes a reduction in the number of memory accesses for I.Function locals and parameters II.Register saves and restores III.Instruction fetches
A
I only
B
II only
C
III only
D
I, II and III
       Computer-Organization       Run-Time-Environments       Gate-2008
Question 4 Explanation: 
I is true because when we make a function call there are some input registers and some output registers. If function F() is calling function G(), we can make the caller function F()'s output registers the same as the called procedure G()'s input registers this is done using overlapping register windows.This will reduce the memory accesses so that F()'s output need not be put into memory for G() to access again from memory.
II is false as register saves and restores would still be required for each and every variable.
III is also false as instruction fetch is not affected by memory access using multiple register windows.
Question 5
Which of the following are true? I.A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation II.Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being implemented has nesting of procedures/functions III.Recursion in programming languages cannot be implemented with dynamic storage allocation IV.Nesting procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records V.Programming languages which permit a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records
A
II and V only
B
I, III and IV only
C
I, II and V only
D
II, III and V only
       Compiler-Design       Run-Time-Environments       Gate-2008
Question 5 Explanation: 
II. Multilevel access link (or display) arrangement is needed to arrange Activation Records only if the programming language being implemented has nesting of procedures and functions.
V. PL’s which permits a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records.
II & V are True.
Question 6
Which of the following statements is FALSE?  
A
In statically typed languages, each variable in a program has a fixed type
B
In un-typed languages, values do not have any types
C
In dynamically typed languages, variables have no types
D
In all statically typed languages, each variable in a program is associated with values of only a single type during the execution of the program
       Compiler-Design       Run-Time-Environments       Gate-2003
Question 6 Explanation: 
Dynamic typed languages are those languages in which variable must necessarily be defined before they are used. Then dynamic typed languages have types.
Question 7
Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statically linked libraries?  
A
Smaller sizes of executable files
B
Lesser overall page fault rate in the system
C
Faster program startup
D
Existing programs need not be re-linked to take advantage of newer versions of libraries
       Compiler-Design       Run-Time-Environments       Gate-2003
Question 7 Explanation: 
Dynamic link libraries takes more time in program setup (in loading and linking phase to set up the global offset table and load and link the required libraries).
Question 8
In a resident – OS computer, which of the following systems must reside in the main memory under all situations?
A
Assembler
B
Linker
C
Loader
D
Compiler
       Compiler-Design       Run-Time-Environments       Gate-1998
Question 8 Explanation: 
In many operating system loader is permanently resident in memory.
Some OS may allow virtual memory may allow the loader to be located in a region of memory that is in page table.
Question 9

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 the above
       Compiler-Design       Run-Time-Environments       Gate-1997
Question 9 Explanation: 
Compiler is use dynamic memory allocation then the memory will be allocated to an array at runtime.
Question 10
Heap allocation is required for languages
A
that support recursion
B
that support dynamic data structures
C
that use dynamic scope rules
D
None of the above
       Compiler-Design       Run-Time-Environments       Gate-1997
Question 10 Explanation: 
Heap allocation is required for languages that support dynamic data structures.
Question 11
A linker is given object modules for a set of programs that were compiled separately. What information need to be included in an object module?
A
Object code
B
Relocation bits
C
Names and locations of all external symbols defined in the object module
D
Absolute addresses of internal symbols
       Compiler-Design       Run-Time-Environments       Gate-1995
Question 11 Explanation: 
In object module it includes names and locations of all external symbols defined in the object module.
To link to external symbols it must know the location of external symbols.
Question 12
The process of assigning load addresses to the various parts of the program and adjusting the code and date in the program to reflect the assigned addresses is called
A
Assembly
B
Parsing
C
Relocation
D
Symbol resolution
       Compiler-Design       Run-Time-Environments       Gate-2001
Question 12 Explanation: 
Relocation can change the assigned address of data and code in the program.
There are 12 questions to complete.
PHP Code Snippets Powered By : XYZScripts.com