Ticker

6/recent/ticker-posts

Hpsc lecturer paper solution(4)

 Q1 Which one of the following is a

top-down parser?

[A] Recursive descent parser

[B] Operator precedence parser

[C] An LR(k) parser

[D] An LALR(k) parser

Solution

Predictive parser and recursive descent parser are example of top-down parser. Whereas LR(k) and LALR(k) parser are bottom up parser.

Q2 Whenever a procedure is

executed, its activation record is

stored on the stack, also known as

[A] Access Stack

[B] Control Stack

[C] Formal Stack

[D] Return Stack


Solution

The execution of a procedure is called its activation. An activation record contains all the necessary information required to call a procedure. An activation record may contain the following units (depending upon the source language used).


Temporaries Stores temporary and intermediate values of an expression.

Local Data Stores local data of the called procedure.

Machine Status Stores machine status such as Registers, Program Counter etc., before the procedure is called.

Control Link Stores the address of activation record of the caller procedure.

Access Link Stores the information of data which is outside the local scope.

Actual Parameters Stores actual parameters, i.e., parameters which are used to send input to the called procedure.

Return Value Stores return values.

Whenever a procedure is executed, its activation record is stored on the stack, also known as control stack.

Q3How are system calls invoked?

[A] By a privileged instruction

[B] With an indirect jump

[C] Through a software interrupt

[D] Through polling

Solution

System calls are usually invoked by using software interrupt.A software interrupt occurs when an application program terminates on request certain services from the operating system.In a personal computer a hardware interrupt request has a value that associates it with a particular device.A system calls is the programmatic way in which a computer program requests a service from the kernel of os it executed on.system calls provides an essential interface b/w a process and the os.

Q4The time required to create a new

thread in an existing process is

[A] greater than the time required

to create a new process

[B] less than the time required to

create a new process

[C] equal to the time required to

create a new process

[D] double the time required to

create a new process

Solution

The new thread shares the same virtual address space as the existing process.It does not required loading the executable code and data into memory again(less than the time required to create a new process .



Post a Comment

0 Comments