CS FundamentalsVery hardGATE CS · product placement
A control-flow graph has nodes 1-8 and edges 1→2; 2→3, 2→4, 2→5 (a switch); 3→6; 4→6; 5→6; 6→7, 6→8; 7→2 (loop back); node 8 is the exit. What is V(G)?
- A. 4
- B. 3
- C. 5
- D. 2
Correct answer: A. 4
E = 10 and N = 8, so V(G) = 10 - 8 + 2 = 4. By predicates, a node with 3 exits counts as 2 decisions: node 2 gives 2, node 6 gives 1, so 3 + 1 = 4. Counting predicate nodes (2) and adding 1 gives the wrong 3.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A UML class diagram shows Order with a filled (black) diamond connected to OrderLine with multiplicity 1.. on the OrderLine end. Which…
- In an ATM use-case diagram, 'Withdraw Cash' always performs 'Authenticate User', while 'Print Receipt' happens only when the customer asks…
- In a UML sequence diagram, how are a synchronous call, an asynchronous message and a return message usually drawn?
- In a UML activity diagram, after an order is paid, 'Pack items' and 'Send invoice' happen in parallel, and 'Ship' may start only when both…
- A class diagram shows a dashed line with a hollow triangle from PaymentService to the interface IPayment, and a solid line with a hollow…
- Student and Course have a many-to-many association with an association class Enrollment holding the grade. If 30 students each enrol in 4…