New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN: 9781305503922
Author: Patrick M. Carey
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1.1, Problem 5QC
What is incorrect about the following code? Suggest a possible revision of the code to correct the error.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
someone help me modify the code please.
Instructions:
In the code editor, you are provided with the main() function that asks the user for 10 elements that represents the options for the ring as well as a single integer value that represents the ring that she wants. Then, a call to the findRing() function is made and the array of rings and the ring she wants are passed into it.
Your task is to implement the findRing() function. This has the following details:
Return type - int
Name - findRing
Parameters
int* - for the array of rings
int - size of the array of rings
int - the ring that she wants
Return value - the index of the ring in the array of rings. It is guaranteed that there is only one such ring that matches the ring that she wants.
Input
1. Ten integer values representing the rings
2. Integer value representing the ring she wants
#include <stdio.h>int findRing(int rings[],int n,int wantedRing){int index=0; for(int i=0;i<n;i++) {…
I think you forgot to add the insertion function in the code that you provided. The books still display unsorted.
Here is a Python function.
def do_something(lst1, lst2): for element1 in lst1: for element2 in lst2: if element1 >= element2: return False return True
What is the overall purpose of this function?
a) Return True iff the length of lst2 is less than the length of lst1.b) Return True iff each element in lst1 is less than the element at the same index in lst2.c) Return True iff every element in lst1 is less than every element in lst2.d) Return True iff every element in lst1 is less than the first element in lst2.e) Return True iff every element in lst2 is less than the first element in lst1.
Chapter 1 Solutions
New Perspectives on HTML5, CSS3, and JavaScript
Ch. 1.1 - Prob. 1QCCh. 1.1 - Prob. 2QCCh. 1.1 - Prob. 3QCCh. 1.1 - Prob. 4QCCh. 1.1 - What is incorrect about the following code?...Ch. 1.1 - Prob. 6QCCh. 1.1 - Prob. 7QCCh. 1.1 - Prob. 8QCCh. 1.1 - Prob. 9QCCh. 1.2 - Prob. 1QC
Ch. 1.2 - Prob. 2QCCh. 1.2 - Prob. 3QCCh. 1.2 - Prob. 4QCCh. 1.2 - Prob. 5QCCh. 1.2 - Prob. 6QCCh. 1.2 - Prob. 7QCCh. 1.2 - Prob. 8QCCh. 1.2 - Prob. 9QCCh. 1.3 - Prob. 1QCCh. 1.3 - Prob. 2QCCh. 1.3 - Prob. 3QCCh. 1.3 - Prob. 4QCCh. 1.3 - Prob. 5QCCh. 1.3 - Prob. 6QCCh. 1.3 - Prob. 7QCCh. 1.3 - Prob. 8QCCh. 1.3 - Prob. 9QCCh. 1 - Prob. 1RACh. 1 - Prob. 2RACh. 1 - Prob. 3RACh. 1 - Prob. 4RACh. 1 - Prob. 5RACh. 1 - Prob. 6RACh. 1 - Prob. 7RACh. 1 - Prob. 8RACh. 1 - Prob. 9RACh. 1 - Prob. 10RACh. 1 - Prob. 11RACh. 1 - Prob. 12RACh. 1 - Prob. 13RACh. 1 - Prob. 14RACh. 1 - Prob. 15RACh. 1 - Prob. 16RACh. 1 - Prob. 17RACh. 1 - Prob. 18RACh. 1 - Prob. 19RACh. 1 - Prob. 20RACh. 1 - Prob. 21RACh. 1 - Prob. 22RACh. 1 - Prob. 23RACh. 1 - Prob. 1CP1Ch. 1 - Prob. 2CP1Ch. 1 - Prob. 3CP1Ch. 1 - Prob. 4CP1Ch. 1 - Prob. 5CP1Ch. 1 - Prob. 6CP1Ch. 1 - Prob. 7CP1Ch. 1 - Prob. 8CP1Ch. 1 - Prob. 9CP1Ch. 1 - Prob. 10CP1Ch. 1 - Prob. 11CP1Ch. 1 - Prob. 12CP1Ch. 1 - Prob. 13CP1Ch. 1 - Prob. 14CP1Ch. 1 - Prob. 15CP1Ch. 1 - Prob. 16CP1Ch. 1 - Prob. 1CP2Ch. 1 - Prob. 2CP2Ch. 1 - Prob. 3CP2Ch. 1 - Prob. 4CP2Ch. 1 - Prob. 5CP2Ch. 1 - Prob. 6CP2Ch. 1 - Prob. 7CP2Ch. 1 - Prob. 8CP2Ch. 1 - Prob. 9CP2Ch. 1 - Prob. 10CP2Ch. 1 - Prob. 11CP2Ch. 1 - Prob. 12CP2Ch. 1 - Prob. 1CP3Ch. 1 - Prob. 2CP3Ch. 1 - Prob. 3CP3Ch. 1 - Prob. 4CP3Ch. 1 - Prob. 5CP3Ch. 1 - Prob. 6CP3Ch. 1 - Prob. 7CP3Ch. 1 - Prob. 8CP3Ch. 1 - Prob. 9CP3Ch. 1 - Prob. 10CP3Ch. 1 - Prob. 11CP3Ch. 1 - Prob. 12CP3Ch. 1 - Prob. 13CP3Ch. 1 - Prob. 14CP3Ch. 1 - Prob. 15CP3Ch. 1 - Prob. 16CP3Ch. 1 - Prob. 17CP3Ch. 1 - Prob. 18CP3Ch. 1 - Prob. 19CP3Ch. 1 - Prob. 20CP3Ch. 1 - Prob. 21CP3Ch. 1 - Prob. 22CP3Ch. 1 - Prob. 23CP3Ch. 1 - Prob. 24CP3Ch. 1 - Prob. 25CP3Ch. 1 - Prob. 26CP3Ch. 1 - Prob. 1CP4Ch. 1 - Prob. 2CP4Ch. 1 - Prob. 3CP4Ch. 1 - Prob. 4CP4Ch. 1 - Prob. 5CP4Ch. 1 - Prob. 6CP4Ch. 1 - Prob. 7CP4
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- C++ Get a value from the user and using a loop, search for the value in the array. Report all the index locations where it is found Report if it is not found anywhere This is part 4 of an ongoing assignment RandArray which consisted of assigning 20 integers with a random value. I am not sure how to write this out so it matches the output ( in the attached pictures ). I have attached the starter code to this problem as well as my code for part 3 which was correct. Thank you ( STARTER CODE ) #include <iostream>using namespace std; #include <cstdlib> // required for rand() int main(){// Put Part3 code here //Part 4// ask cout << "Enter value to find: ";// look through the array. // If it is found:// print // Found 55 at index 12 // if it is not found after looking at all the elements, // print // 0 is not found in randArray } _______________________________________________________________________ ( PART 3 CODE ) #include <iostream> using…arrow_forwardi want copy of this codearrow_forwardPYTHON:Please help me fix my code. It was supposed to ask the user to input an inorder traversal and let them choose whether to enter postorder or preorder, then identify the order of the missing traversal, just like the image below. However, my code can only identify the POSTORDER traversal but not the PREORDER. There is something wrong with my def function on def PreOrderT(). Please help me fix it. Thank you. # Main programinorder_list = []preorder_list = []postorder_list = []n = int(input("How many nodes want to enter? ")) # Methodsdef searchR(arr, x, n): # CHANGED THE NAME OF FUNCTION AS THERE ARE TWO FUNCTION WITH SAME NAME for i in range(n): if (arr[i] == x): return i return -1 def PostOrderT(Ino, preo, n): root = searchR(Ino, preo[0], n) if (root != 0): PostOrderT(Ino, preo[1:n], root) if (root != n - 1): PostOrderT(Ino[root + 1:n], preo[root + 1:n], n - root - 1) print(preo[0], end=" ") # Make new nodeclass…arrow_forward
- please include a picture of the program and the output too and thank you!!!arrow_forwardModify the selection sort function developed in this chapter so that it accepts a second optional argument, which may be either 'up' or 'down'. If the argu-ment is 'up', sort the data in ascending order. If the argument is 'down', sort the data in descending order. If the argument is missing, the default case is to sort the data in ascending order. (Be sure to handle the case of invalid arguments, and be sure to include the proper help information in your function.) Here is the given function which need to be mofified: function out = ssort(a) nvals = length(a); iptr = ii; for jj = ii+1:nvals if a(jj) < a(iptr) iptr = jj; end end if ii ~= iptr temp = a(ii); a(ii) = a(iptr); a(iptr) = temp; end end out = a;arrow_forwardWhich of the following statements is true about accessing array elements in C++? a. Array elements can only be accessed sequentially from the first element. b. Array elements can be accessed randomly using their indices. c. Array elements are not easily accessible. d. Array elements can only be accessed using a loop. e. Array elements cannot be accessed directly.arrow_forward
- Thank you. While I review the code provided can you please also help me on the second part of the project. The project builds on the step 1 code that you provided above. Now that you have the while loop and the dictionary translations working, the next task is to create two functions, translate_to_morse() and translate_to_alpha(). Make a copy of step_1. py and save it as step_2.py, as a starting point. At the top of the program, underneath the header comments, create both functions. translate_to_morse() should have one parameter, a string which consists of a letter. Move the code used in Menu Selection 1 to translate the letter to a Morse Code into the function. Put the resulting Morse Code into the return statement. In the same fashion, create the translate_to_alpha() function and move the translation code from the while loop into the function. Note that the parameter for translate_to_alpha() is a Morse Code, not a letter. In Menu Selection 1, call the translate_to_morse()…arrow_forwardplease code in pythonDO NOT use any library The Fibonacci sequence sequence starts with 0 and 1 (positions 1 and 2). Each next element is a sum of two preceding elements. What is the difference between elements at positions 55th and 45th multiplied by the element at position 5th?arrow_forwardTask 10 Write a Python program that finds the largest value with its key from a given dictionary. [without using max() function] Note: You do not need to take the dictionaries as an input from the user but your code should work for any given dictionary. Also, you need to handle the quotation marks as a part of the output. Hint: Think of membership operators (in and not in). You can use dictionary functions to get the values. ===== Sample 1: Given: {'sci fi': 12, 'mystery': 15, 'horror: 8, 'mythology": 10, 'young_adult': 4, 'adventure':14} Output: The highest selling book genre is 'mystery' and the number of books sold are 15.arrow_forward
- python: def dna_slice(strand, first_nucleotides, last_nucleotides): """ Question 3 - Regex You are working with a long strand of DNA. Your task is to find and return the length of the first substrand that begins with the two-letter sequence specified in first_nucleotides and ends with the sequence specified in last_nucleotides. THIS MUST BE DONE IN ONE LINE. Args: strand (str) first_nucleotides (str) last_nucleotides (str) Returns: int strand_1 = 'TATGGGTCGAGCATGT' >>> dna_slice(strand_1, 'AT', 'CG') 8 >>> dna_slice(strand_1, 'GT', 'TG') 10 """ strand_1 = 'TATGGGTCGAGCATGT' pprint(dna_slice(strand_1, 'AT', 'CG')) pprint(dna_slice(strand_1, 'GT', 'TG'))arrow_forwardiii.Now you will implement your algorithm as Python code, modifying the provided Python program Word_List_Flashcards.py. Complete the new version of show_flashcard() by modifying the code so it implements the algorithm you produced in part i. Also modify the docstring for the show_flashcard() function and the docstring for the program as a whole, to take account of the changed functionality and behaviour. Important: Do not make change to any other parts of the program.arrow_forwardDo not use AI.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- New Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License