Computer Sciences > GATE 2025 SET-1 > Intermediate Code Generation
Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is ______ (Answer in integer)
1001:i=1
1002:j=1
1003:t1=10*i
1004:t2=t1+j
1005:t3=8*t2
1006:t4=t3-88
1007:a[t4]=0.0
1008:j=j+1
1009:if j<=10 goto 1003
1010:i=i+1
1011:if i<=10 goto 1002
1012:i=1
1013:t5=i-1
1014:t6=88*t5
1015:a[t6]=1.0
1016:i=i+1
1017:if i<=10 goto 1013

Correct : 4

To identify basic blocks, we find leaders (starting points) and group consecutive statements until a jump or branch. Leaders include the first statement, targets of jumps, and statements immediately following conditional jumps.

The leaders in this code are at lines 1001, 1002, 1003, 1010, 1012, and 1013. This creates six basic blocks: Block 1 (line 1001), Block 2 (line 1002), Block 3 (lines 1003-1009), Block 4 (lines 1010-1011), Block 5 (line 1012), and Block 6 (lines 1013-1017).

βœ… Final Answer: 6

Reason: Each leader starts a new basic block, and consecutive statements without control flow changes belong to the same block.

Similar Questions

The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r / 3 + s - t * 5 + u *...
#1136 NAT
A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......