1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ra1l [238]
2 years ago
8

Perform the Insert, Modify and Remove functionalities on the Dictionary based on the Key.

Computers and Technology
1 answer:
Ilia_Sergeevich [38]2 years ago
7 0

Answer:

Dictionary contains Key value pairs where key is used to retrieve the value

Explanation:

Using System.Collections;

void main(){

Dictionary<int, string> dict = new Dictionary<int, string>();

dict.Add(1,"One");

dict.Add(2,"Two");

dict.Add(3,"Three");

dict.Remove(1);

dict[2] = "Two Updated";

}

Dictionary<int, string> is a dictionary whose keys are integers and values are strings.

Add function is used to add elements to the dictionary

Remove function removes the key value pair from the dictionary based on given key.

we can directly modify/update the element in dictionary using the key

You might be interested in
Question 1 (1 point)
worty [1.4K]

Answer:

1)hardware

2)hard drive

3)network devices

4)software(its all u can touch from a computer)

5)false

6)system software

7)programming software

8)data

9)user

10)users

Explanation:

8 0
2 years ago
Read 2 more answers
According to the textbook, the definition of transition is
Bogdan [553]

Answer:

D. Which is None of the Above

7 0
3 years ago
You are working the 8:00 AM shift at the help desk. An irate user who fails to identify himself calls in claiming that his works
WARRIOR [948]

Answer:

Calmly ask him for his name and a more detailed explanation of the problem.

Explanation:

Since in the question,  it is mentioned that the anger use who fails to identify himself and claim that his workstation is malfunctioning and want to fix it now

Now the action which would be taken is to ask his name in a calmy manner and understand what the actually problem he is suffering by understanding it in a detailed way

Therefore according to the given case, the correct option is d.

3 0
3 years ago
TCP is a Transport-layer protocol used to communicate between applications, but it's a lightweight Transport-layer protocol, mea
denis-greek [22]

Answer:

The answer to the given question is the option "B".

Explanation:

In this question, the answer is false because the UDP is not reliable for the data flow control.  In the transport layer protocol it two protocols to serving the transportation layer that is TCP and UDP.  

  • In the network layer, IP protocol sends a datagram to the destination host from a source host. When a host sends a message to another host, the origin process sends a request to a process of destination.              
  • The Transport layer protocol is a part of the UDP and is not reliable.  

That's why the answer to this question is "false".

3 0
2 years ago
Write a program that accepts a file name from the command line, then initializes an array with test data using that text file as
postnew [5]

Answer:

Complete code is given below:

Explanation:

import java.io.BufferedReader;

import java.io.FileNotFoundException;

import java.io.FileReader;

import java.io.IOException;

import java.util.Arrays;

import java.util.Scanner;

public class ArrayCalcs {

private int size;

String [] parts =null;

// based on number of elements in file, array will create.

double[] arr=null;

public void readFile(String file){

try{

FileReader fr = new FileReader(file+".txt");

BufferedReader br = new BufferedReader(fr);

String line = br.readLine();

int count = 0;

while (line != null) {

parts = line.split(" ");

for( String w : parts)

{

count++;

}

line = br.readLine();

}

size=count;

arr=new double[size];

for(int i=0;i<size;i++){

arr[i]=Double.parseDouble(parts[i]);

}

// System.out.println(count);

// System.out.println(Arrays.toString(parts));

System.out.println(Arrays.toString(arr));

} catch (FileNotFoundException ex){

System.out.println("This file does not exist");

} catch (IndexOutOfBoundsException e){

System.out.println("Thie file has more than 7 lines");}

catch (IOException e) {

System.out.println(e.getMessage());

}

}

public double getTotal(){

double sum=0.0;

for(double d:arr){

sum=sum+d;

}

return sum;

}

public double getAverage(){

double avg=getTotal()/arr.length;

return avg;

}

public double getHighest(){

double high=arr[0];

for(int i=0;i<arr.length-1;i++){

if(arr[i] > high)

high = arr[i];

}

return high;

}

public double getLowest(){

double low=arr[0];

for(int i=0;i<arr.length-1;i++){

if(arr[i] < low)

low= arr[i];

}

return low;

}

public static void main(String[] args) {

Scanner s = new Scanner(System.in);

System.out.println("Enter file name:");

String file=s.next();

ArrayCalcs ac=new ArrayCalcs();

ac.readFile(file);

System.out.println(" Highest Element: "+ac.getHighest());

System.out.println("Lowest Element: "+ac.getLowest());

System.out.println("Total: "+ac.getTotal());

System.out.println("Average: "+ac.getAverage());

}

}

4 0
3 years ago
Other questions:
  • What will the following code display? #include using namespace std; void doSomething(int); int main() { int x{2}; cout &lt;&lt;
    9·1 answer
  • The word software is interchangeable with what word
    8·1 answer
  • How much heat is needed to raise the temperature of 7g of water by 15oC?
    6·1 answer
  • Provide instance fields for title, month, and year (for example, "Scientific American", "April", 2020). Each of these should be
    13·1 answer
  • _______ allows you to add formatting such as shapes and colors to text. a. worddraw b. wordart c. worddesign d. wordshapes
    10·2 answers
  • Account in the chart of accounts is assigned a number at random. t/f
    11·1 answer
  • Enumera 3 exemple de operatii de lucru cu elementele grafice 3D. Repede va rog dau coroana
    15·1 answer
  • What is computer and its features<br>​
    5·2 answers
  • What is a Turing Test and the Loebner Prize?
    15·1 answer
  • What type of program would you use to create a personal budget?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!