Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  In some phase of compilerInputtemp1:= Inttore... Start Learning for Free
In some phase of compiler 
Input
temp1 := Inttoreal (60)
temp2 := id3 * temp1 
temp3 := id2 + temp2
id1 := temp3
Output
temp 1 := id3 * 60.0
id1 := id2 + temp1
where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase is
  • a)
    Code optimizer
  • b)
    Code generator
  • c)
    intermediate code generator
  • d)
    None of the abov
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * tem...
Input:
temp1: = inttoreal(60)
temp2: = id3*temp1
temp3 : = id2 + temp2
id1 : = temp3
Output:
temp1 : = id3*60.0
id1 : id2 + temp1
The above phase is code optimization, because it is optimizing the intermediate code using only storages as temp 1 and id1.
View all questions of this test
Most Upvoted Answer
In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * tem...
Answer:
The correct answer is option 'A', which is Code Optimizer.

Explanation:
In the given code snippet, we can see the following operations being performed:

1. temp1 := Inttoreal (60) - This operation converts the integer value 60 to a real number and stores it in the temporary variable temp1.
2. temp2 := id3 * temp1 - This operation multiplies the value stored in identifier id3 with the value stored in the temporary variable temp1 and stores the result in the temporary variable temp2.
3. temp3 := id2 - This operation simply assigns the value stored in identifier id2 to the temporary variable temp3.
4. id1 := temp3 - This operation assigns the value stored in the temporary variable temp3 to the identifier id1.

From the given code snippet, it can be observed that there is no actual code generation happening. The code is simply performing some calculations and assignments using temporary variables and identifiers.

Therefore, the given phase can be classified as a Code Optimizer. The Code Optimizer is responsible for transforming the intermediate code to improve its efficiency, such as reducing the number of instructions, removing redundant code, and optimizing the overall performance of the code.

In this case, the code optimizer may optimize the code by eliminating unnecessary temporary variables and directly using the identifier values in the calculations. For example, instead of storing the result of id3 * temp1 in temp2 and then assigning it to id1, the optimizer may directly assign the value of id3 * temp1 to id1.

Hence, the correct answer is option 'A', Code Optimizer.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer?
Question Description
In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer?.
Solutions for In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice In some phase of compilerInputtemp1:= Inttoreal (60)temp2 := id3 * temp1temp3 := id2 + temp2id1 := temp3Outputtemp 1:= id3 * 60.0id1 := id2 + temp1where temp i , temp 2 , temp 3 are temporary storage, id1, id2, Id3 are identifier intto real is converting int 60 to real number. The above phase isa)Code optimizerb)Code generatorc)intermediate code generatord)None of the abovCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev