Freshers Jobs | AMCAT | Fresherworld | JEE | NEET | GATE & CAT

AMCAT coupon code --> ALP50 | Freshersworld Discount Code --> AFF1451AGI
TechMario UpdatesAMCAT Discount Code (ALP50) - get flat off TechMario UpdatesFreshersworld Coupon Code (AFF1451AGI) - - get flat 100 off TechMario UpdatesGovt Jobs- सरकारी नौकरियों के लिए यहां क्लिक करें

AMCAT Iteration Recursion Decision Questions 2018 with Answers

AMCAT Iteration Recursion Decision Questions 2018: To make any logic or code work in Computer programming, you should have sound knowledge on iteration, recursion, and decision statements. Here we will elaborate on this topic. Also we will discuss on the sample questions.

AMCAT Iteration Recursion Decision Questions with Answers

AMCAT Iteration Recursion Decision Questions

AMCAT Iteration Recursion Decision Questions

Iteration, recursion,and decision statements aids in reducing the size of code. It also minimizes the complexity of the program. Using these statements, not only reduces space usage, but also the time of execution.

In AMCAT, 2-3 questions are asked from this topic.The difficulty level also varies from easy to average.

No of Questions Asked: 2-3 questions

Level of Difficulty: easy to average

About Iteration, Recursion, Decision

In Computer Programming, when we write codes, there are a few sections in the program that needs to be repeated again. In that case we can make use of recursive functions. So instead of writing the same code 3-4 times in a single code, we should write it once, and call this function where ever necessary.

Iteration is also called looping process. Here a certain section of the code repeats itself, till the specified number of times. For example it can be used to fetch a value from a row or column in a table.
There are 3 looping procedures

  • For loop
    for(i=0, i<10,i++)
  • While loop
    {statements }
  • Do-while loop

Decision making statements decide the flow of the code at runtime. This is used in scenarios where if a particular condition is true, then a certain set of statement has to be executed, or vice versa. It can be used in following three formats-

  • if..else
  • if..elseif..else
  • nested ifs
    { if(true)

Iteration, Recursion, Decision helps in reducing the length and size of the code.

Download AMCAT Iteration Recursion Decision Questions with solution

AMCAT Iteration Recursion Decision Questions pdf

Practice Questions for AMCAT Iteration, Recursion, Decision

Question 1
Find the output of the program
int main()
int x;
for(x=-1; x<=10; x++)
if(x < 5)
return 0;
A.Infinite times
B.11 times
C.0 times
D.10 times
Answer : C

Question 2
Predict the output of the questions –
Function main()
double d = 123.4
static float f =123.4
if (m equals i)
print ”Both of them are equal”
else if( f > d )
print ”Float is greater”
print ”Double is greater”
A.Float is greater
B.Double is greater
C.Both of them are equal
D.Code will generate error
: Option C
Equals is not a function to compare float and double

Question 3
As a project, Parag wants to write a code which should increment its value until a condition is satisfied. Which type of structure should he be using?
C.Do while
Answer: Option C
Do while is exactly what the questions says for loop does the same thing but not in the exact scenario as the question

Question 4
Find the output of the program
int main()
int i=1;
printf(“%d\n”, i++);
return 0;
A.There should be a condition in the for loop
B.The two semicolons should be dropped
C.The for loop should be replaced with while loop.
D.No error
Answer : Option D

Step 1: for(;;) this statement will genereate infinite loop.
Step 2: printf(“%d\n”, i++); this statement will print the value of variable i and increement i by 1(one).
Step 3: if(i>10) here, if the variable i value is greater than 10, then the for loop breaks.
Hence the output of the program is

Question 5
Integer a = 20, b =10, c = 20, d =10
Print a*b/c-d
Print a*b/(c-d)
Will the output be same for the two ?
A.The output will have a difference of 20
B.Will be same
C.Cant be said depends on compiler
D.Differ by 100
Answer: Option  A

Practice more questions on the same topic, so as to have more clarity.

For any queries, feel free to comment below.

All the best guys!!!

Leave a Reply

Your email address will not be published.

alpingi © 2018