## Amcat Computer Science Previous Question And Answer

**1. There is a new data-type which can take as values natural numbers between**

** (and including) 0 and 25. How many minimum bits are required to store this datatype.**

A: 4

B: 5

C: 1

D: 3

**Correct Answer : 2**

**2. A data type is stored as an 6 bit signed integer. Which of the following cannot**

**be represented by this data type?**

A: -12

B: 0

C: 32

D: 18

**Correct Answer : 3**

**3. A language has 28 different letters in total. Each word in the language is composed of maximum 7 letters. You want to create a data-type to store a word of this language. You decide to store the word as an array of letters. How many bits will you assign to the data-type to be able to store all kinds of words of the language.**

A: 7

B: 35

C: 28

D: 196

**Correct Answer : 2**

**4. A 10-bit unsigned integer has the following range:**

A: 0 to 1000

B: 0 to 1024

C: 1 to 1025

D: 0 to 1023

**Correct Answer : 4**

**5. Rajni wants to create a data-type for the number of books in her book case. Her shelf can accommodate a maximum of 75 books. She allocates 7 bits to the datatype. Later another shelf is added to her book-case. She realizes that she can still use the same data-type for storing the number of books in her book-case. What is the ****maximum possible capacity of her new added shelf?**

A: 52

B: 127

C: 53

D: 75

**Correct Answer : 1**

**6. A new language has 15 possible letters, 8 different kinds of punctuation marks and a blank character. Rahul wants to create two data types, first one which could store the letters of the language and a second one which could store any character in the language. The number of bits required to store these two data-types will**

**respectively be:**

A: 3 and 4

B: 4 and 3

C: 4 and 5

D: 3 and 5

**Correct Answer : 3**

**7. Parul takes as input two numbers: a and b. a and b can take integer values between 0 and 255. She stores a, b and c as 1-byte data type. She writes the following code statement to process a and b and put the result in c.**

**c = a + 2*b**

**To her surprise her program gives the right output with some input values of a and b,**

**while gives an erroneous answer for others. For which of the following inputs will it**

**give a wrong answer?**

A: a = 10 b = 200

B: a = 200 b = 10

C: a = 50 b = 100

D: a = 100 b = 50

**Correct Answer : 1**

**8. Prashant takes as input 2 integer numbers, a and b, whose value can be between 0 and 127. He stores them as 7 bit numbers. He writes the following code to process these numbers to produce a third number c.**

**c = a – b**

**In how many minimum bits should Prashant store c?**

A: 6 bits

B: 7 bits

C: 8 bits

D: 9 bits

**Correct Answer : 3**

**9. Ankita takes as input 2 integer numbers, a and b, whose value can be between 0 and 31. He stores them as 5 bit numbers. He writes the following code to process these numbers to produce a third number c.**

**c = 2*(a – b)**

**In how many minimum bits should Ankita store c?**

A: 6 bits

B: 7 bits

C: 8 bits

D: 9 bits

**Correct Answer : 2**

**10. A character in new programming language is stored in 2 bytes. A string is represented as an array of characters. A word is stored as a string. Each byte in the memory has an address. The word “Mahatma Gandhi” is stored in the memory with starting address 456. The letter ‘d’ will be at which memory address?**

A: 468

B: 480

C: 478

D: 467

**Correct Answer : 3**

**11. Stuti is making a tionnaire of True-false tions. She wants to define a data-type which stores the response of the candidate for the tion. What is the most-suited data type for this purpose?**

A: integer

B: boolean

C: float

D: character

**Correct Answer : 2**

**12. 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**

A: 410

B: 410.4

C: 411.4

D: 411

**Correct Answer : 4**

**13. 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**

A: 48

B: Error

C: 84

D: 44

**Correct Answer : 1**

**14. What will be the output of the following code statements?**

**integer a = 50, b = 25, c = 5**

**print a * b / c + c**

A: 120

B: 125

C: 255

D: 250

**Correct Answer : 3**

**15. What will be the output of the following code statements?**

**integer a = 10, b = 35, c = 5**

**print a * b / c – c**

A: 65

B: 60

C: Error

D: 70

**Correct Answer : 1**

**16. 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**

A: Differ due to left-to-right precedence

B: Differ by 10

C: Differ by 20

D: Same

**Correct Answer : 4**

**17. 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)**

A: Differ by 80

B: Same

C: Differ by 50

D: Differ by 160

**Correct Answer : 1**

**18. 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 )**

A: 0 and 1

B: 0 and 0

C: 1 and 1

D: 1 and 0

**Correct Answer : 4**

**19. 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**

A: 984

B: 98.4

C: 98

D: Error

**Correct Answer : 3**

**20. 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**

A: 984

B: Error

C: 98.4

D: 98

**Correct Answer : 3**