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
devlian [24]
3 years ago
15

Ternary operators of computerplease explain. ​

Computers and Technology
1 answer:
Nitella [24]3 years ago
5 0

Answer:

It's a compact way of doing an if-else statement.

General Format is

<<em>condition</em>> ? <if condition is true> : <else>;

Example:

I could rewrite:

  if(a==1) temp = 1;

  else     temp = 999;

as

  temp = (a==1) ? 1 : 999;

You might be interested in
Write a sed command that will display all lines of the birthday file that do not contain the string March. What was the sed comm
Dmitriy789 [7]

Answer:

sed '/march/{d;}' birthdays.txt > result .txt

Explanation:

sed syntax is basically:

<em>sed '/expression/{command;command;...;}' inputfile > outputfile</em>

  • First, for the expression part, we use /march/ to match all lines containing that string.
  • Then for the command part, we only use {d} command to delete every matching line found.
  • The third part contains the input file to process, I have named it birthdays.txt, but it could have been any other file needed.
  • Finally "> result .txt" makes the script output to be saved into a file named result.txt
6 0
2 years ago
Which term refers to a type of an attack in which an attacker makes his data look like it is coming from a different source addr
Andrew [12]

<u>Man-in-the-middle attack</u> refers to a type of an attack in which an attacker makes his data look like it is coming from a different source address, and is able to intercept information transferred between two computers.

<u>Explanation:</u>

A man-in-the-middle attack (MITM) is an assault where the aggressor furtively transfers and potentially changes the correspondences between two gatherings who accept that they are straightforwardly speaking with one another. This happens when the assailant catches a segment of a correspondence between two gatherings and retransmits it sometime in the future. The assailant would then be able to screen and perhaps change the substance of messages. The utilization of such encoded burrows makes extra secure layers when you get to your organization's secret systems over connections like Wi-Fi.

8 0
2 years ago
Binary divide 1101011 by 111​
denis-greek [22]

is this computer subject

5 0
3 years ago
Read 2 more answers
The CEO, calls you into her office and tells you that she's learned that the company needs a database to keep track of supplier
k0ka [10]
The database has been a very unique way to park in
7 0
2 years ago
The ArrayList class contains a trim method that resizes the internal array to exactly the capacity. The trim method is intended
andreev551 [17]

Answer:

public void trimToSize() {

modCount++;

if (size < elementData.length) {

elementData = (size == 0)

? EMPTY_ELEMENTDATA

: Arrays.copyOf(elementData, size);

}

}

Now, the running time for copyOf() function is O(N) where N is the size/capacity of the ArrayList. Hence, the time complexity of trimToSize() function is O(N).

Hence, the running time of building an N-item ArrayList is O(N^2).

Please find the sample code below.

CODE

==================

import java.util.ArrayList;

public class Driver {

  public static void main(String[] args) throws Exception{

      int N = 100000;

      ArrayList<Integer> arr = new ArrayList<>(N);

     

      long startTime = System.currentTimeMillis();

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

          arr.add(i);

          arr.trimToSize();

      }

      long endTime = System.currentTimeMillis();

      double time = (endTime - startTime)/1000;

      System.out.println("Total time taken = " + time + " seconds.");

  }

}

Explanation:

5 0
3 years ago
Other questions:
  • What is the meaning for science?
    14·1 answer
  • What type of interview would be most likely for the following scenario?
    11·2 answers
  • The "origin" of the cartesian plane in math is the point where x and y are both zero. Given a variable, origin of type Point-- a
    5·1 answer
  • Is it safe to take apart a computer monitor?
    13·1 answer
  • What power brake uses vacuum from the engine to aid in brake application?
    6·2 answers
  • PLEASE HELP ASAP<br> Which technology encrypts traffic between a web browser and a website?
    10·2 answers
  • A user reports that nothing happens when he or she attempts to print from the computer at his desk. This points to a possible pr
    15·1 answer
  • Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d
    8·1 answer
  • Taking a group of recipes and identifying the similarities is an example of _____.
    13·1 answer
  • What does this mean??
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!