The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+13 votes
1.4k views

Choose the correct alternatives (more than one may be correct) and write the corresponding letters only:

Indicate all the true statements from the following:

  1. Recursive descent parsing cannot be used for grammar with left recursion.
  2. The intermediate form for representing expressions which is best suited for code optimization is the postfix form.
  3. A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation.
  4. Although C does not support call-by-name parameter passing, the effect can be correctly simulated in C
  5. No feature of Pascal typing violates strong typing in Pascal.
asked in Compiler Design by Veteran (59.7k points)
edited by | 1.4k views
0
A B C are correct. am i wrong?
+1
B has to be true ....since postfix form enables the scanner read the expression in single pass. am I right?
+1
difficult tag should be made as normal
0
Does dynamic data type refers to structure ,union??

2 Answers

+15 votes
Best answer
  1. is TRUE. Left recursive grammars if used directly in recursive descent parsing causes an infinite loop. So, left recursion must be removed before giving to a recursive descent parser.
     
  2. is a strong statement- but I do not have any proof or reference for this- so for now I consider this FALSE.
     
  3. is false. The language can have dynamic datatypes which requires dynamically growing memory when data type size increases.
     
  4. is true and using macro we can do this.
     
  5. out of syllabus now,
answered by Veteran (367k points)
edited by
0
@Arjun @Kapil is B true ??
0
arjun sir plz explain call by name??
0
@Arjun sir , i didnt get ur 3rd point ,what really a dynamic datatype is??
0
@arjun sir any example of dynamic datatypes?
+1
  1. The intermediate form for representing expressions which is best suited for code optimization is the postfix form.

For B I think most appropriate form would be DAG for code optimization.

0
@tusharp

any reference for it
0
  1. A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation.

But dynamic allocation happens only with the use or pointers right...as dynamic allocation return address of memory allocated at run time...if there are no pointers then how can we use dymanic allocation ...

0

A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation.

 @jatin khachane 1 but there is a chance if language uses STL as c++. Though pointer and recursion is not needed, but if language supports dynamic arrays(vectors from STL) it will need dynamic memory allocation right?

Given statement is true coming to recursion and pointer. But it says dynamic memory is needed only for these two is wrong.

0
That says

1 If language doesn't have rec or pointers still we need dynamic memory for some other datatypes

2 For using dynamic allocation , language need not necessarily support pointers ..
0

A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation

Lets make use of logic here

p :  A programming language not supporting either recursion or pointer type 

q:  does not need the support of dynamic memory allocation

Your statement 1 violates p -> q (which is the case here and hence it is False.)

Your second statement says q ->p

Is p ->q == q ->p ? No

Your second inference is not correct.

Analogy :

If john is sick, he will be at home.

That doesn't mean if he is at home then John is sick

 

+3 votes
A for sure, not sure about E
answered by Loyal (6.9k points)
0
why not d?
0
transferring an expression to the function for lazy evaluation cannot be simulated directly in C. Off course it can be done by sending expression as string, but for that matter anything that can be implemented in C, as it is an LBA
0
We can use a macro and then include the function body rt?
0
I guess I need to go through macro details to say anything.
0
ok :)
0
what about option b & c ?? They both are also true right ??
0
I know about call by name , but can you explain statement d ? please.

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,062 questions
49,583 answers
162,856 comments
65,776 users