Computers and Technology
Question 2 of 10When gathering information, which of the following tasks might you need toperform?OA. Seek out ideas from others and share your own ideasOB. Study objects, conduct tests, research written materials, and askquestionsC. Fill out forms, follow procedures, and apply math and scienceO D. Apply standards, such as measures of quality, beauty, usefulness,or ethics
Can someone help me write a code for this set of direction. 100 POINTS. Please dont copy the answer from online and post it here its wrong.In the main: Declare and create two arrays called nums1 and nums2 to eventually store 15 integers each.Declare a third array called nums3 and assign to it 15 values of your choice (from 1 to 30 BUT NOT in sorted order), for example {25,12,6,2,30}Write a method called initArray to initialize an array of int to values from 0 to 14 using a loop. ( write a method that called initArray to assign an array integers 0 to 14 using a loop.Write a method called displayArray to display all numbers in an array of int on one line using this format: 0 1 2 3 4 and so on. Back in the main: Write the code that calls the initArray method passing in nums1 Write the code that calls the displayArray method first passing in nums1, then passing in nums3. Display an appropriate message before calling the display array so that your results look like this: The nums1 array after initializing: 0 1 2 3 4 and so on The nums3 array after initializing: 25 12 6 2 30 and so on5. Write a method called genRandom which takes the array nums2 as a parameter and fills it with random numbers between 1 and 100.in a for loop, Back in the main:Add a call to the genRandom methods passing in nums2 after providing an appropriate message explaining what the output will be. Your output should looks like this: The nums2 array after initializing: 17 4 12 (random numbers different each time) and so onWrite a method called sumRandom which will take an array as a parameter. It sums all numbers in the array and returns the sum as the value of the method.Back in the main: Add a call to the sumRandom method passing it nums2, then display a message telling what the output is followed by the results. (REMEMBER: when a method returns a value, you need to supply a variable to receive the answer in the calling statement.Write a method called underForty which takes an array as a parameter. It sums all numbers that have a value less than 40 in the array and returns the sum as the value of the method.Back in the main: Add a call to the underForty method passing it nums2, then displays a message telling what the output is followed by the results Write a method called smallest which takes an array as a parameter. It finds the smallest of the number in the array and returns it as the value of the method.Back in the main: This will seem redundant to what you did earlier, but First call the displayArray method so your output looks like this: The nums3 array after initializing:10 5 15 (these should be the numbers you assigned in the create and initialize declaration) and so on. Now, add a call to the smallest method passing it nums3, then display a message telling what the output is followed by the resultsWrite a method called largest which takes an array as a parameter. It finds the largest of the numbers in the array and returns its index as the value of the method.Back in the main: Call the largest method passing nums3, then display a message telling what the output is followed by the results.Write a method called search which takes an array as a parameter and a random number you want to search for. (just pick one out of your array and pass it in as the second parameter) It finds the FIRST instance of that number and returns its index as the value of the method. If it does not find your random number, it returns a -1In the main: call the search method passing it nums3, then display a message telling what the output is followed by the results Use a conditional to display either of these statements: For example: The random number 6 was found at location 2 OR The random number 6 was NOT foundWrite a method called addToOverThirty which takes an array as a parameter. It adds 1 to all numbers that have a value greater than 30 in the array. (hmmm!, can you figure out why I said hmmm? Write the method anyways)Back in the main:Add a call to the addToOverThirty method passing it nums3, then display a message telling what the output is followed by the results For example: The nums3 array after adding 1 to all numbers greater than 30 is 10 6 15 and so on (check with the values you assigned to nums3)
Difficulty: moderateexercise 6 (4 points):**create a function in a file that begins withfunction q-markov (p, x0)formatn=size (p,1);q-1);**first, the function has to check whether the given matrix p (that will have positive entries)is stochastic, that is, left-stochastic. if p is not left-stochastic, the program displays a messagedisp('p is not a stochastic matrix')and terminates. the empty output for a will stay. if p is left-stochastic (then it will be regular stochastic), we will proceed with following:**first, find the unique steady-state vector q, which is the probability vector that forms abasis for the null space of the matrix p-eye (n): employ a matlab command null(,'r')to find a basis for the null space and, then, scale the vector in the basis to get the requiredprobability vector a. **next, verify that the markov chain converges to q by calculating consecutive iterations:x =p*x0, x =p*x, x, =p*x,. you can use a "while" loop here. your loop has to terminate when, for the first time, theoutput of the function closetozeroroundoff () with p=7, run on the vector of the differencebetween a consecutive iteration and q, is the zero vector. count the number of iterations k thatis required to archive this accuracy and display k in your code with the correspondingmessage. this is the end of your function markov. we