Question: 20 points each PI) Write a Java code to print all - elements of even index in A For example, if you are given, 15

 20 points each PI) Write a Java code to print all
- elements of even index in A For example, if you are
given, 15 24945 3.4 Your Answer: public static void main(String[] args) {
int[] A = {10,15,24,9,45,67,89); 10 67 89 5 6 You Java code
will print 10, 24, 45, 89 Your Answer: P2) Suppose, you are
given an array of 6 integer numbers: 10 15 24 2 0

20 points each PI) Write a Java code to print all - elements of even index in A For example, if you are given, 15 24945 3.4 Your Answer: public static void main(String[] args) { int[] A = {10,15,24,9,45,67,89); 10 67 89 5 6 You Java code will print 10, 24, 45, 89 Your Answer: P2) Suppose, you are given an array of 6 integer numbers: 10 15 24 2 0 1 2 3 45 67 59 What type of exception (error) will be raised with the following statement? int k = A[7]: You need to provide brief explanation for your answer. P3) Write a Java code for a method InsertAt (int pos, int num, which inserts given num at A[pos] Your Answer: public void InsertAt (int pos, int num) For example, if you call InsertAt (5, 20) for A = (10,15,24,9,45,67,89), You will get: A = {10,15,24,9,45,20, 67,89), You may assume that A has enough space. } P4) Write a Java method deleteOnco which deletes the first element in given Your Answer: void deleteOne 0 array A For example, if you are given int[] A-{30,10,20,15,25,9) then your code should make A={10,20,15,25,9) A 30 10 20 15 24 99 A 10 20 15 24 9 P5) What is the time complexity in big Oh for the following Java method? Your Answer: Please provide a brief explanation for the full credit. public void F1(int n) { int sum = 0; for (int i =1;i } } for (int m=1;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!