50+ Number of Jumps to Reach End-array Operation MCQs

We have the best collection of the Number of Jumps to Reach End-array Operation MCQs and answer with FREE PDF. These Number of Jumps to Reach End-array Operation MCQs will help you to prepare for any competitive exams like: BCA, MCA, GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.

Number of Jumps to Reach End-array Operation MCQs

1. What will be the minimum number of jumps required to reach the end of the array arr[] = {1,2,0,0,3,6,8,5}?

a) 1

b) 2

c) 3

d) not possible to reach the end

Answer: not possible to reach the end

2. It is not possible to find the minimum number of steps to reach the end of an array in linear time.

a) true

b) false

Answer: false

3. In how many different ways we can reach the end of the array arr[]={1,3,5,8,9}?

a) 1

b) 2

c) 3

d) 4

Answer: 4

4. What will be the worst case time complexity of the following code?

#include <bits/stdc++.h> 
using namespace std; 
 
void func(int arr[], int n) 
{  	
	int count[n]; 
	memset(count, 0, sizeof(count)); 
 
	for (int i=n-2; i>=0; i--) 
	{ 
		if (arr[i] >= n - i - 1) 
			count[i]++; 
 
		for (int j=i+1; j < n-1 && j <= arr[i] + i; j++) 
 
			if (count[j] != -1) 
				count[i] += count[j]; 
 
		if (count[i] == 0) 
			count[i] = -1; 
	} 
 
	for (int i=0; i<n; i++) 
		cout << count[i] << " "; 
} 
 
 
int main() 
{ 
	int arr[] = {1, 3, 5, 8, 9}; 
	int n = sizeof(arr) / sizeof(arr[0]); 
	func(arr, n); 
	return 0; 
}

a) O(n1/2)

b) O(n)

c) O(n3/2)

d) O(n2)

Answer: O(n2)

5. It is not possible to reach the end of an array if starting element of the array is 0.

a) true

b) false

Answer: true

6. What is the minimum possible time complexity to find the number of steps to reach the end of an array?

a) O(n)

b) O(n2)

c) O(n3/2)

d) O (1)

Answer: O(n)

7. What will be the minimum number of jumps required to reach the end of the array arr[] = {1,3,6,3,6,8,5}?

a) 1

b) 2

c) 3

d) not possible to reach the end

Answer: 3

Number of Jumps to Reach End-array Operation MCQs PDF Download

Also Read about Arrays Types

50+ Bit Array MCQs with FREE PDF
50+ Dynamic Array MCQs with FREE PDF
50+ Parallel Array MCQs with FREE PDF
50+ Sparse Array MCQs with FREE PDF
50+ Suffix Array MCQs with FREE PDF
50+ Matrix MCQs with FREE PDF
50+ Sparse Matrix MCQs with FREE PDF
50+ Count Inversion MCQs with FREE PDF
50+ Rotation Array Operation MCQs with FREE PDF
50+ Reversal Array Operation MCQs with FREE PDF

1000+ Data Structure MCQs

Abstract Data Types
Application of Stacks
Arrays Types
Types of Lists
Binary Trees
B-Trees
Trees
Heap
Trie
Hash Tables
Graph


Categories: Arrays Types