Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. What is a data type in which expressions are stored in places identified by integer indexes?
a) Structure
b) List
c) Array
d) None of the mentioned

View Answer

Answer: c [Reason:] An array is a data type in which expressions are stored in places identified by integer indexes.

2. Which symbol holds the first element and also an index?
a) Nail
b) Tail
c) Initial
d) All of the mentioned

View Answer

Answer: a [Reason:] The nails symbol indicates the first bin, the one with an index of 0 holds nails.

3. Which keyword is used to construct an array?
a) Array
b) Make-array
c) Bins
d) Make

View Answer

Answer: b [Reason:] The array can be constructed and its dimension can be set by using make-array.

4. Which is present in the writer procedure for arrays?
a) Setf
b) Aref
c) Fref
d) Both Setf & Aref

View Answer

Answer: d [Reason:] None.

5. Which keyword embeds the initial element in an array?
a) Initial
b) Initial-content
c) Initial-element
d) None of the mentioned

View Answer

Answer: b [Reason:] Initial-Contents keyword along with the desired intial elements wrapped up in an array.

6. What is the output of the given statement?

span class="sy0"> * (Setf part-bins (make-array '(4)))

a) #Done
b) #4
c) #(0 0 0 0)
d) None of the mentioned

View Answer

Answer: c [Reason:] This statement will create an array of elements and everything will be initialized to zero. Output: #(0 0 0 0)

7. What is the output of the given statement?

span class="sy0"> * (setf bins (make-array 2 :initial-element 'e))

a) E
b) E E
c) E E E
d) E E E E

View Answer

Answer: b [Reason:] This statement will create an array and initialize the array to E. Output: #(E E)

8. What is the output of the given statement?

span class="sy0"> * (setf part (make-array '(8 8)))

a) 8
b) 0 0 0 0 0 0 0 0
c) 0 0 0 0
d) 8 rows of 0

View Answer

Answer: d [Reason:] This statement will create an two-dimensional array and initialize the element to 0. Output: #2A((0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0))

9. What is the output of the given statement?

span class="sy0"> * (setf bins (make-array 4 :initial-element 'e))
* (aref bins 0)

a) E
b) 0
c) 4
d) None of the mentioned

View Answer

Answer: a [Reason:] This statement will create an array and retrieve the first element of an array. Output: E

10. What is the output of the given statement?

span class="sy0"> * (Setf part-bins (make-array '(4)))
* (setf (aref part-bins 0) 'nails);
span class="sy0"> * (setf (aref part-bins 1) 'nuts);
span class="sy0"> * (setf (aref part-bins 2) 'bolts)
* (setf (aref part-bins 3) 'bike)
* (aref part-bins 2)
* (setf (aref part-bins 4) 'car)

a) Nails
b) Nuts
c) 2
d) Error

View Answer

Answer: d [Reason:] Error will be arised because of the last statement and it is out of bound.