Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways.
Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is quit.
Ex: If the input is:
apples 5
shoes 2
quito 0
the output is
Eating 5 apples a day keeps the doctor away.
Eating 2 shoes a day keeps the doctor away.
Note: This is a lab from a previous chapter that now requires the use of a loop. LB 334 1 LAB Mad Lib-loops main.cpp Load default template.
1 #include
2 #include
3 using namespace std;
4
5 int main()
6
7 {
8 return;
9
10

Answers

Answer 1

Answer:

Following are the code to this question:

#include <iostream>//header file

#include <string>//header file

using namespace std;

int main() //main method

{

   string item;//defining a string variable

   int n;//defining integer variable

   while(cin >>n >>item)//defining while loop to input value  

   {

       if(item == "quito" && n == 0)//use if block to check input value  

       {

           break;//use break keyword

       }

       cout << "Eating " << n << " " << item << " a day keeps the doctor away." << endl;//print input value with the message

   }

   return 0;

}

Output:

Please find the attached file.

Explanation:

In this code, inside the main method one string variable and one integer variable "item, n" is defined, that uses the while loop for input the value and uses the if block that checks string value is equal to "quito" and n value is equal to "0" it breaks the loop, and print the value with the message.

Mad Libs Are Activities That Have A Person Provide Various Words, Which Are Then Used To Complete A Short

Related Questions

I don't get the width and height part (PLEASE HELP WILL GIVE BRAINLIEST ANSWER)

Answers

Answer:

What they're saying is that the first two bytes (first two eight bit segments) tell you the width and height of the pattern.

In the example given, you'll notice that the first 16 digits are 00000100 00000100.  If you convert those to decimal, you'll see that those are both equal to four.

If instead the second block of eight bits was 00000111, the image height would then be seven.

The intelligence displayed by humans and other animals is termed?

Answers

Answer:

ᗅгᝨเŦเςเᗅl เภᝨєllเﻮєภςє, Տ⌾๓єᝨเ๓єՏ ςᗅllє๔ ๓ᗅςђเภє เภᝨєllเﻮєภςє ⌾г ๓ᗅςђเภє lєᗅгภเภﻮ, เՏ เภᝨєllเﻮєภςє ๔є๓⌾ภՏᝨгᗅᝨє๔ ๒γ ๓ᗅςђเภєՏ, เภ ς⌾ภᝨгᗅՏᝨ ᝨ⌾ ᝨђє ภᗅᝨႮгᗅl เภᝨєllเﻮєภςє ๔เՏקlᗅγє๔ ๒γ ђႮ๓ᗅภՏ ᗅภ๔ ⌾ᝨђєг ᗅภเ๓ᗅlՏ. ... Տ⌾๓єᝨђเภﻮ ᝨђᗅᝨ'Տ ђєlקเภﻮ ᝨђเՏ ςђᗅภﻮє เՏ ᗅгᝨเŦเςเᗅl เภᝨєllเﻮєภςє.

հօթҽ íԵ հҽlթs

Natural intelligence relates to life concepts and life choices which adhere to the natural constraints or boundaries of the world's resources and the further discussion can be defined as follows:

It is defined as an emotional impulse ingrained into the common myth that drives us to value & defend the integrity of any living creatures.It is the polar opposite of artificial intelligence, which is all of the control mechanisms found in life. Nature also displays non-neural control in plants and protozoa, as well as dispersed intellect in colonies species including such ants, jackals, and people.

Therefore, the final answer is "Natural intelligence".

Learn more:

brainly.com/question/16456970

Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames will be numbered ????1, ????2 and so on, and B’s similarly. Let T = 51.2 ????????????c be the exponential backoff base unit. Suppose A and B simultaneously attempt to send frame 1, collide, and happen to choose backoff times of 0 × T and 1 × T, respectively. As a result, Station A transmits ????1 while Station B waits. At the end of this transmission, B will attempt to retransmit ????1 while A will attempt to transmit ????2. These first attempts will collide, but now A backs off for either 0 × T or 1 × T (with equal probability), while B backs off for time equal to one of 0 × T, 1 × T, 2 × T and 3× T (with equal probability).(a) Give the probability that A wins this second backoff race immediately after his first collision.(b) Suppose A wins this second backoff race. A transmits ????2 and when it is finished, A and B collide again as A tries to transmit ????3 and B tries once more to transmit ????1. Give the probability that Awins this third backoff race immediately after the first collision.(c) What is the probability that A wins all the ???? backoff races. (???? is a given constant)(d) Assume that there are 3 stations sharing the Ethernet. Will the chance for A to win all the backoffraces decrease or increase? Why?

Answers

Answer:

Following are the solution to the given question:

Explanation:

Please find the complete and correct question in the attachment file.  

For Point a:

For the second round,

A is selects kA(2)  either 0 or 1, so for each of them, that is [tex]\frac{1}{2}[/tex].

B selects [tex]kB(2)\ from\ (0, 1, 2, 3)[/tex] for each choice with the probability of [tex]\frac{1}{4}[/tex].

If [tex]kA(2) < kB(2)[/tex] wins the second rear race.

[tex]\to P[A \ wins] = P[kA(2) < kB(2)][/tex]

                     [tex]= P[kA(2) = 0] \times P[kB(2) > 0] + P[kA(2) = 1] \times P[kB(2) > 1]\\\\= \frac{1}{2} \times \frac{3}{4} + \frac{1}{2} \times \frac{2}{4} \\\\=\frac{3}{8} +\frac{2}{8} \\\\= \frac{3+2}{8}\\\\= \frac{5}{8}[/tex]

For Point b:

Throughout this example, [tex]kA(3)[/tex] also selects to be either 0 or 1 with such a [tex]\frac{1}{2}[/tex] probability. So, although B chooses [tex]kB(3)[/tex] from [tex](0, 1, 2, 3, 4, 5, 6, 7),[/tex] the probabilities each are [tex]\frac{1}{8}[/tex]:

[tex]\to P[A \ wins] = P[kA(3) < kB(3)][/tex]

                     [tex]= P[kA(3) = 0] \times P[kB(3) > 0] + P[kA(3) = 1] \times P[kB(3) > 1]\\\\= \frac{1}{2} \times \frac{7}{8} + \frac{1}{2} \times \frac{6}{8}\\\\= \frac{7}{16} + \frac{6}{16}\\\\= \frac{7+6}{16} \\\\= \frac{13}{16}\\\\[/tex]

For point c:

Assume that B tries again 16 times (typical value), and it destroys. In addition, throughout the exponential background n is obtained at 10 when choosing k between 0 to 2n−1. The probability of A winning all 13 backoff events is: [tex]P[A \text{wins remaining races}] = 16\pi i =4P[A \ wins \ i |A \ wins \ i -1 ][/tex]

Let the k value kA(i) be A for the backoff race I select. Because A retains the breed

[tex]=(kA(i)] \cdot P[kA(i+ 1)< kB(i+ 1)] \geq P[kA(i) + 1<kB(i)] \cdot P[kA(i+ 1)< kB(i+1)]+P[kA(i) + 1 \geq kB(i)] \cdot P[kA(i+ 1)< kB(i+ 1)] \\\\= (P[kA(i) + 1< kB(i)] +P[kA(i) + 1 \geq kB(i)]) \times P[kA(i+ 1) < kB(i+ 1)]\\\\=P[kA(i+ 1)< kB(i+ 1)]\\\\[/tex]

For point d:

Two stations A and B are supposed. They assume that B will try 16 times afterward. Even so, for A, 16 races were likely to also be won at a rate of 0.82 For Just higher expectations of three A, B, and C stations. For Station A, possibility to win all backoffs

A for loop is used to replace a ________ while loop

Answers

counting like loop is the answer

Answer:

counting

Explanation:

It looks like you're initializing your counter variable before you create the for loop.

Film and video speak the same audiovisual’’__________.’’

Answers

Answer:

Film and video speak the same audiovisual ’’Technology’’

Match the web development languages to their types.
PHP
HTML
ASP
JavaScript
XML
SGML
MARKUP LANGUAGE
SCRIPTING LANGUAGE

Answers

Answer:

HTML, XML and SGML are the markup languages (hence the "ML" suffix on each of their acronyms).

PHP, ASP and Javascript are scripting languages.

A kind of markup language is HTML. It "marks up" or encapsulates data using HTML tags that specify the data and explain how it will be used on the webpage. Following that, the web browser examines the HTML, which instructs it as to what sections are headings, paragraphs, links, etc.

What are the different web development languages?

OOP scripting is used in Java, whereas OOP programming is used in Java. JavaScript code can only be run on a browser, while Java applications can run on a virtual machine or browser.

While JavaScript code is completely in text, Java code must be compiled. They both need various plug-ins.

Therefore, The "ML" suffix on each acronym stands for markup languages, which are HTML, XML, and SGML respectively. Scripting languages include JavaScript, ASP, and PHP.

Learn more about languages here:

https://brainly.com/question/29239656

#SPJ2

Which version of Microsoft Office is free?

Answers

Answer:

the older versions and really all of them are

Answer:

This is what I found on the internet that I hope will help you! :3

Explanation:

It's a free app that will be preinstalled with Windows 10, and you don't need an Office 365 subscription to use it. The existing My Office app has many of these features, but the new Office app puts the focus on the free online versions of Office if you're not an Office 365 subscriber.

Compilers can have a profound impact on the performance of an application. Assume that for a program, compiler A results in a dynamic instruction count of 1.0E9 and has an execution time of 1.1 s, while compiler B results in a dynamic instruction count of 1.2E9 and an execution time of 1.5 s. a. Find the average CPI for each program given that the processor has a clock cycle time of 1 ns.

Answers

Answer:

The answer is "1.25"

Explanation:

[tex]{CPU \ time}= {instructions \times CPI \times cycle\ time}[/tex]

[tex]\therefore\\\CPI= \frac{CPU \ time}{instructions \times cycle \ time} \\\\cycle \ time = 1 \\\\ns = 10^{-9} s \\[/tex]

Also for this context, it executes the time =  CPU time. So, the compiler A, we has

[tex]CPI_{A}= \frac{CPU \ time_{A}} {instructions_{A} \times cycle \ time}= \frac{1.1 s}{10^{9} \times 10^{-9} s}= 1.1[/tex]

For compiler B, we have

[tex]CPI_{B}= \frac{CPU \ times_{B}} {instructions_{B} \times cycle \ time}[/tex]

         [tex]= \frac{1.5\ s}{ 1.2 \times 10^{9} \times 10^{-9} \ s}\\\\= \frac{1.5}{ 1.2 }\\\\= 1.25[/tex]

The average CPI for each program given that the processor has a clock cycle time of 1 ns is : 1.1, 1.25.

Average CPI for each program

CPI (Complier A)=CPU time/Instruction×Cycle time

Where:

Cycle time=1ns=10^-9s

Hence:

CPI (Complier A)=1.1s/10^9×10^-9s

CPI (Complier A)=1.1

CPI (Complier B)=CPU time/Instruction×Cycle time

CPI (Complier B)=1.5s/1.2×10^9×10^-9s

CPI (Complier B)=1.25

Inconclusion the average CPI for each program given that the processor has a clock cycle time of 1 ns is : 1.1, 1.25.

Learn more about average CPI here:https://brainly.com/question/24723238

The Boolean Foundation hosted a raffle to raise money for charity and used a computer program to notify the participants about the results. Unfortunately, the program they used was not very robust and all 250 participants received an email telling them that they won... and that their name is Shauna.
Improve this program by writing a function called sendEmail to print a personalized email to stdout. The function should take three parameters:
The name of the recipient
The prize for the raffle
Whether or not the recipient won
Use the email template from the existing program.
#include
using namespace std;
int main() {
cout << "Dear Shauna," << endl;
cout << "You are the winner of our raffle for charity." << endl;
cout << "The prize was: a stuffed giraffe toy" << endl;
cout << "Thank you for giving to charity!" << endl;
cout << "Sincerely," << endl;
cout << "The Boolean Foundation" << endl;
return 0;
}

Answers

Answer:

The function is as follows:

void sendEmail(string name, string prize, string win_lose){

cout << "Dear "<<name<<", " << endl;

cout << "You are the "<<win_lose<<" of our raffle for charity." << endl;

cout << "The prize was: "<<prize<< endl;

cout << "Thank you for giving to charity!" << endl;

cout << "Sincerely," << endl;

cout << "The Boolean Foundation" << endl;

}

Explanation:

This defines the function along the three parameters

void sendEmail(string name, string prize, string win_lose){

This prints the salutation with the person's name

cout << "Dear "<<name<<", " << endl;

This prints if the person won or lost

cout << "You are the "<<win_lose<<" of our raffle for charity." << endl;

This prints the prize, if any

cout << "The prize was: "<<prize<< endl;

The following is the closing remark

cout << "Thank you for giving to charity!" << endl;

cout << "Sincerely," << endl;

cout << "The Boolean Foundation" << endl;

}

0111101101010110101110110001001011101001011101101010101010110101
Refer to the above bit string to answer the below questions.
Create a valid IPv4 addresses using the above bit string.

Answers

Answer:

binary digits in computer system it belongs


What is software?
a. The soft parts of a computer, like the mouse pad. b. The collection of programs that make the computer do useful work
c. The physical components that come together to form a computer
d. A special kind of CD-ROM

Answers

Answer:

B

Explanation:

Answer:

I believe the answer is B

What are other ways you could use the shake or compass code blocks in physical computing projects?

Answers

Answer:there are different ways of quick navigation between files and functions. ... You should use the menu 'Remove file from project' instead of deleting files. ... A Makefile generation tool for Code::Blocks IDE by Mirai Computing

In this assignment, you will implement an online banking system. Users can sign-up with the system, log in to the system, change their password, and delete their account. They can also update their bank account balance and transfer money to another user’s bank account.
You’ll implement functions related to File I/O and dictionaries. The first two functions require you to import files and create dictionaries. User information will be imported from the "users.txt" file and account information will be imported from the "bank.txt" file. Take a look at the content in the different files. The remaining functions require you to use or modify the two dictionaries created from the files.
Each function has been defined for you, but without the code. See the docstring in each function for instructions on what the function is supposed to do and how to write the code. It should be clear enough. In some cases, we have provided hints to help you get started.
def import_and_create_dictionary(filename):
'''
This function is used to create a bank dictionary. The given argument is the filename to load.
Every line in the file will look like
key: value
Key is a user's name and value is an amount to update the user's bank account with. The value should be a
number, however, it is possible that there is no value or that the value is an invalid number.
What you will do:
- Try to make a dictionary from the contents of the file.
- If the key doesn't exist, create a new key:value pair.
- If the key does exist, increment its value with the amount.
- You should also handle cases when the value is invalid. If so, ignore that line and don't update the dictionary.
- Finally, return the dictionary.
Note: All of the users in the bank file are in the user account file.
'''
d = {}
# your code here
return d
##########################
### TEST YOUR SOLUTION ###
##########################
bank = import_and_create_dictionary("bank.txt")
tools.assert_false(len(bank) == 0)
tools.assert_almost_equal(115.5, bank.get("Brandon"))
tools.assert_almost_equal(128.87, bank.get("James"))
tools.assert_is_none(bank.get("Joel"))
tools.assert_is_none(bank.get("Luke"))
tools.assert_almost_equal(bank.get("Sarah"), 827.43)
#user.txt
Brandon - brandon123ABC
Jack
Jack - jac123
Jack - jack123POU
Patrick - patrick5678
Brandon - brandon123ABCD
James - 100jamesABD
Sarah - sd896ssfJJH
Jennie - sadsaca
#bank.txt
Brandon: 5
Patrick: 18.9
Brandon: xyz
Jack:
Sarah: 825
Jack : 45
Brandon: 10
James: 3.25
James: 125.62
Sarah: 2.43
Brandon: 100.5

Answers

Answer:

# global variable for logged in users

loggedin = []

# create the user account list as a dictionary called "bank".

def import_and_create_dictionary(filename):

   bank = {}

   i = 1

   with open(filename, "r") as file:

       for line in file:

           (name, amt) = line.rstrip('\n').split(":")

           bank[i] = [name.strip(), amt]

           i += 1

   return bank

#create the list of user login details.

def import_and_create_accounts(filename):

   acc = []

   with open(filename, "r") as file:

       for line in file:

           (login, password) = line.rstrip('\n').split("-")

           acc.append([login.strip(), password.strip()])

   return acc

# function to login users that are yet to login.

def signin(accounts, login, password):

   flag="true"

   for lst in accounts:

       if(lst[0]==login and lst[1] == password):

           for log in loggedin:

               if(log ==login):

                    print("You are already logged in")

                    flag="false"

           break                    

       else:

           flag="false"  

   if(flag=="true"):

       loggedin.append(login) # adding user to loggedin list

       print("logged in succesfully")

       return True

   return False

# calling both the function to create bank dictionary and user_account list        

bank  = import_and_create_dictionary("bank.txt")            

print (bank)

user_account = import_and_create_accounts("user.txt")

print(user_account)

# check for users loggedin

signin(user_account,"Brandon","123abcAB")

signin(user_account,"James","100jamesABD")

signin(user_account,"Sarah","sd896ssfJJH")

Explanation:

The python program is a banking application system that creates a list of user accounts and their login details from the bank.txt and user.txt file. The program also uses the information to log in and check for users already logged into their account with the "loggedin" global variable.

In this exercise we have to use the knowledge of programming in the python language, in this way we find that the code can be written as:

The code can be seen in the attached image.

To make it even simpler to visualize the code, we can rewrite it below as:

def import_and_create_dictionary(filename):

  bank = {}

  i = 1

  with open(filename, "r") as file:

      for line in file:

          (name, amt) = line.rstrip('\n').split(":")

          bank[i] = [name.strip(), amt]

          i += 1

  return bank

#create the list of user login details.

def import_and_create_accounts(filename):

  acc = []

  with open(filename, "r") as file:

      for line in file:

          (login, password) = line.rstrip('\n').split("-")

          acc.append([login.strip(), password.strip()])

  return acc

def signin(accounts, login, password):

  flag="true"

  for lst in accounts:

      if(lst[0]==login and lst[1] == password):

          for log in loggedin:

              if(log ==login):

                   print("You are already logged in")

                   flag="false"

          break                  

      else:

          flag="false"  

  if(flag=="true"):

      loggedin.append(login) # adding user to loggedin list

      print("logged in succesfully")

      return True

  return False

bank  = import_and_create_dictionary("bank.txt")      

print (bank)

user_account = import_and_create_accounts("user.txt")

print(user_account)

signin(user_account,"Brandon","123abcAB")

signin(user_account,"James","100jamesABD")

signin(user_account,"Sarah","sd896ssfJJH")

See more about programming at brainly.com/question/11288081

Without this step of the problem solving process you might solve the wrong problem, not know where to start, or not know when you are finished.
Select one:

Define

Prepare

Try

Reflect

Answers

Prepare should be the answer

In an independent software organization, who owns the copyright of the developed software?
O A.
client
OB
software organization
C.
project manager
D.
testing team
OE.
change committee

Answers

Answer:

The correct answer is B) The software organization.

Explanation:

An independent software organization is one that specializes in writing or creating software or applications that are eventually sold to the end-users. The End-Users are usually a broad-based market. The users only purchase a right to use the software, not the right to own the software. This means that the rights and ownership of the software remain that of the independent software organization or vendor (ISV).

Examples of applications that an ISV can create include but are not limited to the following list:

Healthcare Management System; Real Estate Management System; Accounting and Finance Management System Gambling Softwares University or School Management Software etc

Examples of Accounting and Finance Management Systems are:

Quickbooks by IntuitFreshbooksSage and Xero

Cheers

Concentrate strings
Write code that concatenates the character strings in str1 and str2, separated by a space, and assigns the result to a variable named joined. Assume that both string variables have been initialized.
Two Letters in Word
Given a character string stored in a variable called word, write code that concatenates the fifth character of the word to the third character from the end of the word, and assigns that string to a variable named two_letters. Assume that word already has a value and is at least five characters long.
Set the Number of Cards if Necessary
Write code that sets the value of the variable num_cards to seven if its current value is less than seven. Otherwise, don't change the value. Assume that nuncards already has an initial value.

Answers

Answer:

In Python:

(a) Concatenate strings:

joined = str1+" "+str2

(b) Two Letters in Word :

two_letters = word[4]+word[-3]

(c) Set Numbers in Card

if num_cards < 7:

    num_cards = 7

Explanation:

The code segments were written in Python

All variables were assumed to have been initialized

Solving (a): Concatenate strings:

To do this, we make use of + operator.

So, the concatenation of str1 and str2 with space in between is

str1+" "+str2

When assigned to variable joined, it becomes

joined = str1+" "+str2

Solving (b): Two Letters in Word :

The character at the 5th position is represented with index 4 i.e. word[4]

To access a character from the end, we make use of - sign. So, the third character from the end is word[-3]

Concatenate them using + operator.

So, we have:

two_letters = word[4]+word[-3]

Solving (c): Set Numbers in Card

Here, we make use of the if condtion.

First, check if num_cards is less than 7(i.e. num_cards < 7)

If true, assign num_cards to 7

So, we have:

if num_cards < 7:

    num_cards = 7

Consider a computer system with three users: Alice, Bob, and Cyndy. Alice owns the file alicerc, and Bob and Cyndy can read it. Cyndy can read and write the file bobrc, which Bob owns, but Alice can only read it. Only Cyndy can read and write the file cyndyrc, which she owns. Assume that the owner of each of these files can execute it.

a. Create the corresponding access control matrix.
b. Cindy gives Alice permission to read cyndyrc, and Alice removes Bob's ability to rad alicerc. Show the new access control matrix.

Answers

Answer:

Following are the solution to this question:

Explanation:

For point a:

                      [tex]alicerc \ \ \ \ \ \ \ \ \ \ \ bobrc \ \ \ \ \ \ \ \ \ \ \ \ \ \ cyndyrc\\[/tex]

[tex]Alice \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\\\\ Bob \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ r \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \\\\Cyndy \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\ \ \ \ \ \ \ \ \ \ \ \ \ \ rw \ \ \ \ \ \ \ \ \ \ \ \ \ \ orwx[/tex]

For point b:

               [tex]alicerc \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ bobrc \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cyndyrc[/tex]

[tex]Alice \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \ \ \ \ \ \ \ \ \ \ \ \ \ \ r \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\\\\Bob \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ox \\\\Cyndy \ \ \ \ \ \ \ \ \ \ \ \ \ \ r \ \ \ \ \ \ \ \ \ \ \ \ \ \ rw \ \ \ \ \ \ \ \ \ \ \ \ \ \ orwx[/tex]

what is hyperlink and its used in website

Answers

Explanation:

Hyperlink is the primary method used to navigate between webpages.

Hyperlink can redirect us to another webpages, such as websites that has graphics, files, sounds on the same webpage.

SAM trainings include 4 parts, which of the following is NOT one of them?
A.practice
B.grading
C.guide
D.Observe

Answers

Answer:

doon sa pasay nag kakapi

15. Select the correct answer.
What determines the measure of height and width of an image in pixels?
A.
pixel depth
B.
pixel dimension
C.
resolution
D.
image size
E.
interpolation

Answers

Answer:

Pixel dimensions

Explanation:

measure of height and width of a image in pixels

5. You have been putting off writing a research paper, and now it's due in two days. You have gathered
a few notes, but fear you will not complete the assignment on time. You are considering purchasing
a paper from a website that produces research papers on any topic, though you are concerned the
content might not be original. Should you take a chance and purchase the research paper? Is using
the website's services even ethical?

Answers

you should use the website most of the sites that u pay for an essay on will have plagiarism checkers and the essays should be new !

Match the following

A. Birju Maharaj Brain Lara
B. Jhaveri Sister Mike Tyson
C. Hockey Major Dhyan Chand
D. Boxing Manipur
E. Cricket Uttar Pradesh​

Answers

i don’t know a and b but i hope this helps!
c.dhyan chand
d.mike tyson
e.brian lara

Consider the following method, remDups, which is intended to remove duplicate consecutive elements from nums, an ArrayList of integers. For example, if nums contains {1, 2, 2, 3, 4, 3, 5, 5, 6}, then after executing remDups(nums), nums should contain {1, 2, 3, 4, 3, 5, 6}.
public static void remDups(ArrayList nums)
{
for (int j = 0; j < nums.size() - 1; j++)
{
if (nums.get(j).equals(nums.get(j + 1)))
{
nums.remove(j);
j++;
}
}
}
The code does not always work as intended. Which of the following lists can be passed to remDups to show that the method does NOT work as intended?
A. {1, 1, 2, 3, 3, 4, 5}
B. {1, 2, 2, 3, 3, 4, 5}
C. {1, 2, 2, 3, 4, 4, 5}
D. {1, 2, 2, 3, 4, 5, 5}
E. {1, 2, 3, 3, 4, 5, 5}

Answers

Answer:

B. {1, 2, 2, 3, 3, 4, 5}

Explanation:

Given

The above code segment

Required

Determine which list does not work

The list that didn't work is [tex]B.\ \{1, 2, 2, 3, 3, 4, 5\}[/tex]

Considering options (A) to (E), we notice that only list B has consecutive duplicate numbers i.e. 2,2 and 3,3

All other list do not have consecutive duplicate numbers

Option B can be represented as:

[tex]nums[0] = 1[/tex]

[tex]nums[1] = 2[/tex]

[tex]nums[2] = 2[/tex]

[tex]nums[3] = 3[/tex]

[tex]nums[4] = 3[/tex]

[tex]nums[5] = 4[/tex]

[tex]nums[6] = 5[/tex]

if (nums.get(j).equals(nums.get(j + 1)))

The above if condition checks for duplicate numbers.

In (B), when the elements at index 1 and 2 (i.e. 2 and 2) are compared, one of the 2's is removed and the Arraylist becomes:

[tex]nums[0] = 1[/tex]

[tex]nums[1] = 2[/tex]

[tex]nums[2] = 3[/tex]

[tex]nums[3] = 3[/tex]

[tex]nums[4] = 4[/tex]

[tex]nums[5] = 5[/tex]

The next comparison is: index 3 and 4. Meaning that comparison of index 2 and 3 has been skipped.

This is so because of the way the if statement is constructed.

There are different  kinds of ArrayList of integers. The option in the lists can be passed to remDups to show that the method does not work as intended is {1, 2, 2, 3, 3, 4, 5}.

When you study the different options given, one will see that that only list B has repeated duplicate numbers such as 2,2 and 3,3. while the other options have only a duplicate numbers that are not following each other.

In Python, there are different ways to remove duplicates from list. An example using naive or novice method is;

The main list is : [1, 3, 5, 6, 3, 5, 6, 1]

The list after deleting duplicates : [1, 3, 5, 6]

Learn more about coding from

https://brainly.com/question/22654163

Electronic mail is best used to:
Question 31 options:

Send and Receive messages over a network

Send and Receive messages via the Internet

Send and Receive messages via radio waves.

A and B

Answers

Answer:

send and receive messages via the internet

Answer:

a and b

Explanation:

because iam smart

4. What are the traits of a good follower?​

Answers

Answer:

Judgment. Followers must take direction, but not blindly. Work ethic. Good followers are good workers. Competence. In order to follow, followers must be competent. Honesty. Followers have a responsibility to be honest. Courage. Discretion. Loyalty. Ego management.

Write formal descriptions of the following sets.
(a) The set containing the numbers 1, 10, and 100
(b) The set containing all integers that are greater than 10
(c) The set containing all natural numbers that are less than 10
(d) The set containing nothing at all
(e) The set containing the empty string
(f) The set containing the string abc

Answers

Answer:

{1, 10, 100}

{a : a ∈ Z and a > 10}

{a : a ∈ N and a < 10}

{ε}

{abc}

Explanation:

1.) A set containing the numbers 1, 10 and 100

2.) Z represents integers, hence numbers n the set are integers values greater Than 100

3.) N represents natural numbers, this the set contains natural numbers less Than 10

4.)∅ represents a null or empty set

5.)represents an empty string

6) contains the sting values a, b and c


When you check your hard drive to see how much space is available, you are checking your
O primary memory
O secondary storage
O tertiary storage
O primary storage

Answers

Answer:

secondary storage

At which stage should Joan discuss the look and feel of her website with her website designer?
At the
stage, Joan should discuss the look and feel of her website with her website designer.

Answers

Answer:

Development stage: It is great to talk with the website designer during the development stages to understand the goals

Answer:

At the planning stage maybe?

Explanation:

I'm not positive but in plato it discusses this in the Website Development Proccess lesson.



Select the correct answer.


Jane's team is using the V-shaped model for their project. During the high-level design phase of the project, testers perform integration testing

What is the purpose of an integration test plan in the V-model of development?


OA. checks if the team has gathered all the requirements


OB. checks how the product interacts with external systems


ОC. checks the flow of data in internal modules


OD. checks how the product works from the client side

Answers

I think is the second one or the first one

Answer:

a

Explanation:

Suppose a program contains 500 million instructions to execute on a processor running on 2.2 GHz. Half of the instructions takes 3 clock cycles to execute, where rest of the instructions take 10 clock cycle. What is the execution time of the program

Answers

Answer:

1.48 s

Explanation:

Number of instructions = 500 million = 500 * 10⁶

clock rate = 1 / 2.2 GHz = 1 / (2.2 * 10⁹ Hz) = 0.4545 * 10⁻⁹ s

We need to compute the clocks per instruction (CPI)

The CPI = summation of (value * frequency)

CPI = (50% * 3 clock cycles) + (50% * 10 clock cycles)

CPI = (0.5 * 3) + (0.5 * 10) = 1.5 + 5 = 6.5

Execution time = number of instructions * CPI * clock rate

Execution time = 500 * 10⁶ * 6.5 * 0.4545 * 10⁻⁹ =1.48 s

Other Questions
i need help like need it pls help The regular price of a scooter is $70. It is on sale for $28 off. What PERCENT do you save? (Guess and Check is a good strategy for this problem) What is 7/9 as a decimal rounded to 3 decimal places? A single card is drawn from a standard 52 card deck.Work out the probability of choosing the "4 of spades".Give your answer in its simplest form. Plz I might fail if I dont do this How is 7.544= 1.88I got 1.88 with the remainder of 2 translate: "Familia nautam cenam parare vocat, sed nauta puellam servant" Are there unnatural causes of earthquakes that can be cause by human activity? Help Please! I'll give branliest!Two airplanes leave the airport. Plane A departs at a 42 angle from the runway, and plane B departs at a 44 angle from the runway. Which plane was farther away from the airport when it was 7 miles from the ground? Round the solutions to the nearest hundredth. Plane A because it was 9.428 miles away Plane A because it was 10.46 miles away Plane B because it was 10.08 miles away Plane B because it was 9.73 miles away again helppp! asap! This soil sample is the LEAST porous? True or false can someone help to fine goths slope, y intercept and equation Choose the more poetic sentence of the pair of sentences.I have a little shadow that goes in and out with me,Where my shadow is depends on the sun. EMB agar is a medium used in the identification and isolation of pathogenic bacteria. It contains digested meat proteins as a source of organic nutrients. Two indicator dyes, eosin, and methylene blue inhibit the growth of gram-positive bacteria and distinguish between lactose fermenting and non-lactose fermenting organisms. Lactose fermenters form a metallic green or deep purple colonies, whereas the non-lactose fermenters form completely colorless colonies. EMB agar is an example of which of the following?a. a selective medium onlyb. a differential medium onlyc. a selective medium and a chemically defined mediumd. a selective medium, a differential medium, and a complex medium Nowadays, we often photograph our lives to validate their reality, allowing for digital storage of ourvisual memories. Some feel that this may impact our ability to fully experience the events of ourown lives because we are so busy taking photos of them. Explore and analyze this idea byproviding a scenario where taking photos of an event might take away from the experience as wellas a scenario where photographing the event might add to entire experience. These can be frompersonal experience or made up.) find the coordinates of the missing endpoint if m is the midpoint of ab. a(-9, -4) and m(-7, -2.5) Is (2,3) a solution of the system How do you find the mean? HELPPPPPP PLEASE !!! Which of the answers below makes the following simple sentences into one complex sentence? The picnic was ruined. the ants had destroyed it. We went home.1. we went home when the picnic was ruined because the ants had destroyed it.2. because the ants had destroyed it, the picnic was ruined and we went home.3. we went home and the ants destroyed the picnic.4. the ants had destroyed the picnic and we went home.