Analyze the code below: dogs = ["KK", "Cyber", "Blake", “Pinky", "Taki", "Chubby"] a = len (dogs) b = dogs.index("Pinky") c = dogs.index("Blake") What will be the value of c? a. 2 b. 3 C. 6 d. 5
Q: #BABY DAYCARE PROGRAM def getTallest (name, height): n = len (name) large = height[0] for i in range…
A: According to the given instruction I have create a list age[] to store the age of the babies. And…
Q: 6- How to make a C++ function work with multiple data types? C++ 7- Every class has a default copy…
A: Make use of multiple data type in C++ functions As per our policies we will answer only 1st…
Q: static double some_calc(int arr[], int len) { int index = 0; double foo_1 = 1, foo_2 = 1; while…
A: The function name is some_calc which is taking two parameters. One parameter is integer array and…
Q: Hi, I am implementing a matrox with several functions. I have pasted the error, the assignment and…
A: class Matrix: def __init__(self, rows): self.list1 = rows def __str__(self):…
Q: Please Explain this code Step by Step (How Code Works). #include #include #include char…
A: Program is given and need to explain how it is work.
Q: Given a dictionary: capitals= {'CHINA': 'BEIJING','CUBA': 'HAVANA', 'USA': 'WASHINGTON, D.C.'} Write…
A: Program #declaring dictionary capitals = {"CHINA" : "BEIJING", "CUBA" : "HAVANA", "USA" :…
Q: Write a program that takes 3 integers as an input from the user and display them in ascending order…
A: // here is my c++ code #include <iostream>// header file using namespace std;void…
Q: c++ How do you declare a pointer that will hold an integer type?. Multiple choice. int *p; int…
A: To declare a pointer that will hold an integer type: To store the memory address of another…
Q: def finalscore (assignment): gradesum-0 finalgrade=0 for index in range (assignment) : grade=int…
A: I have simplified your code a bit and have omitted out few unnecessary lines/variables.. Check the…
Q: Modify the code fragment below from topic#16's activity so that it will introduce a pointer to…
A: Here, one C++ Program given with structure concept implemented in it. We have to modify the concept…
Q: What will the following code display?
A: Given data:- What will the following code display?
Q: Indicate where the different constructors, assignment operator- and desctructor will run with a…
A: In the given code you have created two instances and then copied one to another
Q: def get_volume (width, height, length=2): volume = width * height * length return volume def main…
A: def get_volume (width , height , length=2): volume = width * height *length return…
Q: What happens if you add 4 to ptr, assuming it is a reference to an int?
A: Given: The Addition of an Integer to the Solution Pointers make it possible for two arithmetic…
Q: What is wrong in the following code: double* p1 = new double;double* p2 = p1; *p2 = 5.4; delete…
A: The is nothing wrong in your code but only i see the the error that is you have put the end1 instead…
Q: Question 11/20 What is the output of the following code segment? int temp(char list[]) {…
A: Coded using C++.
Q: Write a program that takes 3 integers as an input from the user and display them in ascending order…
A: Required: Program to take user input for three numbers, sort them and print using functions.…
Q: Complete the below function in Java String deleteAtlndex(String abc, int a ){ //Delete a specific…
A: Required:- Complete the below function in Java String deleteAtlndex(String abc, int a ) {…
Q: Below is the code to convert an infix expression to postfix and then evaluate that expression, it…
A: C++ is an object-oriented programming language, it will be used to build web browser applications…
Q: Assume pointer P points to object of class1 and pointer Q points to object of class2, one of the…
A: Assume pointer P points to object of class1 and pointer Q points to object of class2 one of the…
Q: n C++, using STL algorithms, containers, or iterators, use the text file shoes.txt, where you want…
A: code #include<bits/stdc++.h> using namespace std; int main(){ string shoes; char…
Q: 9. Write a function to deal a hand of five cards from the deck. The function should accept a…
A: Code in Step 2:
Q: Write A Program In C The Example : #include #include #define MONTHS_SIZE 12 #define DAYS_SIZE…
A: Program: #include<stdio.h> #include<ctype.h> #define MONTHS_SIZE 12 #define DAYS_SIZE 7…
Q: this is my code and the question need to be continued. #include using namespace std; class…
A: As per the given requirement Implemented the addMember, removeMember and display member functions…
Q: ow to write C++ program that reads a list of nine digit number from the keyboard. It stores the…
A: According to the question we have to write a C++ program that reads a list of nine-digit numbers…
Q: How many syntax errors in the following code? Assume all libraries are including
A: question 4 There are four syntax errors in the code. the resolved code class…
Q: In C In this problem, you will recreate one of the truly great moments in history, namely the…
A: Approach: include necessary header files declare methods called as void moveTortoise( )and void…
Q: Create an iterator that returns numbers, starting with 1, and each sequence will increase by one…
A: Solution in C++- #include <iostream>using namespace std;void interater(){ for (int i =1;…
Q: What is void pointer? Give Example code ?
A: As you have not specified in which language you want the code, therefore the example code in the…
Q: #in c++ We need to store information about each student in a class of N students. For example, name,…
A: PROGRAM EXPLANATION: The algorithm for creating the program with given description is as follows:…
Q: Create a data definition for a doubleword that stores the data in memory in big endian format, and…
A: A doubleword consists of two consecutive words that begin at any byte location, Thus, a doubleword…
Q: def thing2(lst: List[int]) -> None: """TODO: Enter your description of the runtime complexity of…
A: Time Complexity - Time complexity is used to measure computer time taken by algorithm/program, Ou…
Q: C++ Create a Blackjack (21) game. Your version of the game will imagine only a SINGLE suit of…
A: Answer :
Q: 2) #include struct uu 11 8 5 8 11 11 5 15 int x; struct uu *p; }; struct uu fun(struct uu d) d.x *=…
A: Structure: It is similar to class. It holds the variable of different data types under the same…
Q: Write a complete C# console application in which you will have to store data of Employee in 1…
A: Arrays are data structure to hold multiple values of a same dat type in a single variable in a…
Q: Suppose the owner of tuck shop gave you a file that contains the list of items, the number of items…
A: The C++ program requires an input file, that contains the data of the item names, number of items,…
Q: Write a complete C# console application in which you will have to store data of Employee in 1…
A: Program approach:- Create an employee array. Function to input employee details. Method to display…
Q: Write a complete C# console application in which you will have to store data of Employee in 1…
A: Program plan:- Create an employee array. Call functions. Function to input employee details. Method…
Q: What would be the result of following R code?
A: dim() Function in R: In the R programming language, the dim() returns the dimension of the given…
Q: 1. You only want to watch low calorie food. Write the following function: def low_cal(foods, count)…
A: Python used to answer this question
Q: My homework was to design and implement a simple social network program in Java. I should use an…
A: Answer
Q: Write a program to do the following: - 1) Create the following dictionary which represent ages of 8…
A: ALGORITHM:- 1. Create initial dictionary of the given names and age. 2. Find the person with minimum…
Q: What does the following code output? tinclude void pointerUpd (double* upt); int main() { double*…
A: The C++ code given in the problem: #include <iostream>void pointerUpd(double* upt); int…
Q: What is a correct way to subtract 5 from fred's weight using the pointer variable 'ptr'?
A: Hi. Remember you have to use arrow(->) operator for pointers and dot operator(.) for normal…
Q: Create 2 variables of type myStruct. (st1, st2) Initialize st1 with 1,2,3,4.0,'5', (a-c) Assign st2…
A: myStruct is a structure with 3 integers, one float and one char
Q: Write a console application with several functions that deal with a two-dimensional array of…
A: #include<iostream>#include<time.h>#include<stdlib.h>using namespace std; bool…
Q: I used to do programming in C++ but in my current project I am using Python3 and since we don't use…
A: Write a program in Python3 to show how to typecast an integer value to a char value.
Q: Write definition of search, isItemAtEqual, retrieve, remove, print, constructor, and destructor for…
A: search(k) : Keep probing until the slot's key doesn't become equal to k or an empty slot is…
Q: Write an application which defines String=”hello world”, convert it into character array through…
A: CODE : public class StringToCharArray{ public static void main(String args[]){ String s="hello…
Q: Analyze the following code and fill in the output. # Employee List name - ["Joe","Janice", "Ahmed",…
A: The output is : Joe worked 40 at 17.55 making 702 Janice worked 42 at 12.35 making 1683 Ahmed worked…
[tenth question]
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Create an iterator that returns numbers, starting with 1, and each sequence will increase by one (returning 1,2,3,4,5 etc.):Hi, I am implementing a matrox with several functions. I have pasted the error, the assignment and my code. Hopefully you can see what causes the error and how to fix it. Thank you so much. My transpose function gives an error: IndexError: list assignment index out of range self = <tests_matrix.TestsStudent testMethod=test_transpose> def test_transpose(self): self.assertEqual(str(self.a.transpose()), ' 1 4 7\n 2 5 8\n 3 6 9\n') self.assertEqual(str(self.b.transpose()), ' 2 8 14\n 4 10 16\n 6 12 18\n') self.assertEqual(str(self.c.transpose()), ' 1 0 0\n 0 1 0\n 0 0 1\n') self.assertEqual(str(self.a.transpose().transpose()), ' 1 2 3\n 4 5 6\n 7 8 9\n') self.assertEqual(str(self.e.transpose()), ' 0 0 0 1\n 0 0 1 0\n 0 1 0 0\n 1 0 0 0\n') > self.assertEqual(str(self.f.transpose()), ' 1 2 3 1\n 2 3 2 3\n 3 1 1 2\n') tests_matrix.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = 1 2 3 2 3 1 3 2 1 1 3 2 def transpose(self): nl…Q1 #include <stdio.h> int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key); int *joinArray(int arrA[], int arrB[]) { int j = 0; if ((arrB[0] + arrB[4]) % 5 == 0) { arrB[0] = 0; arrB[4] = 0; } for (int i = 0; i < 5; i++) { arrC[j++] = arrA[i]; if (arrB[i] == 0 || (bSearch(arrA, 0, 5, arrB[i]) != -1)) { continue; } else arrC[j++] = arrB[i]; } for (int i = 0; i < j; i++) { int temp; for (int k = i + 1; k < j; k++) { if (arrC[i] > arrC[k]) { temp = arrC[i]; arrC[i] = arrC[k]; arrC[k] = temp; } } } for (int i = 0; i < j; i++) { printf("%d ", arrC[i]); } return arrC; } int bSearch(int arr[], int l, int h, int key) { if (h >= l) { int mid = l + (h - l) / 2; if…
- Question 5 Write a program in C++ that ranks a data set of Poker hands.2 3 4 5 6 7 8 9 10 J Q K A Suit: S H D C**This program should be able to tell the difference between higher hands of flushes and rank them accordingly. Full explain this question and text typing work only thanksQuestion: Change this code in java just with changing abstraction and exception handling #include <stdio.h>#include <string.h>#include <stdlib.h> typedef struct Guests{char name[50];int status;int nights;float room_cost;float srv;float cost;} G; void options(G guest[]){int option;printf("\n\nMenu\n-----------\n");printf("1. Check in\n");printf("2. Services\n");printf("3. Invoice\n");;printf("4. Check out\n");printf("5. Exit\n");printf("\nPlease Choose a Number According to the Option: ");scanf("%d", &option);switch(option){case 1:printf("\nCheck in\n-----------\n");check_in(guest);break; case 3:printf("\nInvoice\n-----------\n");invoice(guest);break; case 2:printf("\nRequest\n-----------\n");request(guest);break; case 4:printf("\nCheck out\n-----------\n");check_out(guest);break; case 5:exit(0);break;}} void check_in(G guest[]){int i, choice, nights;printf("Rooms:\n\n");for(i=0;i<4;i++){printf("Room No.%d\n", i+1);printf("Room Cost: %.2f/night\n",…Modify songVerse to play "The Name Game" (see OxfordDictionaries.com), by replacing "(Name)" with userName but without the first letter.Ex: If userName = "Kaitlin" and songVerse = "Banana-fana fo-f(Name)!", the program prints:Banana-fana fo-faitlin! Ex: If userName = "Kaitlin" and songVerse = "Fee fi mo-m(Name)", the program prints:Fee fi mo-maitlin Note: You may assume songVerse will always contain the substring "(Name)". *Please write this code in C++*
- #include <stdio.h> int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key); int *joinArray(int arrA[], int arrB[]) { int j = 0; if ((arrB[0] + arrB[4]) % 5 == 0) { arrB[0] = 0; arrB[4] = 0; } for (int i = 0; i < 5; i++) { arrC[j++] = arrA[i]; if (arrB[i] == 0 || (bSearch(arrA, 0, 5, arrB[i]) != -1)) { continue; } else arrC[j++] = arrB[i]; } for (int i = 0; i < j; i++) { int temp; for (int k = i + 1; k < j; k++) { if (arrC[i] > arrC[k]) { temp = arrC[i]; arrC[i] = arrC[k]; arrC[k] = temp; } } } for (int i = 0; i < j; i++) { printf("%d ", arrC[i]); } return arrC; } int bSearch(int arr[], int l, int h, int key) { if (h >= l) { int mid = l + (h - l) / 2; if…write a python code named get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary. (Suppose we want to know the total number of cases reported on each date, so use x = 0.) >>> result, total_cases = get_total_cases(database, 0) >>> display_dict(result) 2021-05-19: 8 2021-05-20: 2 2021-05-21: 1 2021-05-22: 1 >>> print(total_cases)Using Dr-Racket, what is the purpose of the number function?(define (number n)(local [(define (abstract int)(* int 11))] (build-list n abstract))) A) Create a list of the first n multiples of 11 starting at 11. B) Create a list of the first n multiples of 11 starting at 0. C) Create a list of the first n multiples of 11 starting at 1. D) Create a list of the first 11 multiples of n starting at 1. E) Create a list of the first 11 multiples of n starting at 0.F) Create a list of the first 11 multiples of n starting at n.
- My homework was to design and implement a simple social network program in Java. I should use an adjacency matrix data structure in my implementation. Write a social network program in Java. The default information for this network is stored in two files: index.txt and friend.txt. The file index.txt stores the names of the people in the network – you may assume that we only store the given names and these names are unique; and friend.txt stores who knows whom. The program must read these two files. The following section describes the format of these two files. The friend.txt takes the following format. The first line is the number of pairs of friends. Each subsequent line has two integer numbers. The first two numbers are the indices of the names. The following is an example of friend.txt:50 31 30 12 41 5 The index.txt stores the names of the people in the network. The first line is the number of people in the file; for example:60 Gromit1 Gwendolyn2 Le-Spiderman3 Wallace4 Batman5…What is the difference between void and NULL pointers? Give specific instances to back up your response. Give the differences in TABULAR form.Might there be a way to directly access commonly used operators, such as the arithmetic operators or the stream operators, with enumeration types? For example, would overloading these operators be a good solution? Why or why not?