...
GATE 2014 [Set-3]
November 19, 2023
Software-Engineering
November 20, 2023
GATE 2014 [Set-3]
November 19, 2023
Software-Engineering
November 20, 2023

Question 12676 – Control-Statement

Given the pseudocode below for the function remains(), which of the following statements is true about the output, if we pass it a positive integer n > 2?
int remains(int n)
{
int x = n;
for (i=(n-1);i>1;i–) { x = x i;
}
return x;
}

Correct Answer: B

A
Output is always 0
B
Output is always 1
C
Output is 0 only if n is NOT a prime number
D
Output is 1 only if n is a prime number
E
None of the above
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x