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. Arrays can be used to store multiple values in one single variable.
a) True
b) False

View Answer

Answer: a [Reason:] We can store multiple value in one single variable known as arrays.

2. What will be output of the given code?

my_array = [1, 2, 3, 4]
print my_array

a) [1, 2, 3, 4].
b) 1234
c) Error
d) None of the mentioned

View Answer

Answer: a [Reason:] A variable my_array is declared and [1, 2, 3, 4] is stored in that variable.

Output:
[1, 2, 3, 4]

3. Each element in an array has an index and the starting index is index 1.
a) True
b) False

View Answer

Answer: b [Reason:] Array’s starting index is index 0 not index 1.

4. What will be the output of the following?

array = [100, 200, 300, 400, 500]
print array[4]

a) 400
b) 500
c) Nil
d) None of the mentioned

View Answer

Answer: b [Reason:] Array’s index start from 0 so array[4] will give 500.

Output:
500

5. What will be the output of the following?

array = [100, 200, 300, 400, 500]
print array[5]

a) 400
b) 500
c) Nil
d) None of the mentioned

View Answer

Answer: c [Reason:] Array’s index start from 0 so array[5] will give nothing.

Output:
Nil

6. What will be the output of the following?

array = [100, 200, 300, 400, 500]
print "array[5]"

a) array[5].
b) 500
c) Nil
d) None of the mentioned

View Answer

Answer: a [Reason:] Anything in double quotes is treated as string.

Output:
array[5]

7. What will be the output of the following?

array1 = [100, 200, 300, 400, 500]
array2 = [1,2,3,4,5]
if array1 == array2
print "They are equal"
else 
    print "Not equal"
end

a) They are equal
b) Not equal
c) Nil
d) None of the mentioned

View Answer

Answer: b [Reason:] Two arrays are said to be equal if each and every element of both the arrays are equal.

Output:
Not equal

8. What will be the output of the following?

array1 = [0,0,0]
array2 = [0,0,0]
if array1 == array2
print "They are equal"
else 
    print "Not equal"
end

a) They are equal
b) Not equal
c) Nil
d) None of the mentioned

View Answer

Answer: a [Reason:] Two arrays are said to be equal if each and every element of both the arrays are equal.

Output:
They are equal

9. What will be the output of the following?

array1 = [1,2,3]
array2 = [0,0,0]
if array1 >= array2
print "Greater or equal"
else 
    print "Not equal"
end

a) Greater or equal
b) Not equal
c) Error
d) None of the mentioned

View Answer

Answer: c [Reason:] Elements of two arrays can’t be compared.

Output:
undefined method `>=' for [1, 2, 3]:Array

10. What will be the output of the following?

array1 = [1,2,3]
array2 = [0,0,0]
if array1 == array2
print "Equal"
else 
    print "Not equal"
end

a) Equal
b) Not equal
c) Error
d) None of the mentioned

View Answer

Answer: a [Reason:] All the elements must be equal

Output:
Equal

Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com