When someone may be giving away something for free.
Select the correct answer.
Which part connects the CPU to the other
internal parts of a computer?
O A.
ALU
OB.
bus
O c. control unit
OD.
memory unit
O E. register
Answer:
I believe the correct answer is B. bus
Explanation:
The bus is the internal part that connects CPU and other parts to the rest of the computer.
The part that connects the CPU to the other internal parts of a computer is the bus. The correct option is B.
What are the different parts of a computer?A motherboard, a central processor unit, a graphics processing unit, random access memory, and a hard disc or solid-state drive are the five fundamental components of every computer.
Every computer has 5 components, whether it is a high-end gaming system or a simple desktop system for kids. The CPU is the brain of your computer; it is responsible for all programming and computation. The motherboard, however, serves as the computer's brain, using circuits to link the CPU to other hardware components including memory, a hard drive, a CD/DVD drive, and all of your peripherals.
Therefore, the correct option is B. bus
To learn more about computers, refer to the link:
https://brainly.com/question/1483004
#SPJ2
what are the different steps while solving a problem using computer? explain
Explanation:
The following six steps must be followed to solve a problem using computer.
Problem Analysis.
Program Design - Algorithm, Flowchart and Pseudocode.
Coding.
Compilation and Execution.
Debugging and Testing.
Program Documentation.
If the code for JAVA is LCXC, what is the code for BASIC?
Answer:
DCUKE
Explanation:
Given that,
Code for JAVA = LCXC
To find,
Code for BASIC = ?
As we observe the pattern,
In "JAVA", every letter moved two-letter forward in their alphabetical order or we can say that every third alphabet of the given letter is used to make the code:
J + 2 = L
A + 2 = C
V + 2 = X
A + 2 = C
Similarly,
B + 2 = D
A + 2 = C
S + 2 = U
I + 2 = K
C + 2 = E
Thus, DCUKE is the code for BASIC.
The code for BASIC given the code for JAVA is; DCUKE
We are given the code for JAVA as LCXC
From that code for "JAVA", we see that every letter is moved forward two letters in their alphabetical order. This means
J = L because L comes after J and KA = C because C comes after A and BV = X because X comes after V and UA = C because C comes after A and BSimilarly for BASIC;
B = D because D comes after B and CA = C because C comes after A and BS = U because U comes after S and TI = K because K comes after I and JC = E because E comes after C and DThus, finally the code for BASIC is DCUKE
Read more about JAVA at; https://brainly.com/question/18554491
Jill is configuring the AutoArchive feature in Outlook 2016. What is the default setting in relation to when AutoArchive
will run?
o 7 days
0 14 days
30 days
O Never
(b) 14 days
Explanation:
In the presence of thousands of mails each day or week, controlling what items to keep in an archive for cleaning up purposes becomes important. To do this, Outlook comes with an option called AutoArchive. The default setting in relation to when AutoArchive will run is 14 days. To change this setting, user will need to do the following:
i. Navigate to File > Options > Advanced
ii. Under the AutoArchive menu, click on the AutoArchive settings
iii. Change the settings however way they want.
Answer:
That's correct it's 14 days
Explanation:
:) hope it helps
explain any two factors to consider when classifying computer systems
Answer:
The following classifications can be made of the computer systems:
1. According to size.
2. Functionality based on this.
3. Data management based.
Explanation:
Servers:-
Servers are only computers that are configured to offer clients certain services. Depending on the service they offer, they are named. For example security server, server database.
Workstation:-
These are the computers which have been designed mainly for single users. They operate multi-user systems. They are the ones we use for our daily business/personal work.
Information appliances:-
They are portable devices that perform a limited number of tasks such as basic computations, multimedia playback, internet navigation, etc. They are commonly known as mobile devices. It has very limited storage and flexibility and is usually "as-is" based.
Discuss any five positive and five Negative impact
of ICT on society
Answer:
The technology of information communication has the capacity to transform society. It plays a key part and provides the infrastructure needed to achieve each of the United Nations Sustainable Development Goals. It also allows financial integration by m-commerce and lets people connect instantly to millions.
ICT has a particularly important impact on business. It allows people to exchange knowledge and advice immediately and establish a website or online shop at a low cost, thus reducing the obstacles to starting a business dramatically. As such, it is a major factor in change and the maturity of ICTs is strongly connected to economic growth.
Explanation:
Effects of ICT
As a human beings, we are always associated in our everyday life with many essential things. The use of ICT equipment in our lifestyle has simplified many time-consuming calculations and difficult tasks, and social contacts have been strengthened. ICT has affected life by enhancing the timely distribution of media information and improved home and workplace communications via social networking, e-mail, etc.
The quality of human life has been greatly improved by ICT. For example, it could take a few days for a letter to come to the recipient, but a single minute for an e-mail to reach. ICT offers a broader understanding and information for each facility 24 Hrs X 7 days. In the following, ICT affects different fields of daily living.
Positive Impacts of ICT:
As domestic and home businesses.As social connectivity.As E-learning/ As educationAs for shopping/tradingAs for banksAs a job/jobsNegative Impacts of ICT:
Face-to-face interaction reduced.Social Decoupling.Physical activity/health issues reduced.Cost.Ryan would like to copy a list of contacts from a colleague into his personal address book. The list of contacts is
contained in a simple text file. What should he do first?
O Export from text to .pst.
Import directly from the text file.
O Format the text file with comma-separated values and save as CSV file type.
O Copy and paste the list into the address book.
Answer:
He should: Format the text file with comma-separated values and save as CSV file type. ]
Explanation:
hope this helps!
Answer:
c
Explanation:
Write a python program that will accept monthly salary amounts greater than zero but less
than or equal to 400,000.00 until the user enters the character ‘e’. After the user
enters the character ‘e’, calculate the net pay of all salaries by deducting income tax at
a rate of 25%, pension of 5% and housing contribution of 2% from each salary
entered. Additionally, print the number of salaries that were entered in the program
along with the number of salaries that exceed 300,000.00
Answer:
b=0
c=0
lol=list()
while True:
salary=input("Enter your salary: ")
if salary=="e" or salary=="E":
print("Thankyou!!")
break
else:
a=int(salary)
if a>=300000 and a<=400000:
c=c+1
if a<0 or a>400000:
print("Your salary is either too small or too big ")
if a>0 and a<=400000:
a=a-(25/100*a)-(5/100*a)-(2/100*a)
lol.append(a)
b=b+1
if a>=300000:
c=c+1
print(lol)
print("The number of salaries entered is: "+ str(b))
print("The number of salaries that exceeded 300000 is: "+str(c))
You trained a binary classifier model which gives very high accuracy on thetraining data, but much lower accuracy on validation data. The following maybe true:
a. This is an instance of overfitting.
b. This is an instance of underfitting.
c. The training was not well regularized.
d. The training and testing examples are sampled from different distributions.
Answer:
a. This is an instance of overfitting.
Explanation:
In data modeling and machine learning practice, data modeling begins with model training whereby the training data is used to train and fit a prediction model. When a trained model performs well on training data and has low accuracy on the test data, then we say say the model is overfitting. This means that the model is memorizing rather Than learning and hence, model fits the data too well, hence, making the model unable to perform well on the test or validation set. A model which underfits will fail to perform well on both the training and validation set.
Web analytical packages can obtain the following information when someone visits a website, except Group of answer choices name and address of web visitors geographic location Internet connection type navigation source
Answer:
name and address of web visitors.
Explanation:
A website refers to the collective name used to describe series of web pages linked together with the same domain name.
Web analytical packages are software features that are typically used for tracking the identity of a computer system by placing or adding cookies to the computer when it's used to visit a particular website. Thus, it's only used for tracking the identity of a computer but not the computer users.
This ultimately implies that, web analytical packages can obtain the geographic location, Internet connection type, and navigation source information when someone visits a website, but it cannot obtain the name and address of web visitors or users.
Write a C++ program that reads a number and determines whether the number is positive, negative or zero using Switch operator method
Answer:
#include <iostream>
using namespace std;
template <typename T> int sgn(T val) {
return (T(0) < val) - (val < T(0));
}
int main()
{
cout << "Enter a number: ";
int number;
cin >> number;
switch (sgn(number)) {
case -1: cout << "The number is negative";
break;
case 0: cout << "The number is zero";
break;
case 1: cout << "The number is positive";
break;
}
}
Explanation:
You need the special sgn() function because a switch() statement can only choose from a list of discrete values (cases).
Write a Java method that prints a list of characters using the following header:public static void printChars (char ch1, char ch2, int numPerLine)This method prints chars between ch1 and ch2 (inclusive); the number of chars per-line is specified by int variable numPerLine. Then write and test Java programs that printa) characters from 1 to Z (uppercase), ten chars per line; b) all lowercase letters followed by all uppercase letters, 13 per line (Hint: you may want to call the method printChars twice in this second part)Consecutive characters on the same line should be separated by exactly one space.
Answer:
The method and the test cases is as follows:
import java.util.*;
public class Main{
public static void printChars (char [tex]ch1[/tex], char [tex]ch2[/tex], int [tex]numPerLine[/tex]){
int count = 0;
for(char ch = ch1; ch<=ch2; ch++){
System.out.print(ch+" ");
count++;
if(count == numPerLine){
System.out.println();
count = 0; } }
System.out.println(); }
public static void main(String[] args) {
printChars('1','Z',10);
printChars('a','z',13);
printChars('A','Z',13);
}}
Explanation:
See attachment for complete source file where comments are used as explanation
Accessing disk is much slower than accessing memory. As a result, many file systems have been designed with various optimizations to improve performance. What is an example of file system performance optimization
Answer:
An example of file system performance optimization is Caching - i.e. keep in memory a collection of blocks that logically belong on the disk, for performance reasons.
Explanation:
Caching - i.e. keep in memory a collection of blocks that logically belong on the disk, for performance reasons.
The ultimate frequent method employed to decrease the duration of disk elucidated as a collection of books i.e similar kind that is preserved in invisible area.
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your choice. Use the for each enhanced loop to print the elements of the array.
//======METHOD DECLARATION=========//
//method name: nicknames
//method return type: void
//method parameter: an array reference
public static void nicknames(String [] names){
//initialize the array with 5 random names
names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};
//using an enhanced for loop, print out the elements in the array
for(String n: names){
System.out.print(n + " ");
}
}
Explanation:
The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.
A few things to note.
i. Since the method does not return any value, its return type is void
ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.
iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)
iv. The method receives an array of type String as parameter since the names to be stored are of type String.
v. The format of initializing an array manually should follow as shown on line 7. The new keyword followed by the array type (String), followed by the square brackets ([]) are all important.
vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;
=> The keyword for
=> followed by an opening parenthesis
=> followed by the type of each of the elements in the array. Type String in this case.
=> followed by a variable name. This holds an element per cycle of the loop.
=> followed by a column
=> followed by the array
=> followed by the closing parenthesis.
=> followed by a pair of curly parentheses serving as a block containing the code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.
A complete code and sample output for testing purposes are shown as follows:
==================================================
public class Tester{
//The main method
public static void main(String []args){
String [] names = new String[5];
nicknames(names);
}
//The nicknames method
public static void nicknames(String [] names){
names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};
for(String n: names){
System.out.print(n + " ");
}
}
}
==================================================
Output:John Doe Brian Loveth Chris
NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java
Which of the following statements about the relationship between hardware and software is true? a) Hardware can be present in intangible form. b) A flash drive is an example of software. c) Software and hardware can act independently of each other. d) Software consists of instructions that tell the hardware what to do.
Answer:
C
Explanation:
The statements about the relationship between hardware and software that is true is: D. Software consists of instructions that tell the hardware what to do.
A hardware can be defined as the physical components of an information technology (IT) system that can be seen and touched such as:
RouterSwitchKeyboardMonitorMouseConversely, a software refer to a set of executable codes (instructions) that is primarily used to instruct a computer hardware on how it should process data, perform a specific task or solve a particular problem.
In conclusion, a software consist of a set of executable codes (instructions) that tell a computer hardware what to do.
Read more on hardware here: https://brainly.com/question/959479
Which of the following is NOT one of the five things that work in all applications?
Select one:
Cut, Copy, and Paste
Sort
Undo and Redo
File Menu
Answer:
its either sort or file menu
A primary key ensures that —- are unique ?
Answer:
To qualify as a primary key, it is the data within each column that must be unique, not simply the column names themselves. At the same time, no value in the columns can be blank or NULL. A primary key, therefore, is used to ensure the data in a specific column is unique.
Explanation:
hope it's help
in order to switch from paper to digital medical records the hospital bought in several individuals to introduce and implement the tools needed to organize the files . These individuals would best be described as
Available options are:
A. Technical champions
B. Engaged filmmakers
C. Business partners
D. Compliance champions
Answer:
Technical champions
Explanation:
Given that a "Technical Champion" is someone whose responsibility is to introduce and perform the role of enabling the use of technology, development of skills across the organization, and strengthen communication between Information Technology and the staff or employees.
Hence, in this case, considering the job descriptions described in the question above, these individuals would best be described as TECHNICAL CHAMPIONS
If your goal is for users to read information, create a web __________.
Answer:
Learn, I think hope this works?
Explanation:
spherevolume = (4.0 / 3.0) * pival * sphereradius * sphereradius * sphereradius ;
Answer:
The program in Python is as follows:
pival = 3.142
sphereradius = float(input("Radius: "))
spherevolume = [tex](4.0 / 3.0)[/tex] * [tex]pival[/tex] * sphereradius * [tex]sphereradius[/tex] * sphereradius
print(spherevolume)
Explanation:
The missing part of the program is to calculate the volume of a sphere.
The program in Python (in the answer section) is implemented using the already used variables.
Initialize pi
pival = 3.142
Get input for radius
sphereradius = float(input("Radius: "))
Calculate the volume
spherevolume = [tex](4.0 / 3.0)[/tex] * [tex]pival[/tex] * sphereradius * [tex]sphereradius[/tex] * sphereradius
Print the calculated volume
print(spherevolume)
Two hundred workstations and four servers on a single LAN are connected by a number of switches. You’re seeing an excessive number of broadcast packets throughout the LAN and want to decrease the effect this broadcast traffic has on your network. What steps must you take to achieve this goal?
Answer:
Add more servers or decrease the amount of workstations
To stop broadcast storms one can enable the use of Storm Detect feature that can help to disable a port if it is getting a lot of number of Broadcast or Multicast packets.
What is excess of broadcast storms?A broadcast storm is known to be a kind of bad or high number of broadcast packets that occurs in a little or short time frame.
Note that To stop broadcast storms one can enable the use of Storm Detect feature that can help to disable a port if it is getting a lot of number of Broadcast or Multicast packets.
Learn more about storms from
https://brainly.com/question/7014058
#SPJ9
Which of the following Python methods is used to perform hypothesis testing for a population mean when the population standard deviation is unknown?
a. uttest(dataframe, null hypothesis value)
b. ztest(dataframe, null hypothesis value)
c. prop_1samp_hypothesistest(dataframe, n, alternative hypothesis value)
d. ttest_1samp(dataframe, null hypothesis value)
Answer:
B: ztest(dataframe, null hypothesis value)
The Python method that is used to perform a test of hypothesis for a population mean with an unknown population standard deviation is d. ttest_1samp(dataframe, null hypothesis value).
A t-test is normally applied when the population standard deviation is not known. The researcher will use the sample standard deviation.While the z-test can also be used in Python to perform hypothesis testing with a known population standard deviation and a sample size that is larger than 50, only the t-test can be applied with an unknown population standard deviation or a sample size less than 50.Thus, the only Python method to carry out hypothesis testing with unknown population standard deviation is the t-test, which is given in option d.
Learn more about hypothesis testing at https://brainly.com/question/15980493
Which of the following ribbon tools would be most efficient for applying multiple
changes to text formatting?
a. Font Dialog Box
b. Paragraph Styles
c. Styles Dialog Box
d. Find and Replace
Answer:
Option A, Font Dialog Box
Explanation:
In order to make changes in the text formatting, the font setting in the dialog box can be used on the Ribbon's Home tab.
From the font settings in Word 2016, one can change the following change font color, size, style etc.
Hence, option A is correct
For each compound below, identify any polar covalent bonds and indicate the direction of the dipole moment using the symbols δ +and δ-.
(a) HBr
(b) HCI
(c) H2O
(d) CH40
Answer:
H-Br bond is polar, hydrogen is partly positive and bromine is partly negative
H-Cl bond is polar, hydrogen is partly positive and bromine is partly negative
O-H bond in water is polar, hydrogen is partly positive and oxygen is partly negative
C-O bond in CH40 is polar, carbon is partly positive and oxygen is partly negative
Explanation:
A molecule possess a dipole moment when there is a large difference in electro negativity between two bonding atoms in the molecule.
The presence of dipole moments introduces polarity to the molecule. In all the molecules listed in the answer, the shared electron pair of the bond is closer to the more electronegative atom causing it to be partially negative while the less electronegative atom in the bond is partially positive.
A pointer can be used as a function argument, giving the function access to the original argument.
A. True
B. False
Answer:
True
Explanation:
A pointer can be used as a function argument, giving the function access to the original argument.
What is food technology
Answer:
is the application of food science to the selection, preservation, processing, packaging, distribution, and use of safe food. Related fields include analytical chemistry, biotechnology, engineering, nutrition, quality control, and food safety management.
Explanation:
Wi-fi refers to a network that is based on the ____ standard
Answer:
Wi-fi refers to a network that is based on the 802.11 standard.
Answer:
It is based on the 802.11 standard
Explanation:
Exam Lesson Name: Introduction to Design Technology
Exam number. 700796RR
> Exam Guidelines
Exam Instructions
Question 8 of 20 :
Select the best answer for the question
8. Cycling through the design process to create several models that incrementally improve a solution is called what?
O A. Six Sigma
B. Success criteria
C. Just-in-time production
D. Iterative design
Mark for review (Will be highlighted on the review page)
Type here to search
O
Bi
S
Answer:
D. Iterative design
Explanation:
An iterative design can be defined as a cyclic process which typically involves prototyping, testing, evaluating or analyzing and refining of a product, so as to continually improve the product.
In an iterative design process, the following steps are adopted;
1. A prototype of the product is first created and tested by the manufacturer.
2. The product is then evaluated to check for any defect or flaw.
3. The defect or flaw is fixed through a refining process.
4. The previous steps are repeated incrementally until an improved version of the product is created.
Hence, cycling through the design process to create several models that incrementally improve a solution is called iterative design.
Answer:
Iterative Design
Explanation:
A. It seeks to figure what it defective
B. It reaffirms if all requirements are met to solve a problem
C. It's main goal was to avoid excess products that might not end up making sales in the near future
D. Making several revision on problems to take out an efficient solution
D makes the most sense here.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))
(1) Prompt the user to input a wall's height and width. Calculate and output the wall's area (integer). (Submit for 2 points).
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall (floating point). Assume a gallon of paint covers 350 square feet. Store this value in a variable. Output the amount of paint needed using the %f conversion specifier. (Submit for 2 points, so 4 points total).
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.51 gallons
(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon. (Submit for 2 points, so 6 points total).
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.51 gallons
Cans needed: 1 can(s)
(4) Extend by prompting the user for a color they want to paint the walls. Calculate and output the total cost of the paint cans depending on which color is chosen. Hint: Use a dictionary to associate each paint color with its respective cost. Red paint costs $35 per gallon can, blue paint costs $25 per gallon can, and green paint costs $23 per gallon can. (Submit for 2 points, so 8 points total).
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.51 gallons
Cans needed: 1 can(s)
Choose a color to paint the wall:
red
Cost of purchasing red paint: $35
1 import math
2
3 # Dictionary of paint colors and cost per gallon
4 paint_colors = {
5 'red': 35,
6 'blue': 25,
7 'green': 23
8 }
9
10 # FIXME (1): Prompt user to input wall's width
11 # Calculate and output wall area
12 wall_height = int(input('Enter wall height (feet):\n'))
13 print('Wall area:')
14
15 # FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall
16
17 # FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer
18
19 # FIXME (4): Calculate and output the total cost of paint can needed depending on color
20
Answer:
The modified program in Python is as follows:
import math
paint_colors = {'red': 35,'blue': 25,'green': 23}
wall_height = int(input('Enter wall height (feet):\n'))
wall_width = int(input('Enter wall width (feet):\n'))
area = wall_height*wall_width
print('Wall area:',area,'square feet')
paint_needed = area/350.0
print('Paint needed: {:.2f} gallons'.format(paint_needed))
print('Cans needed:',round(paint_needed),'can(s)')
color = input("Choose a color to paint the wall: ")
print("Cost of purchasing", color, "paint: $",paint_colors[color])
Explanation:
The italicized are given from the question [unchanged]
import math
paint_colors = {'red': 35,'blue': 25,'green': 23}
wall_height = int(input('Enter wall height (feet):\n'))
This gets input for width
wall_width = int(input('Enter wall width (feet):\n'))
Calculate the wall area
area = wall_height*wall_width
Print the calculated wall area
print('Wall area:',area,'square feet')
Calculate the amount of paint needed
paint_needed = area/350.0
Print the amount of paint needed to 2 decimal places
print('Paint needed: {:.2f} gallons'.format(paint_needed))
Print the amount of can needed to nearest integer
print('Cans needed:',round(paint_needed),'can(s)')
Prompt user for color of paint [here, we assume the user input is correct]
color = input("Choose a color to paint the wall: ")
Prints the corresponding amount for the color
print("Cost of purchasing", color, "paint: $",paint_colors[color])
Write a public static method named print Array, that takes two arguments. The first argument is an Array of int and the second argument is a String. The method should print out a list of the values in the array, each separated by the value of the second argument.
For example, given the following Array declaration and instantiation:
int[] myArray = {1, 22, 333, 400, 5005, 9}; printArray(myArray, ", ") will print out 1, 22, 333, 400, 5005, 9
printArray(myArray, " - ") will print out 1 - 22 - 333 - 400 - 5005 - 9
Answer:
Here is the output.
Explanation:
import java.util.Arrays;
public class Main{
public static void main(String[] args){
int[] array={43,42,23,42,4,56,36,7,8,676,54};
System.out.println(Arrays.toString(array));
printArray(array,"*");
System.out.println(""+getFirst(array));
System.out.println(""+getLast(array));
System.out.println(Arrays.toString(getAllButFirst(array)));
System.out.println(""+getIndexOfMin(array));
System.out.println(""+getIndexOfMax(array));
System.out.println(Arrays.toString(swapByIndex(array, 1,2)));
System.out.println(Arrays.toString(removeAtIndex(array,3)));
System.out.println(Arrays.toString(insertAtIndex(array,3,65)));
}
//---1----
public static void printArray(int[] arr, String sep){
for(int i=0; i<arr.length-1;i++){
System.out.print(" "+arr[i]+" "+sep);
}
System.out.println(" "+arr[arr.length-1]);
}
//---2----
public static int getFirst(int[] arr){
return arr[0];
}
//---3----
public static int getLast(int[] arr){
return arr[arr.length-1];
}
//---4-----
public static int[] getAllButFirst(int[] arr){
int[] anotherArray=new int[arr.length-1];
for(int i=1; i<arr.length;i++){
anotherArray[i-1]=arr[i];
}
return anotherArray;
}
//---5------
public static int getIndexOfMin(int[] arr){
int index=0;
int min=arr[0];
for(int i=1; i<arr.length;i++){
if(min>arr[i]){
min=arr[i];
index=i;
}
}
return index;
}
//---6------
public static int getIndexOfMax(int[] arr){
int index=0;
int max=arr[0];
for(int i=1; i<arr.length;i++){
if(max<arr[i]){
max=arr[i];
index=i;
}
}
return index;
}
//---7------
public static int[] swapByIndex(int[] arr, int a , int b){
int temp=arr[a];
arr[a]=arr[b];
arr[b]=temp;
return arr;
}
//---8------
public static int[] removeAtIndex(int[] arr, int index){
int[] anotherArray = new int[arr.length - 1];
for (int i = 0, k = 0; i < arr.length; i++) {
if (i == index) {
continue;
}
anotherArray[k++] = arr[i];
}
// return the resultant array
return anotherArray;
}
//---9------
public static int[] insertAtIndex(int[] arr, int index, int element){
int[] anotherArray = new int[arr.length + 1];
for (int i = 0, k=0;k < arr.length+1; k++) {
if (k == index) {
anotherArray[k]=element;
continue;
}
anotherArray[k] = arr[i++];
}
// return the resultant array
return anotherArray;
}
//---10------
public static boolean isSorted(int[] arr){
for(int i=0; i<arr.length-1;i++){
if (arr[i+1]<arr[i]){
return false;
}
}
return true;
}
}