AMCAT Previous Years Questions on Computer Programming: Data Types


AMCAT Computer Science Topic Wise Questions

Number of Questions: 26 || Module Duration: 22 min

Topics
Sub- Topics
Expected Questions


Basic Programming


10 - 12 Questions


Data Structures



6 - 8 Questions


OOPs



4 - 6 Questions

Miscellaneous


4 - 5 Questions

Ques1. 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.
Op 1: 4
Op 2: 5
Op 3: 1
Op 4: 3
Op 5:
Correct Op : 2

Ques2. A data type is stored as an 6 bit signed integer. Which of the following cannot
be represented by this data type?
Op 1: -12
Op 2: 0
Op 3: 32
Op 4: 18
Op 5:
Correct Op : 3

Ques3. 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.
Op 1: 7
Op 2: 35
Op 3: 28
Op 4: 196
Op 5:
Correct Op : 2

Ques4. A 10-bit unsigned integer has the following range:
Op 1: 0 to 1000
Op 2: 0 to 1024
Op 3: 1 to 1025
Op 4: 0 to 1023
Op 5:
Correct Op : 4

Ques5. 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?
Op 1: 52
Op 2: 127
Op 3: 53
Op 4: 75
Op 5:
Correct Op : 1

Ques6. 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:
Op 1: 3 and 4
Op 2: 4 and 3
Op 3: 4 and 5
Op 4: 3 and 5
Op 5:
Correct Op : 3

Ques7. 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?
Op 1: a = 10 b = 200
Op 2: a = 200 b = 10
Op 3: a = 50 b = 100
Op 4: a = 100 b = 50
Op 5:
Correct Op : 1

Ques8. 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?
Op 1: 6 bits
Op 2: 7 bits
Op 3: 8 bits
Op 4: 9 bits
Op 5:
Correct Op : 3

Ques9. 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?
Op 1: 6 bits
Op 2: 7 bits
Op 3: 8 bits
Op 4: 9 bits
Op 5:
Correct Op : 2

Ques10. 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?
Op 1: 468
Op 2: 480
Op 3: 478
Op 4: 467
Op 5:
Correct Op : 3

Ques11. Stuti is making a questionnaire of True-false questions. She wants to define a
data-type which stores the response of the candidate for the question. What is the
most-suited data type for this purpose?
Op 1: integer
Op 2: boolean
Op 3: float
Op 4: character
Op 5:
Correct Op : 2


Ques40. What is the output of the following code statements? The compiler saves the
first integer at the memory location 4062. Integer is one byte long.
integer a
pointer b
a = 20
b = &a
print *b
Op 1: 4062
Op 2: 4063
Op 3: 20
Op 4: 10
Op 5:
Correct Op : 3


Ques41. What is the output of the following code statements? The compiler saves the
first integer at the memory location 4165 and the rest at consecutive memory spaces
in order of declaration. Integer is one byte long.
integer a, b
pointer c, d
a = 30
c = &a
b = *c
a = a + 10
print b
Op 1: 30
Op 2: 4165
Op 3: 40
Op 4: 4166
Op 5:
Correct Op : 1


Ques42. What is the output of the following code statements? The compiler saves the
first integer at the memory location 4165 and the rest at consecutive memory spaces
in order of declaration. Integer is one byte long.
integer a
pointer c, d
a = 30
c = &a
d = c
a = a + 10
print *c
Op 1: 30
Op 2: 4165
Op 3: 40
Op 4: 4166
Op 5:
Correct Op : 3


Ques109. How will 47 be stored as an unsigned 8-bit binary number?
Op 1: 10111101
Op 2: 00101111
Op 3: 10111000
Op 4: 00101101
Op 5:
Correct Op : 2

Ques110. An integer X is saved as an unsigned 8-bit number, 00001011.What is X?
Op 1: 22
Op 2: 11
Op 3: 10
Op 4: None of these
Op 5:
Correct Op : 2

Ques111. A variable cannot be used…
Op 1: Before it is declared
Op 2: After it is declared
Op 3: In the function it is declared in
Op 4: Can always be used
Op 5:
Correct Op : 1

Ques112. What is implied by the argument of a function?
Op 1: The variables passed to it when it is called
Op 2: The value it returns on execution
Op 3: The execution code inside it
Op 4: Its return type
Op 5:
Correct Op : 1

Ques113. Which of the following is true about comments?
Op 1: They are executed only once.
Op 2: They are not executed
Op 3: A good program does not contain them
Op 4: They increase program execution time.
Op 5:
Correct Op : 2

Ques114. Neelam wants to share her code with a colleague, who may modify it. Thus
she wants to include the date of the program creation, the author and other
information with the program. What component should she use?
Op 1: Header files
Op 2: Iteration
Op 3: Comments
Op 4: Preprocessor directive
Op 5:
Correct Op : 3

Ques115. Shashi writes a program in C++ and passes it on to Pankaj. Pankaj does some
indentation in some statements of the code. What will this lead to?
Op 1: Faster Execution
Op 2: Lower memory requirement
Op 3: Correction of errors
Op 4: Better readability
Op 5:
Correct Op : 4

No comments:

Post a Comment