Find the output of the following ? a=[12 3;4 5 6;7 8 9], b-[9 8 7;6 5 4;3 2 1],c=[2 4 6;8 3 5;1 7 9]
Q: Question 11 Write a Java Program to do the following: • Create a Arraylist object and store 5…
A: PROGRAM CODE: import java.util.*; // import java utility package public class…
Q: Please modify the code of comparing two user entered strings so that it does not effect by case in…
A: Required:- Please modify the code of comparing two user-entered strings so that it does not case…
Q: Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: What is the wrong statement in this code ?fragment ;const int B = 3 ;int A "const char D = '1 ;char…
A: Wrong Statement in the Code fragment is : C=D++-1;
Q: What is the output of the following code? my_list = [11, 31, 10, 8, 99, 22, 441| print (my list[my…
A: I have given an answer in step 2.
Q: What is the output of the following code? int list[] = {1, 2, 3, 4, 5, 6}; for (int i = 5; i >=1;…
A: for(int i=5;i>=1;i--) list[i-1]=list[i]; using this list[4]=list[5] list [3]=list[4]…
Q: Debugging Informatlon for IAP Test3 O COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None…
A: EXPLANATION: - 8 9 7 6 5 4 3 2 1 0 The brief message given in output states things present in…
Q: Assume you declared int p[4] = {1, 2, 3, 4}. What are *p, *(p+1), p[0] and p[1]?
A: p[] is an array of variables in which it contains different values of the same data type. *p is a…
Q: If you add up all the digits in 468, you get 4 + 6 + 8 = 18. The square and cube of 468 are 219024…
A: As the language is not mentioned, So here is the python program for the same.
Q: "<« z <<endl; %3D <« y<< %3D cout<<x<<" return e; } void calc(int a, int &b){ int c; c=a+1; a=a*2;…
A: Explanation In this Program, we have used both call by value and call by reference. while passing x…
Q: Arun is a sequence of adjacent repeated values. Write a program that generates a sequence of 20…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: #include void S(int x,int &y,int &z) {y-y%x-1; z-z%x+1;} void main() { int i=2,j=3,k=4; S(i,j,k);…
A: As we know 3%2-1 =0 4%2 + 1 = 1
Q: ITCS114 - Computer Programming II Lab Assignment # 2- Chapter 07 Write a Java program that will read…
A: Answer Code in Java import java.util.*; public class Solution { public static void…
Q: Please run this code and rectify the issue in string #include #include int binarySearch(int arr[],…
A: code
Q: void mysteryFunction(int myList[][5], int r, int c) { int i, j, k, curr, temp; for ( (1) ) for (i =…
A: In the main method, we have a 2dimensional array with 2 rows and 5 columns. Next, we have called the…
Q: ITCS114-Computer Programming II Lab Assignment # 2-Chapter 07 Write a Java program that will read…
A: Answer: Code in Java: import java.util.*; public class Solution { public static void…
Q: In Java Write a program which should be able to store 2 quiz scores for a maximum of 5 students.…
A: The program includes a Scanner class present in the io package. Scanner class is required for taking…
Q: Determine the correct output for this code snippet : int egArray[ ] = { 2, 4, 6, 8, 10, 1, 3 }; for…
A: An array is a data structure that stores same type of data items. Indexing starts from 0 .
Q: Q1. Produce a method that reads in a set of values (double) from the user and returns them. Use this…
A: Given code is Java code it returns the student grades. By using the public static double[]…
Q: What would be the output of the following code? Explain. list1 = [2,4,6,8] list1.insert(6,6)
A: Given : What would be the output of the following code? Explain. list1 = [2,4,6,8]…
Q: THIS IS IN JAVA. Write a program that reads a list of integers, and outputs the two smallest…
A: logic read n integers and store in array. Sort the array for(int i=0;i<n;i++) {…
Q: (a) # include int main() { int i 2, j= 3, k, I ; float a, b; k =i/j*j; 1=j/i*i; a = i/j*j; b…
A: I give the output along with explanation for the above code
Q: What is the output of the following code? int arr[] = {4, 5, 6, 7}; int *p = (arr + 1); cout << *p;…
A: Array (arr): A collection of items stored in contiguous memory spaces is referred to as an array.
Q: alculations that are outside the limit of all available primitive data types. For example, factorial…
A: The code of this problem is providing below. #include<bits/stdc++.h>using namespace std;…
Q: Tamespac int main() 5- { int m=11, t=5, k=4; k=m++ +t; 8. cout <« "\n the value of k is : "; cout <<…
A: The output of above code will be: 16
Q: 1- CHANGE THE FOLLOWING INFIX METHOD INTO A POSTFIX !! (A + (B - (C * D) - F) : G); ((A * (B : (C +…
A: OBJECTIVE: Three expressions are given using the infix notation. These expressions should be…
Q: What is the output of the following code? int list[] = {1, 2, 3, 4, 5, 6}; for (int i = 1; i < 6;…
A: #include <iostream>using namespace std;int main(){int list[] = {1, 2, 3, 4, 5, 6};for (int i =…
Q: In Java languge (Duplicate Elimination) Write a program that reads in a series of first names and…
A: Java program to solve the given problem is below.
Q: Consider a two-by-three integer array t. a) Write a statement that declares and creates t.b) How…
A:
Q: Examine this code: Date d = makeDate(Month::jul, 4, 1776); Now that you've changed the type of…
A: The code fails not due to makeDate() function, it fails only due to isLeapYear() method generated by…
Q: Hello this code writtten in c++. Code runs perfectly fine i just want a way to change it make it…
A: C++ program to check whether expressions are balanced or not
Q: Read the following program. int _tmain(int argc, _TCHAR* argv[]) { int a=6,b=3;…
A: The correct answer is given in step 2.
Q: Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating…
A: import java.util.ArrayList;import java.util.Scanner; public class CategorizeStrings { public…
Q: What is the output of the following code fragment? int n = 1; while (n <= 5) cout << n << '…
A: int n = 1; while (n <= 5) // the while loop will keep checking this condition every…
Q: In the given code below we want to swap a and b. a -What is the problem with code b- Fix the code by…
A: Given Code always @ (posedge clk) begin a=b; b = a; end A) There is a problem with…
Q: PYTHON!!!! Complete the below function which takes a list of distinct positive integers and a…
A: The given function is as following- def pairsum(list1, target): The Completed function is…
Q: Show the output of the following code. #include <iostream> using namespace std;int* f(int…
A: The code will shows the error.
Q: Output in C++
A: C++ PROGRAM:#include <iostream>void mystery(int x[], int n) {int temp; for(int i=0; i<n / 2…
Q: What will be the output of the following C+ + code? %#3include %23include using namespace std;…
A: Question. What will be the output of the following C++ code? a) 33344244 b) 44332434 c) 33432444 d)…
Q: Q1: Write a program in Java that reads 10 integers and store them in AN ArrayList. Then, do the…
A: Program: // Java program for reversing an arraylist import java.io.*; import java.util.*; class…
Q: Assume you declared int* p, and p’s current value is 100. What is p + 1?
A: Given: Assume you declared int* p, and p’s current value is 100. What is p + 1?
Q: What is the output of this code: int i, j for (i=1; i<=5; i++) { for (j=(i+1); j<=5; j++) cout <<…
A: Explanation16 1) It runs two for loop first for loop runs 5 times(i=0 to 5) second for loop run…
Q: What is the output of the following code? int myList[] = {1, 2, 3, 4, 5, 6}; for (int i = 4; i >= 0;…
A: #include <iostream> using namespace std; int main(){ int myList[] = {1, 2, 3, 4, 5, 6};…
Q: Write a function that takes a string and calculates the number of letters and digits within it.…
A: In this problem we need to design the pHP program. Input - String Ouput - Array
Q: Assume you declared int* p. What are the differences among p++, *p++, and (*p)++?
A: Given:- Assume you declared int* p. What are the differences among p++, *p++, and (*p)++?
Q: Consider the following code snipplet, int a[3] = {1, 2, 3}; short *b; b = (short *)a; b++; After…
A: After executing the code, the correct answer to this question is option first 0. Output: -
Q: #include int main(void) { int a[3][3] = {1,3,5,7,9}; int i,j,sum=0; for(i = 0; i < 3; i++) for (j =…
A: #include<stdio.h> int main() { int a[3][3] = {1,3,5,7,9}; int i,j,sum=0; for(i =…
Mat lab code
Min (a) / max (b) ?
Step by step
Solved in 2 steps with 2 images
- IN python, • generate_number(pct_per_digit): Takes one float as input. Returns a random number that is constructed as follows. First, use the function above to get a random number. This number will correspond to the length (number of digits) that the number generated by this function should have. For example, if that function returns 3, then this function should generate and return a random number with three digits. Note that in the case of a multi-digit number (2 digits or greater), the first digit cannot be 0. >>> random.seed(1337) >>> generate_number(0) 9 >>> random.seed(9002) >>> generate_number(0.5) 41700Create a program that accepts an integer N, and pass it to the function generatePattern. generatePattern() function which has the following description: Return type - void Parameter - integer n This function prints a right triangular pattern of letter 'T' based on the value of n. The top of the triangle starts with 1 and increments by one down on the next line until the integer n. For each row of in printing the right triangle, print "T" for n times. In the main function, call the generatePattern() function. Input 1. One line containing an integer Output Enter N: 4 T TT TTT TTTTIn JAVA code (Bubble Sort): 1. Prepare a data set containing 10,000 integers (random). 2. Make a code that will create 3 variants of the data: one in best case (data are arranged in ascending order); the other in worst case (data are arranged in descending order); and the last in average case (data are randomly arranged). 3. Each integer is considered as one input in the code. 4. The output of your program should be the number of statements executed in the process of sorting for each of the algorithms. This, therefore, means that you have to embed a counter variable in your program that keeps track of the number of statements executed in the sorting part of your code. 5. The end value of the variable shall be the output of your program.
- Write in C++ Alice is trying to monitor how much time she spends studying per week. She going through her logs, and wants to figure out which week she studied the least, her total time spent studying, and her average time spent studying per week. To help Alice work towards this goal, write three functions: min(), total(), and average(). All three functions take two parameters: an array of doubles and the number of elements in the array. Then, they make the following computations: min() - returns the minimum value in the array sum() - returns the sum of all the values in the array average() - returns the average of all the values in the array You may assume that the array will be non-empty. Function specifications: Function 1: Finding the minimum hours studied Name: min() Parameters (Your function should accept these parameters IN THIS ORDER): arr double: The input array containing Alice's study hours per week arr_size int: The number of elements stored in the array Return Value:…Please answer it in Python write a function that Sort the list of the players here For example: {'rara': [74, 72, 59, 82, 44, 77, 17, 11, 62, 97], 'riri': [83, 69, 100, 22, 4, 51, 55, 50, 103, 52], 'rere': [13, 25, 38, 37, 29, 104, 47, 23, 39, 80]} #return => {'rara': [11, 17, 44, 59, 62, 72, 74, 77, 82, 97], 'riri': [4, 22, 50, 51, 52, 55, 69, 83, 100, 103], 'rere': [13, 23, 25, 29, 37, 38, 39, 47, 80, 104]}In JAVA code (Insertion Sort): 1. Prepare a data set containing 10,000 integers (random). 2. Make a code that will create 3 variants of the data: one in best case (data are arranged in ascending order); the other in worst case (data are arranged in descending order); and the last in average case (data are randomly arranged). 3. Each integer is considered as one input in the code. 4. The output of your program should be the number of statements executed in the process of sorting for each of the algorithms. This, therefore, means that you have to embed a counter variable in your program that keeps track of the number of statements executed in the sorting part of your code. 5. The end value of the variable shall be the output of your program.
- In JAVA code (Insertion Sort): 1. Prepare a data set containing 10,000 integers (random). 2. Make a code that will create 3 variants of the data: one in best case (data are arranged in ascending order); the other in worst case (data are arranged in descending order); and the last in average case (data are randomly arranged). 3. Each integer is considered as one input in the code. 4. The output of your program should be the number of statements executed in the process of sorting for each of the algorithms. This, therefore, means that you have to embed a counter variable in your program that keeps track of the number of statements executed in the sorting part of your code. 5. The end value of the variable shall be the output of your program. Below is a sample of the code in Bubble Sort; I am asking for the program for insertion sort.int a[100], b[1000], c[1000]; // get some data for a, b, and c for (i = 0; i < 100; i++) for (j = 0; j < 10; j++) a[i] += c[j*100 + i] * b[j*100 + i] ;Given the following C code: int a[10] = {0,1,2,3,4,5,6,7,8,9};int *m = &a[0];int *p = &a[5];int *q = &a[1]; p = (int) m + (int) p - (int) q; What is the value of *p?
- Please code in python You are tasked with helping write part of an exciting new word-guessing game, “Durdle”. The game is one in which a player attempts to guess a five-letter word in successive guesses. In this problem and the next one, we will build an implementation of this word-guessing game. First, to support this game, we will write a function named durdle_match(guess, target) that takes in two strings - a player’s guess, and the target word that the player is attempting to guess. Each of the given words is five letters long. This function should return a five-letter string consisting of the letters B, G, and Y that has a meaning associated with the guess as follows: B: This letter in the guess does not appear in the target string Y: This letter in the guess appears in the target string in another location G: This letter in the guess appears in the same location in the target string Hints: You may assume that both of the input strings are 5 letters and all lowercase.Consider the following function: public void bSearch(int[] A, int value, int start, int end) { if (end value) { return bSearch(A, value, start, mid); } else if (value > A[mid]) { return bSearch(A, value, mid+1, end); } else { return mid; } } The mutation program P' changes the part as shown below. } else if (value > A[mid]) { return bSearch(A, value, mid+2, end); } else { return mid; } A test input is given t1: {A = [2, 3, 5, 7, 10, 11], value = 6, start=0, end=5}. Which statement below best describes the mutant with regards to the test input? O a. t1 resolves mutant P O b. The mutant P' with regards to test input t1 is live.I saw a problem in StackOverflow. I tried to solve it differently but wasn't able to solve it. This was the problem. You are given an array (which will have a length of at least 3 but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a function that takes the array as an argument and returns this “outlier” N.and I wrote the following code.. still, it didn't work public class Outlier{public static void main(String[] args){int[] x = new int [args.length]; for(int i=0; i<x.length; i++) {x[i] = Integer.parseInt(args[i]);}System.out.print(unique(x)); }public static int[] unique(int[] x) {int even = 0;int odd = 0;int N = 0;int[] a = new int [x.length];for (int i = 0; i < x.length; i++) {if (x[i] % 2 ==0) {even ++;}else odd ++;} for (int i = 0; i < x.length; i++) {if (odd > even) {if (x[i] % 2 == 0) {N = x[i];for (int j = 0; j<even; j++) a[j]=N;}}else if…