Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  What does the following function do?a)It retu... Start Learning for Free
What does the following function do?
  • a)
    It returns 1 when n is a multiple of 3, otherwise returns 0
  • b)
    It returns 1 when n is a power of 3, otherwise returns 0
  • c)
    It returns 0 when n is a multiple of 3, otherwise returns 1
  • d)
    It returns 0 when n is a power of 3, otherwise returns 1
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
What does the following function do?a)It returns 1 when n is a multipl...
Lets solve with example, n = 27 which power of 3. First time if condition is false as n is neither equal to 0 nor equal to 1 then 27%3 = 0. Here, again if condition false because it is equal to 0. Then fun(27/3) will call. Second time if condition is false as n is neither equal to 0 nor equal to 1 then 9%3 = 0. Here again if condition false because it is equal to 0. Then fun (9/3) will call and third time if condition is false as n is neither equal to 0 nor equal to 1 then 3%3 = 0. Here again if condition false because it is equal to 0. Then fun(3/3) will call here n==1 if condition gets true and it return n i.e. 1. Option (B) is correct.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer?
Question Description
What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer?.
Solutions for What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer?, a detailed solution for What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What does the following function do?a)It returns 1 when n is a multiple of 3, otherwise returns 0b)It returns 1 when n is a power of 3, otherwise returns 0c)It returns 0 when n is a multiple of 3, otherwise returns 1d)It returns 0 when n is a power of 3, otherwise returns 1Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev