Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

USA MSc in computer science entrance exam, Exams of Computer Science

university of maharase enterance exam

Typology: Exams

2020/2021

Uploaded on 05/11/2021

muluneh-abrham
muluneh-abrham 🇺🇸

4

(1)

4 documents

1 / 53

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Sample 1 questions answer for the MUM entrance exam
After applying in the Maharishi University of Management (MUM) for Master of Science in
Computer Science, we get student id number provided by the University and we have to appear
to the entrance exam, and in the entrance exam you will have three questions to be solved within
2 hours. I have collected some of the question and try to provide you the answers. Some of the
sample questions that i am able to collect for the MUM entrance exam are as follows:
There are three questions on the exam. You have two hours to finish. Please do your own work.
1. Write a function named primeCount with signature
int primeCount(int start, int end);
The function returns the number of primes between start and end inclusive. Recall that a prime is
a positive integer greater than 1 whose only integer factors are 1 and itself.
Examples
If start is
and end is return reason
10 30 6
The primes between 10 and 30 inclusive are 11, 13, 17, 19, 23 and
29
11 29 6
The primes between 11 and 29 inclusive are 11, 13, 17, 19, 23 and
29
20 22 0 20, 21, and 22 are all non-prime
1 1 0 By definition, 1 is not a prime number
5 5 1 5 is a prime number
6 2 0 start must be less than or equal to end
-10 6 3 primes are greater than 1 and 2, 3, 5 are prime
2. A Madhav array has the following property.
a[0] = a[1] + a[2] = a[3] + a[4] + a[5] = a[6] + a[7] + a[8] + a[9] = …
The length of a Madhav array must be n*(n+1)/2 for some n.
Write a method named isMadhavArray that returns 1 if its array argument is a Madhav array,
otherwise it returns 0. If you are programming in Java or C# the function signature is
int isMadhavArray(int[ ] a)
If you are programming in C or C++, the function signature is
int isMadhavArray(int a[ ], int len) where len is the number of elements in a.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35

Partial preview of the text

Download USA MSc in computer science entrance exam and more Exams Computer Science in PDF only on Docsity!

Sample 1 questions answer for the MUM entrance exam

After applying in the Maharishi University of Management (MUM) for Master of Science in Computer Science, we get student id number provided by the University and we have to appearto the entrance exam, and in the entrance exam you will have three questions to be solved within 2 hours. I have collected some of the question and try to provide you the answers. Some of the sample questions that i am able to collect for the MUM entrance exam are as follows: There are three questions on the exam. You have two hours to finish. Please do your own work.

  1. Write a function named primeCount with signature int primeCount(int start, int end); The function returns the number of primes between start and end inclusive. Recall that a prime is a positive integer greater than 1 whose only integer factors are 1 and itself. Examples If start is and end is return reason 10 30 6 The primes between 10 and 30 inclusive are 11, 13, 17, 19, 23 and 29 11 29 6 The primes between 11 and 29 inclusive are 11, 13, 17, 19, 23 and 29 20 22 0 20, 21, and 22 are all non-prime 1 1 0 By definition, 1 is not a prime number 5 5 1 5 is a prime number 6 2 0 start must be less than or equal to end -10 6 3 primes are greater than 1 and 2, 3, 5 are prime
  2. A Madhav array has the following property. a[0] = a[1] + a[2] = a[3] + a[4] + a[5] = a[6] + a[7] + a[8] + a[9] = … The length of a Madhav array must be n*(n+1)/2 for some n. Write a method named isMadhavArray that returns 1 if its array argument is a Madhav array, otherwise it returns 0. If you are programming in Java or C# the function signature is int isMadhavArray(int[ ] a) If you are programming in C or C++, the function signature is int isMadhavArray(int a[ ], int len) where len is the number of elements in a.

Examples if a is return reason {2, 1, 1} 1 2 + 1 + 1 {2, 1, 1, 4, -1, -1} 1 2 = 1 + 1, 2 = 4 + -1 + - {6, 2, 4, 2, 2, 2, 1, 5, 0, 0} 1 6 = 2 + 4, 6 = 2 + 2 + 2, 6 = 1 + 5 + 0 + 0 {18, 9, 10, 6, 6, 6} 0 18 != 9 + 10 {-6, -3, -3, 8, -5, -4} 0 -6 != 8 + -5 + - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, -2, - 1}

{3, 1, 2, 3, 0} 0 The length of the array is 5, but 5 does not equal n*(n+1)/2 for any value of n.

  1. An array is defined to be inertial if the following conditions hold: a. it contains at least one odd value b. the maximum value in the array is even c. every odd value is greater than every even value that is not the maximum value. So {11, 4, 20, 9, 2, 8} is inertial because a. it contains at least one odd value b. the maximum value in the array is 20 which is even c. the two odd values (11 and 9) are greater than all the even values that are not equal to 20 (the maximum), i.e., (4, 2, 8}. However, {12, 11, 4, 9, 2, 3, 10} is not inertial because it fails condition (c), i.e., 10 (which is even) is greater 9 (which is odd) but 10 is not the maximum value in the array. Write a function called isIntertial that accepts an integer array and returns 1 if the array is inertial; otherwise it returns 0. If you are programming in Java or C#, the function signature is int isInertial(int[ ] a If you are programming in C or C++, the function signature is int isInertial(int a[ ], int len) where len is the number of elements in the array

Examples: if a is return reason {9, 0, 2, -5, 7} 2 The square pairs are <2, 7> and <7, 9>. Note that <-5, 9> and <0, 9> are not square pairs, even though they sum to perfect squares, because both members of a square pair have to be greater than 0. Also <7,2> and <9,7> are not square pairs because the first number has to be less than thesecond number. {9} 0 The array must have at least 2 elements

  1. A prime number is an integer that is divisible only by 1 and itself. A porcupine number is a prime number whose last digit is 9 and the next prime number that follows it also ends with the digit 9. For example 139 is a porcupine number because: a. it is prime b. it ends in a 9 c. The next prime number after it is 149 which also ends in 9. Note that 140, 141, 142, 143, 144, 145, 146, 147 and 148 are not prime so 149 is the next prime number after 139. Write a method namedfirst porcupine number findPorcupineNumber that is greater than n (^). So findPorcupineNumber(0) would return 139which takes an integer argument n and returns the (because 139 happens to be the first porcupine number) and so would findPorcupineNumber(138). But findPorcupineNumber(139) would return 409 which is the second porcupine number. The function signature is int findPorcupineNumber(int n) You may assume that a porcupine number greater than n exists. You may assume that a function isPrime exists that returns 1 if its argument is prime, otherwise it returns 0. E.G., isPrime(7) returns 1 and isPrime(8) returns 0. Hint: Use modulo base 10 arithmetic to get last digit of a number.
  2. Consider the following algorithm Start with a positive number n if n is even then divide by 2

if n is odd then multiply by 3 and add 1 continue this until n becomes 1 The Guthrie sequence of a positive number n is defined to be the numbers generated by the above algorithm. For example, the Guthrie sequence of the number 7 is 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 It is easy to see that this sequence was generated from the number 7 by the above algorithm.Since 7 is odd multiply by 3 and add 1 to get 22 which is the second number of the sequence. Since 22 is even, divide by 2 to get 11 which is the third number of the sequence. 11 is odd so multiply by 3 and add 1 to get 34 which is the fourth number of the sequence and so on. Note: the first number of a Guthrie sequence is always the number that generated the sequence and the last number is always 1. Write a function named isGuthrieSequence which returns 1 if the elements of the array form a Guthrie sequence. Otherwise, it returns 0. If you are programming in Java or C#, the function signature is int isGuthrieSequence(int[ ] a) If you are programming in C++ or C, the function signature is int isGuthrieSequence(int a[ ], int len) when len is the number of elements in the array. Examples if a is return reason {8, 4, 2, 1} 1 This is the Guthrie sequence for 8 {8, 17, 4, 1} 0 This is not the Guthrie sequence for 8 {8, 4, 1} 0 Missing the 2 {8, 4, 2} 0 A Guthrie sequence must end with 1 There are three questions on this exam. You have two hours to complete it. Please do your own work.

  1. Thearray. Let this count be Stanton measure n (^). The Stanton measure is the number of times thatof an array is computed as follows. Count the number of 1s in the n appears in the array. For example, the Stanton measure of {1, 4, 3, 2, 1, 2, 3, 2} is 3 because 1 occurs 2 times in the array and 2 occurs 3 times.

Start with a positive number n if n is even then divide by 2 if n is odd then multiply by 3 and add 1 continue this until n becomes 1 The Guthrie index of a positive number n is defined to be how many iterations of the above algorithm it takes before n becomes 1. For example, the Guthrie index of the number 7 is 16 because the following sequence is 16numbers long.

22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 It is easy to see that this sequence was generated by the above algorithm. Since 7 is odd multiply by 3 and add 1 to get 22 which is the first number of the sequence. Since 22 is even, divide by 2 to get 11 which is the second number of the sequence. 11 is odd so multiply by 3 and add 1 to get34 which is the third number of the sequence and so on.

Write a function named guthrieIndex which computes the Guthrie index of its argument. Its signature is int guthrieIndex(int n) Examples if n is return sequence 1 0 number is already 1 2 1 1 3 7 10, 5, 16, 8, 4, 2, 1 4 2 2, 1 42 8 21, 64, 32, 16, 8, 4, 2, 1

You may assume that the length of the sequence can be represented by a 32 bit signed integer. There are 3 questions on this test. You have two hours to do it. Please do your own work.

  1. It is a fact that there exist two numbers x and y such that x! + y! = 10!. Write a method named solve10 that returns the values x and y in an array. The notation n! is called n factorial and is equal to n * n-1 * n-2 * … 2 * 1 , e.g., 5! = 54321 = 120.

If you are programming in Java or C#, the function prototype is int[ ] solve10() where the length of the returned array is 2. If you are programming in C++ or C, the function prototype is int * solve10() where the length of the returned array is 2. Please be sure that the method solve10 returns an array, a, with two elements where a[0] == x, a[1] == y and x! + y! = 10!.

  1. An array can hold the digits of a number. For example the digits of the number 32053 arestored in the array {3, 2, 0, 5, 3}. Write a method call repsEqual that takes an array and an integer and returns 1 if the array contains only the digits of the number in the same order that they appear in the number. Otherwise it returns 0. If you are programming in Java or C#, the function prototype is int repsEqual(int[ ] a, int n) If you are programming in C++ or C, the function prototype is int repsEqual(int a[ ], int len, int n) where len is the number of elements in the array. Examples (note: your program must work for all values of a and n, not just those given here!) if a is and n is return reason {3, 2, 0, 5, 3} 32053 1 the array contains only the digits of thenumber, in the same order as they are in the number. {3, 2, 0, 5} 32053 0 the last digit of the number is missing from the array. {3, 2, 0, 5, 3, 4} 32053 0 an extra number (4) is in the array. {2, 3, 0, 5, 3} 32053 0 the array elements are not in the same order as the digits of the number {9, 3, 1, 1, 2} 32053 0 elements in array are not equal to digits of number. {0, 3, 2, 0, 5, 3} 32053 1 you can ignore leading zeroes.
  2. An array is called centered-15 if some consecutive sequence of elements of the array sum to 15 and this sequence is preceded and followed by the same number of elements. For example { 3, 2 , 10, 4, 1 , 6, 9 } is centered-15 because the sequence 10, 4, 1 sums to 15 and the sequence is preceded by two elements (3, 2) and followed by two elements(6,9).

Write a method named henry that takes two integer arguments, i and j and returns the sum of the ith and jth perfect numbers. So for example, henry (1, 3) should return 502 because 6 is the 1stperfect number and 496 is the 3rd perfect number and 6 + 496 = 502.

The function signature is int henry (int i, int j) You do not have to worry about integer overflow, i.e., you may assume that each sum that you have to compute can be represented as a 31 bit integer. Hint: use modulo arithmetic to determineif one number is a factor of another.

  1. Write a method named isDivisible that takes an integer array and a divisor and returns 1 if all its elements are divided by the divisor with no remainder. Otherwise it returns 0. If you are programming in Java or C#, the function signature is int isDivisible(int [ ] a, int divisor) If you are programming in C or C++, the function signature is int isDivisible(int a[ ], int len, int divisor) where len is the number of elements in the array. Examples if a is and divisor is return because {3, 3, 6, 36} 3 1 all elements of a are divisible by 3 with noremainder. {4} 2 1 all elements of a are even {3, 4, 3, 6, 36} 3 0 because when a[1] is divided by 3, it leaves a remainder of 1 {6, 12, 24, 36} 12 0 because when a[0] is divided by 12, it leaves a remainder of 6. {} anything 1 because no element fails the division test.
  2. An array is defined to bethe array {2, 7, 3, 4} is 5-unique because only a[0] and a[2] sum to 5. But the array {2, 3, 3, 7} n-unique if exactly one pair of its elements sum to n. For example, is not 5-unique because a[0] + a[1] = 5 and a[0] + a[2] = 5. Write a function named is NUnique that returns 1 if its integer array argument is n-unique, otherwise it returns 0. So isNUnique(new int[ ]{2, 7, 3, 4}, 5) should return 1 and isNUnique(new int[] {2, 3, 3, 7}, 5) should return 0. If you are programming in Java or C#, the function signature is

int isNUnique(int[ ] a, int n) If you are programming in C or C++, the function signature is int isNUnique(int a[ ], int len, int n) where len is the number of elements in the array. Examples If a is and n is return because {7, 3, 3, 2, 4} 6 0 because a[1]+a[2] == 6 and a[3]+a[4] also == 6. {7, 3, 3, 2, 4} 10 0 because a[0]+a[1] == 10 and a[0] + a[2] also == 10 {7, 3, 3, 2, 4} 11 1 because only a[0] + a[4] sums to 11 {7, 3, 3, 2, 4} 8 0 because no pair of elements sum to 8. (Note thata[1]+a[2]+a[3] do sum to 8 but the requirement is that two elements sum to 8.) {7, 3, 3, 2, 4} 4 0 no pair of elements sum to 4. (Note that the a[4]==4,but the requirement is that two elements have to sum to 4.) {1} anything 0 array must have at least 2 elements

Sample 2 question collections of MUM university MS computer science There are three questions on this exam. You have two hours to complete it.

  1. Write a function named isSquare that returns 1 if its integer argument is a square of some integer, otherwise it returns 0. Your function must not use any function or method (e.g. sqrt) that comes with a runtime library or class library! The signature of the function is int isSquare(int n) Examples:

if n is return reason 4 1 because 4 = 2* 25 1 because 25 = 5* -4 0 because there is no integer that when squared equals -4. (note, -2 squared is 4 not -4) 8 0 because the square root of 8 is not an integer. 0 1 because 0 = 0*

convertToBase10(new int[ ] {1, 1, 2}, 3) returns 14 convertToBase10(new int[ ] {3, 2, 5}, 8) returns 213 convertToBase10 (new int[ ] {3, 7, 1}, 6) returns 0 because 371 is not a legal base 6 number. Your convertToBase10 method must call the isLegalNumber method that you wrote for question 2.

If you are programming in Java or C#, the function signature is: int convertToBase10(int[ ] a, int base) If you are programming in C or C++, the function signature is: int convertToBase10(int a[ ], int len, int base) where len is the size of the array. There are 3 questions on this test. You have 2 hours to finish it. Please use tabs or spaces to indent your program.

  1. A simple pattern match on the elements of an array A can be defined using another array P. Each element n of P is negative or positive (never zero) and defines the number of elements in a sequence in A. The first sequence in A starts at A [0] and its length is defined by P [0]. The second sequence follows the first sequence and its length is defined by P [1] and so on. Furthermore, forthe sequence of abs( n in P , if n is positive then the sequence of n) elements must all be negative. The sum of the absolute values of the n elements of A must all be positive. Otherwise elements of P must be the length of A. For example, consider the array A = {1, 2, 3, -5, -5, 2, 3, 18} If P = {3, -2, 3} then A matches P because i. the first 3 elements of A (1, 2, 3) are positive (P[0] is 3 and is positive), ii. the next 2 elements of A (-5, -5) are negative (P[1] is - 2 and is negative) iii. and the last 3 elements of A (2, 3, 18) are positive (P[2] is 3 and is positive) Notice that the absolute values of the elements of P sum to 8 which is the length of A. The array A also matches the following patterns: {2, 1, -1, -1, 2, 1}, {1, 2, -1, -1, 1, 2}, {2, 1, -2, 3}, {1, 1, 1, -1, -1, 1, 1, 1}

In each case the sum of the absolute values is 8, which is the length of A and each sequence of numbers in A defined in a pattern is negative or positive as required. The array A = {1, 2, 3, -5, -5, 2, 3, 18} does not match the following patterns: i. P = {4, -1, 3} (because the first 4 elements of A are not positive ( A [3] is negative) as required by P) ii. P = {2, -3, 3} (because even though the first 2 elements of A are positive, the next 3 are required to be negative but A [2] is positive which does not satisfy this requirement.) iii. P = {8} (because this requires all elements of A to be positive and they are not.)

Please note: Zero is neither positive nor negative. Write a function named matches which takes arrays A and P as arguments and returns 1 if A matches P. Otherwise it returns 0. You may assume that P is a legal pattern, i.e., the absolute value of its elements sum to the length ofwrite code to check if P is legal! A and it contains no zeros. So do not

If you are programming in Java or C# the signature of the function is int matches(int[ ] a, int[ ] p) If you are programming in C++ or C, the signature of the function is int matches(int a[ ], int len, int p[ ]) where len is the number of elements of a. Furthermore, the value of p[0] should be the length of p. So, for example, if p ={5, 2, -1, -2, 4}, p [0]=5 means that the array has 5 elements and that the last 4 define the pattern. Hint: Your function should have one loop nested in another. The outer loop iterates through the elements ofinner loop is the absolute value of the current element of P. The inner loop iterates through the next sequence of P****. The lower bound of the inner loop is A. The upper bound of the

  1. The loop variable of the inner loop is not used to index A!
  2. Define a stacked number to be a number that is the sum of the first n positive integers for some n. The first 5 stacked numbers are 1 = 1 3 = 1 + 2 6 = 1 + 2 + 3

Write a function named isIsolated that returns 1 if its argument is an isolated number, it returns 0 if its not an isolated number and it returns -1 if it cannot determine whether it is isolated or not(see the note below). The function signature is:

int isIsolated(long n) Note that the type of the input parameter is long. The maximum positive number that can be represented as a long is 63 bits long. This allows us to test numbers up to 2,097,15 1 because the cube of 2,097,151 can be represented as a long. However, the cube of 2,097,15than 63 bits to represent it and hence cannot be computed without extra effort. Therefore, your 2 requires more function should test if n is larger than 2,097,151 and return -1 if it is. If n is less than 1 your function should also return -1. Hint: n % 10 is the rightmost digit of n, n = n/10 shifts the digits of n one place to the right. The first 10 isolated numbers are N nn nn*n 2 4 8 3 9 27 8 64 512 9 81 729 14 196 2744 24 576 13824 28 784 21952 34 1156 39304 58 3364 195112 63 3969 250047 Questions 2 and 3 are on the next page.

  1. An array is called vanilla if all its elements are made up of the same digit. For example {1, 1, 11, 1111, 1111111} is a vanilla array because all its elements use only the digit 1. However, the array {11, 101, 1111, 11111} isWrite a method called isVanilla (^) not that returns 1 if its argument is a vanilla array. Otherwise it a vanilla array because its elements use the digits 0 and 1. returns 0. If you are writing in Java or C#, the function signature is int isVanilla(int[ ] a) If you are writing in C or C++, the function signature is int isVanilla(int a[ ], int len) where len is the number of elements in the array a.

Example if a is Return reason {1} 1 all elements use only digit 1. {11, 22, 13, 34, 125} 0 Elements used 5 differentdigits {9, 999, 99999, -9999} 1 Only digit 9 is used by all elements. Note that negativenumbers are okay. { } 1 There is no counterexample tothe hypothesis that all elements use the same digit.

  1. Define an array to beexample, {22, 19, 10, 10, 19, 22, 22, 10} is trivalent because all elements are either 10, 22, or 19. trivalent if all its elements are one of three different values. For However, the array {1, 2, 2, 2, 2, 2, 2} is not trivalent because it contains only two different values (1, 2). The array {2, 2, 3, 3, 3, 3, 2, 41, 65} is not trivalent because it contains four different values (2, 3, 41, 65). Write a function namedreturns 0. isTrivalent that returns 1 if its array argument is trivalent, otherwise it

If you are writing in Java or C#, the function signature is int isTrivalent (int[ ] a) If you are writing in C or C++, the function signature is int isTrivalent(int a[ ], int len) where len is the number of elements in the array a. Hint: Remember that the elements of the array can be any value, so be careful how youinitialize your local variables! For example using -1 to initialize a variable won’t work because -1 might be one of the values in the array. Examples if a is return Reason {-1, 0, 1, 0, 0, 0} 1 All elements have one of three values (0, -1, 1) { } 0 There are no elements { 2147483647, -1, - -2147483648}

1 Again only three different values. Note that the value of a[0] is the maximum integer and the value of a[3] is the minimum integer so you can’t usethose to initialize local variables.

for (int rupee20=0; rupee20<=; rupee20++) for (int rupee10=0; rupee10<=; rupee10++) for (int rupee5=0; rupee5<=; rupee5++) for (int rupee2=0; rupee2<=; rupee2++) for (int rupee1=0; rupee1<=; rupee1++) { if (_) count++ }

  1. An integer array is defined to be sequentially-bounded if it is in ascending order and each value, n, in the array occurs less than n times in the array. So {2, 3, 3, 99, 99, 99, 99, 99} is sequentially-bounded because it is in ascending order and the value 2 occurs less than 2 times,the value 3 occurs less than 3 times and the value 99 occurs less than 99 times. On the other hand, the array {1, 2, 3} is not sequentially-bounded because the value 1 does not occur < 1 times. The array {2, 3, 3, 3, 3} is not sequentially-bounded because the maximum allowable occurrences of 3 is 2 but 3 occurs 4 times. The array {12, 12, 9} is not sequentially-bounded because it is not in ascending order. Write a function named isSequentiallyBounded that returns 1 if its array argument is sequentially-bounded, otherwise it returns 0.
  • If you are programming in Java or C#, the function signature is int isSequentiallyBounded(int[ ] a)
  • If you are programming in C or C++, the function signature is a[ ], int len) where len is the length of the array. int isSequentiallyBounded(int

Examples

if a is return Reason {0, 1} 0 the value 0 has to occur less than 0 times, but it doesn’t {-1, 2} 0 if array contains a negative number, return 0. {} 1 since there are no values, there are none that can fail the test. {5, 5, 5, 5} 1 5 occurs less than 5 times {5, 5, 5, 2, 5} 0 array is not in ascending order.

  1. An array is defined to be minmax-disjoint if the following conditions hold: a. The minimum and maximum values of the array are not equal. b. The minimum and maximum values of the array are not adjacent to one another. c. The minimum value occurs exactly once in the array. d. The maximum value occurs exactly once in the array. For example the array {5, 4, 1, 3, 2} is minmax-disjoint because a. The maximum value is 5 and the minimum value is 1 and they are not equal. b. 5 and 1 are not adjacent to one another c. 5 occurs exactly once in the array d. 2 occurs exactly once in the array Write a function named isMinMaxDisjoint that returns 1 if its array argument is minmax-disjoint, otherwise it returns 0. If you are programming in Java or C#, the function signature is int isMinMaxDisjoint(int[ ] a) If you are programming in C or C#, the function signature is int isMinMaxDisjoint(int a[ ], int len) where len is the number of elements in the array. Examples of arrays that are not minMaxDisjoint if a is return Reason {18, -1, 3, 4, 0} 0 The max and min values are adjacent to one another. {9, 0, 5, 9} 0 The max value occurs twice in the array. {0, 5, 18, 0, 9| 0 The min value occurs twice in the array. {7, 7, 7, 7} 0 The min and the max value must be different. {} 0 There is no min or max. {1, 2} 0 The min and max elements are next to one another.