What is the value of i after this code executes? int i 10; while(i < 15){ i--; %3D
Q: >>> def count_iterations(val): count=0 while val > 1: = val val count = count + 1 2 %3D %3D…
A: While loop is used to execute set of statements repetitively. The condition in the while-loop header…
Q: def foo(arg): if isinstance (arg, -): 11 oops return 'yeah' else : oops yeah return 'oops' 12 print…
A: Here, Code is given.
Q: What does this code print? line = "What will have so will" L = line.split('a') %3D for i in L:…
A: A python program declares a string type variable line and initialized the string. The split() method…
Q: int i, temp[10]; for (i = 0; i< 10; i++) temp[i] = 2*i; for (į = 0; į < 10; i++) cout << temp[) << "…
A: Given code: #include <iostream>using namespace std;int main(){ int i,temp[10]; for(i =…
Q: int i = 0; i < a.ler [1] = a[(a[i] + 3)
A: Dear Student, Here array a contains 5 elements thus length of a is 5 and a.length is 5 , based on it…
Q: Assume that name has been declared suitably for storing names (like "Misha", "Emily" and "Sofia")…
A: As no programming language is mentioned it was solved using basic C++
Q: int mycount=0; int p-30; while(mycount<p) { printf("%d",p%3); P-p/2; mycount++; }
A: c- 3 is the right answer and output -0 0 1
Q: Part One: Create a method which takes two int parameters and swaps them. Print the values before and…
A: All the three methods are implemented in same program as follows
Q: * If MyNumber = 6.8, what is the value of ?Int(My Number * 4^2)
A: MATLAB doesn't have the Int() function as described in the question, instead Matlab has int8 and…
Q: Write an application that simulates coin tossing inside of C#. Let the application toss a coin each…
A: simulates coin tossing inside of C#. Let the application toss a coin each time the user chooses the…
Q: Car + MAX_Weight: double counter: int id: int weight: double - mileage: long owner : Person + Car (…
A: In this question first we will create the UML diagram. For that we have used the software STAR UML.…
Q: int z = 2.2; %3D if(x 3) z = X + y; if(z > -1){ cout <« "z is " + y; } else cout <« "z is + z;
A: int z = 2.2 would result in z = 2 as decimal would be ignored. And instead of + I am taking <<…
Q: def moo (n): if 8. return 1 else : return moo ( )+ 2 print (moo (0)) print (moo (1)) print (moo (2))…
A: Logic: Above program is recursive program. recursion done until execute a base condition. if we pass…
Q: Find the error in the following code and explain how it can be removed? #include int main(void) {…
A: Error in the code : The above code will give a "divide by zero" error because div has been assigned…
Q: { int i= 10; While (i< 50) { cout <<i; i+ = 5 ; }
A: Answer : Given program is in c++ and it start from a variable i = 10 . and it will goes till 49 less…
Q: f a memory cell of 5 has an 8 value, how is the difference between entering the 5 value to cell…
A: Given statement syas that if a memory cell of 5 has an value, how the difference between entering…
Q: int main() int i = 3, * j, k; %3D j = &i; k = i; j- 10; cout << i * *j* i+ *j*k; return 0;
A: The output of the given question has been explained and has been given in the next step.
Q: 2. int a = 0, i = N; while (i > 0) { a += i; i /= 2;
A: As per our guideline we are supposed to answer only first question, please re upload another…
Q: #include stars in the form of void main(){ int i,j; for (i=0;i0;j-{ if(j>5+i| lj<5-i) cout<<" ";…
A: For i =0 and j =10 the if condition becomes true that is 10 >5 hence the print statement will…
Q: member a warning :-you need not to solve Write code in Jupytar. code please.
A: The solution to the given problem is below.
Q: View the following code, and then answer how many times will this loop run? Enter the exact number…
A: while(ammo>4): The while loop will run while the value of the variable ammo is greater than 4…
Q: 2 ii) int a = 5; //L1 //L2 5; i <= 6; i++) for (int i { а %3D а + 3; System.out.println(a); } a = a…
A: In this question, we are given a java language code. And we have to trace it and find out the…
Q: What will be displayed on the console when j = 2 in the following code segment? You can give an…
A: Given a code snippet: cout<<"Value of j = "<<j<<endl; for(int…
Q: If you build and run the code shown below. The value of b is .. ........ #include #include int…
A: Find your answer below
Q: ubtractMe(x): k = x - (2/0) if (k <= 6): return 6
A: Lets see the solution.
Q: Write an application that determines whether a phrase entered by the user is a palindrome. A…
A: import java.util.*; class palindrome{ void palin(){System.out.print("Enter the string you want…
Q: void (double a) cout<<"" a = "; cout<<a<<endl; ... %3D
A: Given:
Q: Write an application that plays the game of Fermi. Generate three distinct random digits between 0…
A: def play(nrounds, ndice=2): player_capital = computer_capital = nrounds for i in range(nrounds):…
Q: cerat javaFX 9-Rock, Paper, Scissors Game Create a JavaFX application that lets the user play the…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: int x=22, y=17; if((x>30 || y<2)) cout<<"BAHRAIN"; else cout<<"MANAMA"; A MANAMA B BAHRAINMANAMA C.…
A: The given code is: int x=22, y=17 here x is not greater than 30 so first condition is false. y…
Q: Look at the following code. int x = 7; int *ptr = &x;What will be displayed if you send the…
A: Given: Look at the following code. int x = 7; int *ptr = &x;What will be displayed if you send…
Q: Find the errors in this code: double gpa[] = {2.2, 3.8, 4.0, 3.6, 1.7, 2.8}; int countSuper = 0;…
A: Find the errors in this code: double gpa[] = {2.2, 3.8, 4.0, 3.6, 1.7, 2.8}; int countSuper = 0; //…
Q: 5-3) (Find the highest score) Write a program that prompts the user to enter the number of students…
A:
Q: int age = getAge(); /*get age as input from the user*/ void display (int age); /*prints the…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: Find the error(s) in the following code snippet and explain how to correct it (them): 1 class…
A: The function prototype of getIncrementedData is : int getIncrementedData() const {} which makes is…
Q: 2 iii) int a = 5; //L1 //L2 for(int i = 5; i <= 6; i++) { а %3D а + 3; System.out.println(a); //L3…
A: Given: \
Q: What is wrong in the following code?
A: In the given image (a): The Class circle has an object c1 but when declaring the object “( )” has…
Q: Write an application that simulates coin tossing inside of C# (reject if you can't). Let the…
A: internal class Program{private static void Main(string[] args){var heads = 0;var tails = 0;var…
Q: The special case return value that will terminate the following code i
A: The special case return value that will terminate the following code is ____________________. int…
Q: Tpuə >> I >» ano 10 == 7% ++T) JT to while (i < 7) int i = 1;
A: (a)int i = 1;while (i < 5) if (i % 2 == 0) cout<<i<<endl; The while loop will…
Q: Find the value of A, B #include void main ( ) { int A,B=5; A=B++; cout<<A<<"\n"<<B<<"\n"; }
A: The given program is C++. Asked to find the output of the program. I had run this program on online…
Q: What will be displayed when the following code is executed? const int x = 7; int y = 10; y *= 5; y…
A: since you have asked multiple question ,we will solve the first question for you. If you want any…
Q: int this as soon as Code design.
A: I have written HTML Code below:
Q: What does the following code display? int [] arr2 = {1, 2, 3}; for (int i = 0; i < arr2.length;…
A: Answer
Q: What will the following code display?try:x = float('abc123')print(x)except IOError:print('This code…
A: Exceptions An exception occurs when some wrong input is being entered by the end-user or read from…
Q: Program4 - (from ch7) - Computer-Assisted Instruction (Project Name: AITeacher) - The use of…
A: Actually, given information: The use of computers in education is referred to as computer-assisted…
Q: You want to execute a block of code only if age equals 65
A: Please find the answer below :
Q: 1 int computeArithmeticProgression(int num) 0; 2 int sum = 3 for (int i = 1; i <= num; i++) {
A: Given:
Q: int a=9, b=10; cout<<(a++) +(b--); getch(); return 0;
A: NOTE: There were some issues in your code which have been removed to get the answer. Getch() is used…
C++ is a very famous programming language these days, It is an Object oriented programming, which is interactive and interpreted. It supports many programming patterns like that of procedural and functional programming. It is a very dynamic language, which helps in building websites and software's. It also helps in conducting data analysis and automating the tasks.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Java question Write a program that plays the Rock-Paper-Scissors game againstthe computer. When played between two people, each personpicks one of three options (usually shown by a hand gesture) atthe same time, and a winner is determined. In the game, Rockbeats Scissors, Scissors beats Paper, and Paper beats Rock. The program should randomly choose one of the three options (with-out revealing it), then prompt for the user's selection. At that point, the program reveals both choices and prints a statementindicating if the user won, the computer won, or if it was a tie.Continue playing until the user chooses to stop, then print thenumber of user wins, losses, and ties.What is the sentinel value in the following code snippet?int main(){int score = 0;int sum_of_scores = 0;int end = 1;cout << "Enter an score (-1 to end): ";cin >> score;while (score != -1){sum_of_scores = sum_of_scores + score;cout << "Enter an score (-1 to end): ";cin >> score;}cout << "Sum of scores " << sum_of_scores;return 0;}What will the following code display?try:x = float('abc123')print(x)except IOError:print('This code caused an IOError.')except ZeroDivisionError:print('This code caused a ZeroDivisionError.')except:print('An error happened.')print('The end.')
- ***Java Question*** Write an application that prompts the user for a password that contains at least two uppercase letters, at least three lowercase letters, and at least one digit. Continuously reprompt the user until a valid password is entered. Display Valid password if the password is valid; if not, display the appropriate reason(s) the password is not valid as follows: ----------------------------------------------------------------------------- The password did not have enough of the following: uppercase letters lowercase letters digitsWhat will be the value of ans after the following code has been executed? int x = 90, y = 55, ans = 10; if ( x == y); ans *= 2; 1. 10 2. 145 3. 20 4. None of theseJava Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. Given the following code, the output is the date and time of __.Calendar cal = Calendar.getInstance(); TimeZone tz = TimeZone.getTimeZone("Europe/Rome");TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome" time zone.B. the time zone is computer is currently set to use.C. the "America/Los_Angeles" time zone.D. the "Asia/Istanbul" time zone.E. All of the three listed time zones. Part 2 - 10. Given the following code, the output is the date and time of __. Calendar cal = Calendar.getInstance();TimeZone tz = TimeZone.getTimeZone("Europe/Rome");cal.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome"…
- // P41.cpp - A simple elevator for 4 floors and a basement with a // close door button and 5 keys for floors #include<iostream> #include<cmath> using namespace std; void close_door(); int change_floor(int choice, int floor); int main( ) { int key; int floor = 0; cout << "Press a Key \n"; cin >> key; if(key == 0) { close_door(); if( floor != 0){ // otherwise nothing happens cout << "I am moving to the Basement \n"; floor = change_floor(0, floor); } } else if(key == 1) { close_door(); if( floor != 1){ // otherwise nothing happens cout << "I am moving to the the First Floor \n"; floor = change_floor(1, floor); } } else if(key == 2) { close_door(); if( floor != 2){ // otherwise nothing happens cout << "I am moving to the the Second Floor \n"; floor = change_floor(2, floor); } } else if(key == 3) { close_door(); if( floor != 3){ // otherwise nothing happens cout << "I am moving to the the Third Floor \n"; floor = change_floor(3, floor); } }…Problem Description: The international standard letter/number mapping found on the telephone keypad is shown below: Write a pseudocode and program that reads a letter and displays its corresponding digit. 2 3 1 ABC DEF 4 5 6 GHI JKL MNO 7 8 9 PQRS TUV WXYZ 0 Write a pseudocode on how you would solve the problem in your own word. Write a java program called Phone considering the following directions. Practice here first then write answer on the answer sheet. Also, make sure distinguish high and low caps as Java is case – sensitive. Import and declare a Scanner class Ask user for an Upper – case letter Use the switch statement along with case and break Use the System.exit(1) in the default to terminate the program Print the corresponding digitVoid Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() { Int x = 10; Do1 (x,x); Cout << x << endl; } The output of this program is
- Using C# in Microsoft Visual Studio create an application that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows:1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Do not display the computer’s choice yet.)2. The user selects his or her choice of rock, paper, or scissors. To get this input you can use Button controls, or clickable PictureBox controls displaying some of the artwork that you will find in the student sample files.3. The computer’s choice is displayed.4. A winner is selected according to the following rules:• If one player chooses rock and the other player chooses scissors, then rock wins. (Rock smashes scissors.)• If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors…whenever you enter the date of birth as gibberish it still takes it, I want it to be a conditional statement where it forces the user to input the date of birth in the format of mm/dd/yyyy and it has to be an 18 years of age for the year if younger than that it will give an input validation message saying you have to be 18 to create an account, import tkinter as tk class ATM: def __init__(self): self.accounts = {} def create_account(self): first_name = first_name_entry.get() last_name = last_name_entry.get() dob = dob_entry.get() address = address_entry.get() debit_card = debit_card_entry.get() while len(debit_card) != 16 or not debit_card.isdigit(): debit_card = input("Invalid debit card number. Enter debit card number (16 digits): ") pin = pin_entry.get() while len(pin) != 4 or not pin.isdigit(): pin = input("Invalid pin. Enter 4-digit pin: ") self.accounts[debit_card]…PYTHON ONLYPlease create a code that checks if 'user' favourite game is in the top 3 games. if the game is in the top 3 then it should say: "common favourite game" if else then "uncommon favourite game"code: TOP_3_GAMES = {'', 'CALL OF DUTY', 'LEAGUE OF LEGENDS', 'VALORANT'}