The Gateway to Computer Science Excellence
+1 vote
241 views

Consider the intermediate code given below:

The number of nodes and edges in the control-flow graph constructed for the above code, respectively are X and Y. The value of X + Y is ________.

in Compiler Design by Boss (25.3k points)
edited by | 241 views
+1
it will have 4 edges and 4 nodes.
0
yes.Although i selected wrong and later got 4 and 4 but ehy have given 5 and 5,which does not seem corr

ect
0
how you are getting 4 nodes

here are only 2 basic blocks possible a

block A , block B

(A) a=10

(A) b=15

(B) a= a+b

(B) b = a-b

(B) a = a-b

(B) if a==b goto 3

 

so answer should be 4   (2 nodes and 2 edges)
0

@Lone Wolf answer is 4 nodes and 4 edges, because you didn't consider start and end nodes and their respective edges.

1 Answer

0 votes
HERE THE TWO BASIC BLOCKS ARE FORMED SO THE TOTAL NUMBER OF NODES =#TOTAL NO. BASIC BLOCKS+START +END=4

TOTAL NUMBER OF EDGES=4

SO X=4 AND Y=4 X+Y=8 ANS
by (27 points)

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
50,648 questions
56,429 answers
195,208 comments
99,921 users