• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE | GATE-CS-2017 (Set 1) | Question 53

Consider the following grammar:
stmt  -> if expr then else expr; stmt | ε
expr -> term relop term | term
term -> id | number
id ->  a | b | c
number -> [0-9]

where relop is a relational operate (e.g < >, ….), ε refers to the empty statement, and if ,then, else are terminals. Consider a program P following the above grammar containing ten if terminals. The number of control flows paths in P is ____________. For example, the program
 if e1 then e2 else e3 
has 2 control flow paths, e1 -> e2 and e1 -> e3

(A)

20

(B)

1024

(C)

2048

(D)

10

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments