UGC NET CS 2014 Dec – paper3
October 6, 2023ProgrammingforOutputProblems
October 6, 2023ProgrammingforOutputProblems
Question 30

Consider the following C code segment:
For the program fragment above, which of the following statements about the variables i and j must be true after the execution of this program? [!(exclamation) sign denotes factorial in the Solution]
For the program fragment above, which of the following statements about the variables i and j must be true after the execution of this program? [!(exclamation) sign denotes factorial in the Solution]
( j=(x1)!) ∧ (i>=x)


( j = 9!) ∧ (i =10)


(( j = 10!) ∧ (i = 10 )) V (( j = (x – 1)!) ∧ (i = x ))


(( j = 9!) ∧ (i = 10)) V (( j = (x – 1)!) ∧ (i = x ))

Question 30 Explanation:
As per code segment,
Step1: The ith loop will compute from value 1 to 9. If the condition is true, then it computes j=j*i statement.
Step2: The statement j=j*i is nothing but calculating 9!. If the condition fails automatically while loop will be terminated. It means maximum we can execute 9 values.
Step3: when x becomes 10 then maximum I value will be 9. So, we can calculate up to 9!
And I become 10 then it terminates the condition.
Step1: The ith loop will compute from value 1 to 9. If the condition is true, then it computes j=j*i statement.
Step2: The statement j=j*i is nothing but calculating 9!. If the condition fails automatically while loop will be terminated. It means maximum we can execute 9 values.
Step3: when x becomes 10 then maximum I value will be 9. So, we can calculate up to 9!
And I become 10 then it terminates the condition.
Correct Answer: D
Question 30 Explanation:
As per code segment,
Step1: The ith loop will compute from value 1 to 9. If the condition is true, then it computes j=j*i statement.
Step2: The statement j=j*i is nothing but calculating 9!. If the condition fails automatically while loop will be terminated. It means maximum we can execute 9 values.
Step3: when x becomes 10 then maximum I value will be 9. So, we can calculate up to 9!
And I become 10 then it terminates the condition.
Step1: The ith loop will compute from value 1 to 9. If the condition is true, then it computes j=j*i statement.
Step2: The statement j=j*i is nothing but calculating 9!. If the condition fails automatically while loop will be terminated. It means maximum we can execute 9 values.
Step3: when x becomes 10 then maximum I value will be 9. So, we can calculate up to 9!
And I become 10 then it terminates the condition.
Subscribe
Login
0 Comments