Suppose num1 and num2 are int variables and symbol is a char variable. Consider the following input 47 18 * 28 $ Given this statement cin >> num1 >> symbol >> num2%3; What are the values of num1 47 num2 8 symbol 1 Starting over with the same input above evaluate these statements cin >> num 13; cin.get(symbol); cin >> num2; What are the values of num1 47 num2 18 symbol Use two single quotes separated by a space to represent a space in the answers
Q: Suppose that the input is 0 0 8 12 50 7 13 –1. What is the output of the following code? (2, 3)…
A: Given program: #include <iostream> using namespace std; int main() { int num, sum, count;…
Q: C Languagge: 1. What will be printed from the following program segments? (5 points each) a. for…
A: THIS IS A MULTIPLE QUESTION BASED PROBLEM. ONLY FIRST QUESTION IS SOLVED. KINDLY SEND THE REMAINING…
Q: Consider the following code (and assume that it is embedded in a complete andcorrect program and…
A: The Given code is considered and it is embedded in a complete and correct program and i runned it…
Q: Write that (i) declares string str_a (of size [5] a program a (LAST_FOUR_DIGITS_OF_YOUR_STUDENT_ID %…
A: Solution: Python code: #taking input from user in str_astr_a = input()str_b= "" # filtering the…
Q: Given four values representing counts of quarters, dimes, nickels and pennies, output the total…
A: 1 dollar=4 quarters 1 dollar=10 dimes 1 dollar=20 nickels 1 dollar=100 pennies
Q: Consider the following code (and assume that it is embedded in a complete and correct program and…
A: Given: Consider the following code (and assume that it is embedded in a complete and correct program…
Q: I need help passing the unit test. My code(python): n = int(input()) user_values =[] def…
A: Corrected code for above : n = int(input()) user_values =[] def get_user_values(): for i…
Q: Please I am facing a problem executing the code The question is:. Write a Flex program to check the…
A: The edited code is given below for the above given question
Q: 14. Give an example of program that calculate the following sum: n k ΣΣ ij i=0 j=0
A: //C program #include<stdio.h> int main(){ int n,k;//store n and k printf("enter n and…
Q: Suppose that x and y are of type int, z is of type double, and ch is of type char. Consider the…
A: Given:
Q: Assume x is equal to 4, In which of the following that y is not equal to 5 after execution? اختر…
A: Program execution in CPU A sequence of instructions is stored in memory.
Q: 2) Consider the following statements: int* p; int i, k; i = 50; k = i; p = &i; %3! Following these…
A: Only option (d) will change the value of i to 20. Option (d): *p = 20 Since p is a pointer and is…
Q: Given four values representing counts of quarters, dimes, nickels and pennies, output the total…
A: 1) Below is C++ program that input quarters, dimes, nickels and pennies and output total amount of…
Q: find the output (explain how) #include int f(int &x, int c) { c = c - 1; if (c == 0) return 1; x = x…
A: Here c is passed by value and x is passed by reference, same copy of x will be in all functions, but…
Q: Consider two programs below. What output will be produced by running program 2? Assume the output of…
A: Find the required output for given code given as below :
Q: 10. I Love CCS by Jemar Jude Maranga Write a program that will take as input an integer n, and will…
A: We will use Java programming language for this question Algorithm: Ask user to input an integer…
Q: 5. Given variables int areaBound and int sum, write a snippet of code that assigns to sum the result…
A: Given:
Q: Show the output of the following two programs: (a) def main():number = 0numbers = [10]m(number,…
A: Step 1:- a)Explanation:- 1.Declare the function main() a)initilaise the number=0 b)initilaise the…
Q: QI: Answer all of the following: 1- If the following lines of code have errors, correct them;…
A: To Do: To write the answers.
Q: The output of the following code int a[]={10,20,30,40}, *p; p = a+1; ++p; printf(“%d”,*p++);…
A: Given: int a[]={10,20,30,40}, *p; p = a+1; ++p; printf(“%d”,*p++); To find: Output of given code.
Q: What is the output of the following program: #include using namespace std; void Push(int x[], int…
A: Initially, array A is having only one value {0} After executing the for loop, array A will now have…
Q: Write two statements to read in values for my_city followed by my_state. Do not provide a prompt.…
A: I have given detailed code with output below.
Q: b. // determines the power // of x such that 2* = 128 int pow = 1; int x = 0; while (pow != 128) {…
A: Here, we have given the C code which is needed to be converted into MASM assembly language. The…
Q: 16. Consider the following code: ot her = True 1 - int (input (OMumber: )) if other and x > 0: print…
A: Answer: Code: other = Truex = int(input("Number: "))#taking user input#condition checking to print…
Q: Given this function below: int tribonacci(int n) { if (n<=3) return 3; else return tribonacci (n-1)…
A: 1) The tribonacci numbers are like the Fibonacci numbers, but instead of starting with two…
Q: 1. Consider the following code segment: for (int i = 200; i > 0; i /= 3) { } if (i % 2 == 0)…
A: Answer: Option C: 200 66 22 2
Q: What are the final values of x, y, and z. int x = 2; int y = 3; %3D int z = 0; X = -X; X = x & OxF;…
A: Integer takes 4 bytes of memory int x=2 x = 00000000 00000000 00000000 00000010 int y=3 y = 00000000…
Q: 1/ A Cuii number is the one whose digit sum is 17. Find out KthCuii number. K is an integer given as…
A: As per our company guidelines we are not supposed to answer more than one question per post and…
Q: def aaa(p): return p ** 3 print("more defs". def bbb(q): return q // 16 def ccc(p, q): print(aaa(p))…
A: I have given justication of this code below in detail.
Q: QUESTION 9 Suppose sl and s2 are two strings. Which of the following statements or expressions are…
A: We consider the s1 is the one of the string and S2 is the another string Suppose s1 and s2 are two…
Q: Suppose that x and y are of type int, z is of type double, and ch is of type char. cin >>x >» y If…
A: The given small code belongs to C++. Correct answer is provided below with an explanation why it is…
Q: Using RAM model of computation, represent the following code in terms of mathematical function of…
A: The given program is - public static void main (String[] args) { int[] ar = {1, 2, 3,…
Q: Read the following program and Identify the output of the program int _tmain(int argc, _TCHAR*…
A: We need to find the correct output for the given C++ program.
Q: QUESTION 18 Int xt 200, int yt 100 Int dt, d2 mov EAX, x1: mov EBX, yt: push EBX pop ECX mov d2, ECX…
A: The register EAX,EBX,ECX are data register ,it is used to store the value . The answer is 18)100…
Q: Q1:Find the output of the following code: const int x=3; const int y=2; double a[x]…
A: #include <iostream>using namespace std; int main(){ const int x=3; const int y=2;…
Q: Write a program that will reverse the order of words on the given string below. Insert the…
A: ANSWER:-
Q: What is the output of the following segment? int y,x = 1, ww = 0,s=3; while ( ++x <= 3 ) { y = x * x…
A: ++x : pre increment ++x: post increment Pre increment operator is used to increment variable value…
Q: Considering the following declarations Q? а, b, с, d; double w, х, у ,2; int a=10 ; b=5 ; c=1 ; d=2…
A: #include <stdio.h> int main(){ int a,b,c,d; double w,x,y,z; a=10; b=5; c=1;…
Q: What is the result after execution of the following code: int i 1, x 4: while (++i <= 10) { x++:…
A: The given C++ code is executed and the result which is the correct answer is provided with…
Q: Write a program that inputs values of type char, short, int, & long the values in union variables of…
A: the code is as follows:-
Q: Suppose that the input is 0 8 12 50 7 13 -1. What is the output of the following code? int num, sum,…
A: Program code: //include the required packages #include <iostream> using namespace std;…
Q: How many times the above statement will be executed? Write down the Big-O for the above statement?…
A: As per guidelines, we are supposed to answer only one question. Kindly repost the another question…
Q: Consider the following lines of code: int a = 5; %3D double b = 10; double c = a / b; C (int)c +1;…
A: After the code have been executed,the value of c is 1.0. Therefore the correct option is None of the…
Q: Suppose we are interested in the velocity of a moving car. W. "ea Drogram that prompts the user to…
A: To do: write a program
Q: نقطة واح What is the output of the following * ?program 290 291 292 293 {int k=5,f=9; if (f using…
A: Output: k=5 Given Program #include <iostream> using namespace std; int main(){ int k=5,f=9;…
Q: 6. Consider the following code. What is the output? def f(x 50, y 50): return(x+y, x-y) 50) х, у 3…
A: The Answer is in given below steps
Q: in the space provided below: Consider the following variable declaration int m = 8, n, r = 4, p;…
A: int m=8, n, r=4, p; double q; n=r*(r/m)<m; p=r<m/2&& r/r>=m || (q=(r*=2)/m)>1;…
Q: Suppose that 1 and y are of type int, z is of type double, and ch is of type char. Consider the…
A: Coded using C++.
Q: PYTHON In the following cell, complete the code so that N is returned when the difference between…
A: def good_enough(C,r): """Return the smallest value of N that satisfies true_value -…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Assume that a box of apples cost 8 dollars and a box of grapes cost 6 dollars. Given variables numBoxApples and numBoxGrapes that are read from input, compute the total cost and assign combinedCost with the result. Ex: If the input is 7 10, then the output is: Cost: 116 include <iostream> using namespace std; int main() { int applePrice = 8; int grapePrice = 6; int numBoxApples; int numBoxGrapes; int combinedCost; cin >> numBoxApples; cin >> numBoxGrapes; /* Your code goes here */ cout << "Cost: " << combinedCost << endl; return 0; }Each function should accept two integer parameters indicating the minimum and maximum X value to be plotted. The functions should have no return values. Create class-level constants for things we might wish to change later, e.g., a char called PLOT_CHAR that holds an “x” (per samples below), another char called FILL_CHAR that holds an unobtrusive character like ASCII 183, generated with a cast, e.g., (char)183. JAVA PLEASE THOSE ARE NOT PERIODS OR DOTS. USE (System.out.print((Char)183); for (.) Please DON'T USE Loops(while);, if, Arrays, lists, or other data structures, objects, libraries, or methods. Sideways Ploty = 20sin(.5x)+20 where -11<=x<=11 ··································x ·······································x ·······································x ···································x ···························x ·················x········x·xx···x··········x····················x ·····························x ····································x…5.A)For the code segment below, what should be the values for q will result in kiwi being included in the output? switch(q) { case 1: cout << "apple"; break; case 2: cout << "orange"; break; case 3: cout << "banana"; break; case 4: cout << "pear"; case 5: cout << "grapes"; default: cout << "kiwi"; } B)Evaluate the following segment of a program. Show the procedure to reach your answer. int a = 3, b = 5, c = 2, d = 4; find: !(a / b > 0) && (22 > b % c + d) || !(a * d >= b – d / c) C) Write equivalent expressions for each of the following by using De Morgan’s Law. !(c == ‘r’ || (( y > 2) && !found ))
- CHALLENGE ACTIVITY 6.7.3: Function with loop: Shampoo. Write a function print_shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N : Lather and rinse." num_cycles times, where N is the cycle number, followed by "Done.". Sample output with input: 2 1 : Lather and rinse. 2 : Lather and rinse. Done. Hint: Define and use a loop variable. Use Python, please.Here is a function that is supposed to return True if word (any string) ends with "s" and False otherwise: def ends_with_s(word):if len(word) < 1:return False return word[-1] == "s" Here is the test function I am using to test ends_with_s: def test_ends_with_s(): assert(ends_with_s("cats")) # option 1 assert(ends_with_s("") is False) # option 2 assert(ends_with_s("apple") is False) # option 3 assert(ends_with_s("S")) # option 4 Rewrite ends_with_s so that the test passesUse C++: Develop a Tic Tac Toe game that will match a player against the computer. Do’s: Use a typical 3 x 3 board. The horizontal axis should be labeled A, B, C. The vertical axis should be labeled 1, 2, 3. For Example the picture attatched. Use User-Defined Functions. Use Branching. Use Loops. Use String functions. Randomly determine who will move first, the human or computer. Assign O to the computer and X to the Human player. Ask the user to select their move using the horizontal and vertical position. For example: A1 for the upper left square, or B2 for the center square. After each move, redraw the board with the X’s and O’s in the right positions. After each game, ask the user if they want to play again. If they do, start the game again. Bullets 8 and 10 are very important. Do not’s: Don’t use User Classes or Objects Don’t use images Program must use: functions loops branching string functions
- Use C++: Develop a Tic Tac Toe game that will match a player against the computer. Do’s: Use a typical 3 x 3 board. The horizontal axis should be labeled A, B, C. The vertical axis should be labeled 1, 2, 3. For Example the picture attatched. Use User-Defined Functions. Use Branching. Use Loops. Use String functions. Randomly determine who will move first, the human or computer. Assign O to the computer and X to the Human player. Ask the user to select their move using the horizontal and vertical position. For example: A1 for the upper left square, or B2 for the center square. After each move, redraw the board with the X’s and O’s in the right positions. display if there is a tie After each game, ask the user if they want to play again. If they do, start the game again. Bullets 8 and 10 are very important. Must use and do all of the bullets Do not’s: Don’t use User Classes or Objects Don’t use images Program must use: functions loops branching string functionsComplete the program 'Bcast-Reduce-Assignment.c' (Refer to 'Bcast-Reduce-Example.c') to make the program have the output as follows if we run the program using 2 processes. The input sequence is: 0 1 2 3 The output sequence is: 0 2 6 12 The code below must be used, please #include <stdio.h>#include <stdlib.h>#include <mpi.h> int main(void) { int my_rank, comm_sz; int i; int Count = 4; int Number[4]; int Result[4]; MPI_Init(NULL, NULL); MPI_Comm_size(MPI_COMM_WORLD, &comm_sz); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); if(my_rank == 0) { printf("The input sequence is: \n"); for (i = 0; i < Count; i++) { Number[i] = i; printf("%d ", Number[i]); } printf("\n"); } // Process 0 sends data to all of the processes MPI_Bcast(Number, Count, MPI_INT, 0, MPI_COMM_WORLD); for (i = 0; i < Count; i++)…Complete the function below that takes in three integers (a,b,c) and returns the number of integers between a and b (inclusive of the endpoints) that are divisible by c. Make sure it tests a and b for divisibility by c! In [ ]: defhow_many_divisible(a,b,c):counter=0# YOUR CODE HEREraiseNotImplementedError()returncounter In [ ]: assert how_many_divisible(10,20,5) == 3 assert how_many_divisible(30,77,7) == 7 PYTHON jYPYTER
- Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints1 ≤ T ≤ 1001 ≤ X, Y ≤ 1031 ≤ Z ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints? ≤ ? ≤ ???? ≤ ?, ? ≤ ???? ≤ ? ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…CHALLENGE ACTIVITY Use C++ 1.11.2: Outputting all combinations. Output all combinations of character variables a, b, and c, in the order shown below. If a = 'x', b = 'y', and c = 'z', then the output is:xyz xzy yxz yzx zxy zyx #include <iostream>using namespace std; int main() { char a; char b; char c; cin >> a; cin >> b; cin >> c; a = 'x'; b = 'y'; c = 'z'; cout << cout << endl; return 0;}