Alpingi.com

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

AMCAT coupon code --> ALP50 | Freshersworld Discount Code --> AFF1451AGI
Alpingi.com New UpdatesAMCAT Discount Code (ALP50) - get upto 100 flat off Alpingi.com UpdatesFreshersworld Coupon Code (AFF1451AGI) - - get flat 100 off

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++)
    {statements}
  • While loop
    while(condition)
    {statements }
  • Do-while loop
    Do
    {statements}
    while(condition)

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(true)
    {statements}
    else
    {statements}
  • if..elseif..else
    if(true)
    {statements}
    elseif
    {statements}
    else
    {statements}
  • nested ifs
    if(true)
    { if(true)
    {statements}
    }
    else
    {statements}

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 Sample Questions pdf

Practice Questions for AMCAT Iteration, Recursion, Decision

Question 1
Find the output of the program
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf(“Alpingi”);
}
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”
else
print ”Double is greater”
}
A.Float is greater
B.Double is greater
C.Both of them are equal
D.Code will generate error
Answer
: Option C
Explanation:
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?
A.For
B.While
C.Do while
D.Perforate
Answer: Option C
Explanation:
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
#include<stdio.h>
int main()
{
int i=1;
for(;;)
{
printf(“%d\n”, i++);
if(i>10)
break;
}
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

Explanation:
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
1
2
3
4
5
6
7
8
9
10

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!!!

More Articles AMCAT CSE Questions Paper:

Looking for AMCAT Discount? – check here AMCAT Discount Code

Leave a Reply

Your email address will not be published.

alpingi © 2018