info@tutorialdiary.com

# AMCAT Output Type Questions | AMCAT Computer Programming Questions | AMCAT Details

### 2:25 AM

There are many questions in AMCAT based on some codes or pseudo codes. We have to find the output of those codes. Since practice makes a man perfect. Here are some of the output based important questions for AMCAT.

This post covers:

Output Type Question
(Find the output, find missing statements in the code, find error, find input which will show wrong output)

So prepare well and get placed!! :)

Ques. What will be the output of the following pseudo-code statements: integer a = 456, b, c, d =10
b = a/d c = a - b print c

Op 1: 410

Op 2: 410.4

Op 3: 411.4

Op 4: 411

Op 5:

Correct Op : 4

Ques. What will be the output of the following pseudo-code statements: integer a = 984, b, c, d =10
print remainder(a,d) // remainder when a is divided by d a = a/d
print remainder(a,d) // remainder when a is divided by d

Op 1: 48

Op 2: Error

Op 3: 84

Op 4: 44

Op 5:

Correct Op : 1

Ques. What will be the output of the following code statements?

integer a = 50, b = 25, c = 0

print ( a > 45 OR b > 50 AND c > 10 ) Op 1: 1
Op 2: 0

Op 3: -1

Op 4: 10 Op 5:
Correct Op : 1

Ques. What will be the output of the following code statements?

integer a = 50, b = 25, c = 5 print a * b / c + c

Op 1: 120

Op 2: 125

Op 3: 255

Op 4: 250 Op 5:

Correct Op : 3

Ques. What will be the output of the following code statements?

integer a = 10, b = 35, c = 5 print a * b / c - c
Op 1: 65

Op 2: 60 Op 3: Error Op 4: 70 Op 5:

Correct Op : 1

Ques. integer a = 10, b = 35, c = 5

Comment about the output of the two statements? print a * b + c / d
print c / d + a * b

Op 1: Differ due to left-to-right precedence Op 2: Differ by 10
Op 3: Differ by 20 Op 4: Same
Op 5: Correct Op : 4

Ques. integer a = 40, b = 35, c = 20, d = 10

Comment about the output of the following two statements:

print a * b / c - d print a * b / (c - d) Op 1: Differ by 80 Op 2: Same

Op 3: Differ by 50 Op 4: Differ by 160 Op 5:

Correct Op : 1

Ques. integer a = 60, b = 35, c = -30

What will be the output of the following two statements: print ( a > 45 OR b > 50 AND c > 10 )
print ( ( a > 45 OR b > 50 ) AND c > 10 ) Op 1: 0 and 1

Op 2: 0 and 0

Op 3: 1 and 1

Op 4: 1 and 0

Op 5:

Correct Op : 4

Ques. What will be the output of the following pseudo-code statements: integer a = 984, b=10
//float is a data-type to store real numbers. float c
c = a / b print c

Op 1: 984

Op 2: 98.4

Op 3: 98

Op 4: Error

Op 5:

Correct Op : 3

Ques. What will be the output of the following pseudo-code statements: integer a = 984

//float is a data-type to store rational numbers. float b= 10, c
c = a / b print c

Op 1: 984

Op 2: Error

Op 3: 98.4

Op 4: 98

Op 5:

Correct Op : 3

Ques. Smriti wants to make a program to print the sum of square of the first 5 whole numbers (0...4). She writes the following program:

integer i = 0 // statement 1 integer sum = 0 // statement 2 while ( i < 5 ) // statement 3

{

sum = i*i // statement 4 i = i + 1 // statement 5
}

print sum // statement 6

Is her program correct? If not, which statement will you modify to correct it? Op 1: No error, the program is correct.
Op 2: Statement 1

Op 3: Statement 4 Op 4: statement 6 Op 5:

Correct Op : 3

Ques. Shashi wants to make a program to print the sum of the first 10 multiples of 5. She writes the following program, where statement 5 is missing:

integer i = 0 integer sum = 0 while ( i <= 50 )

{

sum = sum + i

-- MISSING STATEMENT 5 --

}

print sum

Which of the following will you use for statement 5?

Op 1: i = 5

Op 2: i = 5 * i

Op 3: i = i + 1

Op 4: i = i + 5

Op 5:

Correct Op : 4

Ques. Shantanu wants to make a program to print the sum of the first 7 multiples of 6. He writes the following program:

integer i = 0 // statement 1 integer sum // statement 2 while ( i <= 42 ) // statement 3

{

sum = sum + i // statement 4 i = i + 6;

}

print sum // statement 6

Does this program have an error? If yes, which one statement will you modify to correct the program?

Op 1: Statement 1

Op 2: Statement 2

Op 3: Statement 3

Op 4: Statement 4 Op 5:

Correct Op : 2

Ques. Sharmili wants to make a program to print the sum of all perfect cubes, where

the value of the cubes go from 0 to 100. She writes the following program:

integer i = 0, a // statement 1 integer sum = 0;
a = ( i * i * i )

while ( i < 100 ) // statement 2

{

sum = sum + a // statement 3 i = i + 1
a = ( i * i * i )  // statement 4

}

print sum

Does this program have an error? If yes, which one statement will you modify to correct the program?

Op 1: Statement 1

Op 2: Statement 2

Op 3: Statement 3

Op 4: Statement 4 Op 5: No error Correct Op : 2

Ques. Bhavya wants to make a program to print the sum of all perfect squares, where the value of the squares go from 0 to 50. She writes the following program:

integer i = 1, a // statement 1 integer sum = 0
while ( a < 50 ) // statement 2

{

sum = sum + a // statement 3 i = i + 1
a = ( i * i );  // statement 4

}

print sum

Does this program have an error? If yes, which one statement will you modify to correct the program?
Op 1: Statement 1

Op 2: Statement 2

Op 3: Statement 3

Op 4: Statement 4 Op 5: No error Correct Op : 1

Ques. Vijay wants to print the following pattern on the screen: 2 2 4

2 4 6

2 4 6 8

He writes the following program:

integer i = 1, j=2 // statement 1 while ( i <= 4 ) // statement 2
{

j = 2;

while ( j <= ? ) // Statement 3

{

print j

print blank space j = j + 2
}

print end-of-line \takes the cursor to the next line i = i + 1
}

What is the value of ? in statement 3 ::

Op 1: 8

Op 2: i

Op 3: 2*i

Op 4: 4

Op 5:

Correct Op : 3

Ques. Shravanti writes the following program:

integer i = 0, j while ( i < 2 )
{

j = 0;

while ( j <= 3*i )

{

print j

print blank space j = j + 3

}

print end-of-line \takes the cursor to the next line i = i + 1
}

What will be the output of the program?

Op 1: 0 0 3
Op 2: 0 3 0 3 6
Op 3: 0 0 3 6 0 3 6 9

Op 4: 0 3 6

0 3 6 9

0 3 6 9 12 Op 5:
Correct Op : 1

Ques. Vijay wants to print the following pattern on the screen: 1 1 2

1 2 3

He writes the following program:

integer i = 1 // statement 1 while ( i <= 3 )

{

int j // Statement 2

while ( j <= i ) // Statement 3

{

print j

print blank space

j = j + 1 // Statement 4

}

print end-of-line \takes the cursor to the next line i = i + 1

}

Will this program function correctly? If not which one statement will you modify to make the program function correctly?

Op 1: Statement 1

Op 2: Statement 2

Op 3: Statement 3

Op 4: Statement 4

Op 5: Program does not have error.

Correct Op : 2

Ques. Charu writes the following program:

integer i = 1, j, a while ( i <= 4 )
{

j = 1; a = 0;

while ( a <= 5*i )

{

a = 2^j; print a

print blank space j = j + 1
}

print end-of-line \takes the cursor to the next line i = i + 1
}

What will be the output of the program?

Op 1: 2 2 4 2 4 8

2 4 8 16 Op 2: 2 4 2 4 8 2 4 8 16

2 4 8 16 32 Op 3: 2 4 2 4 8 2 4 8

2 4 8 16

Op 4: 2 2 4 2 4

2 4 8 16 Op 5:
Correct Op : 3

Ques. Himanshu wants to write a program to print the larger of the two inputted number. He writes the following code:

int number1, number 2 input number1, number 2 if (??) // Statement 1 print number1

else

print number2 end if
Fill in the ?? in statement 1. Op 1: number1>number2 Op 2: number2>number1

Op 3: number2 equals number1 Op 4: number1 <= number2 Op 5:

Correct Op : 1

Ques. Shalini wants to program to print the largest number out of three inputted numbers. She writes the following program:

int number1, number 2, number3, temp; input number1, number2, number3;
if (number1>number2) temp = number1

else

temp = number2 end if
if (??) // Statement 1 temp = number3 end if

print temp

Fill in the ?? in Statement 1

Op 1: number3 > number2

Op 2: number3 > temp

Op 3: number3 < temp

Op 4: number3 > number1

Op 5:

Correct Op : 2

Ques. Rohit writes the following program which inputs a number and prints "Double digit" if the number is composed of two digits and "Not a double digit" if it is not.

int number;

if (number>10 AND number < 100) print "Double digit"
else

print "Not a double digit" end if

Rohit tries the following inputs: 5 and 66. The program works fine. He asks his brother Ravi to try the program. When Ravi enters a number, the program doesn't work correctly. What did Ravi enter?

Op 1: 8 Op 2: 100 Op 3: 99 Op 4: 10 Op 5:

Correct Op : 4

Ques. Rohan writes the following program which inputs a number and prints "Triple digit" if the number is composed of three digits and "Not triple digit" if it is not.

int number;

if (number>99) print "Triple digit" else

print "Not triple digit" end if

Rohan tries the following inputs: 25 and 566. The program works fine. He asks his brother Ravi to try the program. When Ravi enters a number, the program doesn't work correctly. What did Ravi enter?

Op 1: 99

Op 2: 100 Op 3: 0 Op 4: 1000 Op 5:

Correct Op : 4