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
Phantasy [73]
3 years ago
13

The code segment below uses the procedure IsPartOf (list, item), which returns true if item appears in list and returns false ot

herwise. The list newList is initially empty.FOR EACH item IN oldList{ IF (NOT IsPartOf (newList, item)) { APPEND (newList, item) }}Which of the following best describes the contents of newList after the code segment is executed?a. All elements in oldList which are repeated.b. All elements in oldList which are NOT repeated.c. All elements in oldList, including any repeats of elements.d. All unique elements in oldList NOT including any repeats of elements.
Computers and Technology
1 answer:
kakasveta [241]3 years ago
4 0

Answer:

Option d All unique elements in oldList NOT including any repeats of elements.

Explanation:

Given the function isPartOf() that will check if the input item is found in the input list.  Therefore if we run the following code segment

FOR EACH item IN oldList{

         IF (NOT IsPartOf (newList, item))

                 { APPEND (newList, item) }

}

the expression <em>NOT IsPartOf (newList, item) </em>will be evaluated to true if it encounter the first occurrence of a element and append the item to the newList. The repeat element will always be evaluated to False and therefore the repeat element won't be appended to the newList.

At the end, the newList will hold all the unique elements in oldList which doesn't include any repeats of elements.

You might be interested in
Versiones del Moodle
SIZIF [17.4K]

Answer:

Moodle 3.1 (LTS), Moodle 3.1, Moodle 3.1.1, Moodle 3.1.2, Moodle 3.1.3, Moodle3.1.4

4 0
3 years ago
Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in
Delvig [45]

Answer:

// program in java.

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input  

Scanner scr=new Scanner(System.in);

 System.out.print("Enter the String:");

  // read string from user

   String str=scr.nextLine();

System.out.print("Enter the character:");

 // read character

char ch=scr.next().charAt(0);

  // variable to count the occurrence of character  

   int char_count=0;

   for(int i=0;i<str.length();i++)

   {

   // find the character i string

       if(ch==str.charAt(i))

       // increase the count

       char_count++;

   }

   // print the count

   System.out.println("count of "+ch+" in the String is:"+char_count);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read a string from user and assign it to variable "str".Then read a character to  and assign it to variable "ch".Then Declare a variable "char_count" to count the  occurrence of character in the string.Find the count of character in the string. Here upper case character is different than lower case.  

Output:

Enter the String:Monday                                                                                                    

Enter the character:n                                                                                                      

count of n in the String is:1

Enter the String:Nobody                                                                                                    

Enter the character:n                                                                                                      

count of n in the String is:0                                                                                              

                             

5 0
3 years ago
Which group allows you to add notes to your presentation?
aleksandrvk [35]

Answer:

Presentation views

Explanation:

6 0
3 years ago
Read 2 more answers
Explain chart elements​
taurus [48]

Answer:

The different parts that make up a chart are referred to as chart elements.

Most of the items on a chart can be repositioned by clicking on an item and dragging it with the right mouse button.

The black handles also indicate that the item could be moved, resized and formatted.

All of these chart items (except the chart area) once selected can be moved around and resized relative to other items.

Explanation:

4 0
3 years ago
Select the correct answer.
oee [108]

Answer:

D

Explanation:

3 0
3 years ago
Other questions:
  • Suppose that we are developing a new version of the AMD Barcelona processor with a 4 GHz clock rate. We have added some addition
    11·1 answer
  • You learned about microcomputer a personal computer designed for use by an individual. Perform online research find out the diff
    12·1 answer
  • What format must a document be saved in to share it between two different word processors
    11·1 answer
  • A telephone repair technician uses a meter to measure voltage on a phone line. This meter is an example of _____.
    10·2 answers
  • ​what is the best advice to follow when using texting or instant messaging (im) in the workplace
    5·1 answer
  • You are required to justify the need to implement a three-tier campus network. Which justification below makes sense for a three
    6·1 answer
  • PLSSS HELPP IM DESPERATE!!!
    11·1 answer
  • To see the formula in a cell, look at the___
    5·1 answer
  • Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length
    10·1 answer
  • Which of the statements below is true?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!