CHALLENGE 3.16.2: Alphabetic replace. ACTIVITY Replace any alphabetic character with ' in 2-character string passCode. Ex: If passCode is "9a", output is: 9 Hint: Use two if statements to check each of the two characters in the string, using isalpha(). 1 #include 2 #include 3 #include 4 using namespace std; 1 test passed 5 6 int main) { string passCode; All tests 7 passed cin passCode; 10 * Your solution goes here / 11 12 cout << passCode << endl; return 0 13 14 15 Run
Q: a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print…
A: I have provided a detailed code below.
Q: 6. What is printed by the following when executes? 1 str= "His shirt is red" 2 pos= str.find("is") 3…
A: Solution of question 6: Right answer - Option (D) 1 Explanation - Here find function of string is…
Q: Lion king from the jungles of Hakuna Matata likes random numbers. Let F4(X) be the number of digits…
A: Given Data:
Q: // What is the coutput of the following statement: int x, y, z; double w, t; x 17; y = 15; x = x +…
A: According to the Question below the Solution:
Q: 2. Given the same initial statements s1 = [2,1,4,3] s2 = ['c','a','b'] show the values of s1 and s2…
A: The problem is based on the basics of lists in python programming language.
Q: What is the output of the following C++ code? #include using namespace std; class A {…
A: In the given code class inherited the values from main class and in this declared one integer,…
Q: 9: What is printed by the following statements? alist = [4,2,8,6,5] blist = [num*2 for num in alist…
A: 9. Given python program is, alist= [4,2,8,6,5] blist= [num*2 for num in alist if num%2==1]…
Q: what sequence of numbers would be printed if the following function were executed with the value of…
A: The given code segment is: def xxx (N): print (N) if (N < 5): xxx (N + 2)…
Q: 13. What is accomplished by the following code? Give a VERY DETAILED explanation. Suggest better…
A: Given data is shown below:
Q: QUESTION 3 Let F(x.y): "x is friend with y", N(x): "x is funny", W(x): "x is 'wise", R(x): "x is…
A: The solution for the above given question is given below:
Q: Question 4 We consider the the following code: #include 2 using namespace std; 3 4 void add(int i,…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: What is the list created by the following Python statements? 1s = list(range(10, 21, 5))…
A: Please find the solution in the below step
Q: int [] X = {12,15,12}; int [] Y = {1,2,3}; int i=0; for(int a:X) { if(a%2==1) { Y[i]=a; i++; } %3D
A: In the above question, we have to print the output of the given program. In this there are two…
Q: 23. Write a JavaScript function to print the correct answer on the screen. Is today Tuesday? YES…
A: According to the Question below the solution: Output:
Q: ar wordA[20] = "SPRING HAS"; ar wordB [20] = "SPRUNG"; ar wordC[20]; t n1, n2; a. What is the value…
A: A) in the characters array index starts from 0 so the value of wordA[4] gives the value in the 5 th…
Q: Q3 Let U = {5, 6 }, write an equivalent to the following assertions: 3x P ( x ) v - Vx Q ( x )
A: The answer is below:
Q: 6. What is printed by the following when executes? 1 str "His shirt is red" 2 pos 3 print (pos)…
A: Code: str = "His shirt is red"pos = str.find("is")print(pos) Result: Answer : D
Q: 21 What is the output of the following code? blic class Test { ublic static void main(String[] args)…
A: Algorithm: for (initialExpression; testExpression; updateExpression){ // body of the…
Q: 55. What will be the output of the following C++ code? 1. #include 2. using namespace std; 3. int…
A: Given, C++ code: #include <iostream> using namespace std; int main() { int a = 10, b =…
Q: If you are not able to specify the output of the above program exactly, explain why.
A: The sample output of the given program is:
Q: 01:14 Question 4/5 1 point What does the following code fragment print? int[] a = new int[10]; for…
A: program code: import java.util.*; public class Main{ public static void main(String [] args){…
Q: What gets printed by executing the following code? def teststrings(): str1 = 'X University' str2 =…
A: If running same code it giving the error due to some mistake using " ' in same statement opening…
Q: Assume int[][] x = {{1, 2}, {3, 4}, {5, 6}}, what are x.length are x[0].length? 5 3 and 2 4 2…
A: EXPLANATION: In the above statement, the x is the multi-dimensional array. In the multi-dimensional…
Q: 12,13,14, 15 public static void m { int c = 12; while( { System.out.
A: Below the output of the following program
Q: CAN YOU CONVERT FROM C TO C++? #include #include #include int r_pc[3] = {0, 0, 0}; int…
A: code is given below;
Q: 2. Replace (????) with relevant code for the program to function. Details about the programs are…
A: package finalexamtakehome2; import java.util.*; // for Arrays class /** * * @author sweetkim */…
Q: 1. Examine the following code: After this code executes, what is the value of x? y? 2. Examine the…
A: 1) When the value of x = 9 and y = ++x Code ( in java ) - public class Main{ public static void…
Q: 34- The output of the following script is 27. * void smal(int x);int main() { int x = 13; smal (x);…
A: The above question is answered below
Q: 1. Replace the (????) with relevant code to make th eprogram function. Details about the code are…
A: hasNextLine() is used to check whether there is next line or not whereas hasNext() is used to check…
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: What is the content of the list Is2 when the following Python statements are executed? 1s1 =…
A:
Q: 1. What is printed by the following code fragment? int x = 0; do { cout 0; i--) cout <<i<< '\n';…
A: Output will be 0123456789
Q: Assuming the following declarations, write C++ expressions to set all integer values of b’s members…
A: Given: //structure A struct A { //structure data m1 int m1[2]; } //structure B struct B { //…
Q: can you check which part my code wrong? #include using namespace std; int main() { int board…
A: In the given c++ program, the 11th line contains a for loop and 15th line also contains a for loop.…
Q: 1- Write a java Program to read a numberfrom userand print full pyramid using numbers which will…
A: A program using JOptionPane class to read the number and print the pyramid. Code for Java program…
Q: 17 class A ( int i 3; public A(int i) ( What is the the output of the following code: D…
A: Given program: class A{ int i =3; public A(int i){ System.out.println(myMethod(i));…
Q: 13. What is the value of x after the following statement executes? x - 1 + 2 3 -B/4 a. 4 b. 5 с. 3…
A: answer is
Q: 1. Design a class, CipherDriver, that uses a repeating key to encode and decode a message read from…
A: import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.ArrayDeque;import…
Q: int a[10]={23, 45, 10, 0, 98, 36, 2, 56, 34, 12}; for (int i=0; i alj+1]) swap(&a[j], &a[j+1]);…
A: Here this section contains two programs, we will try to write the description code and verify using…
Q: 25. What will the following code print out def addtwo(a, b): added - a +b return a x- addtwo (2, 7)…
A: Answer in step 2
Q: 6. (18) Write a Java program (18 = 3(a) + 2(b) + 3(c) + 3(d) + 3(e) + 4(f) a. Define 2 String…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: 8.17 A pedometer treats walking 1 step as walking 2.5 feet. Define a method named feetToSteps that…
A: Given:- A pedometer treats walking 1 step as walking 2.5 feet. Define a method named feetToSteps…
Q: Consider the following single-quoted string literal: 'baby robot' What is the character at index 1?
A: here in this question we have given a string s='baby robot' and we have to find out what would the…
Q: Find out (add code to print out) the address of the variable x in foo1, and the variable y in foo2.…
A: #include <stdio.h>void foo1(int xval){int x;x = xval;/* print the address and value of x here…
Q: 6. What is printed by the following when executes? 1 str "His shirt is red" 2 pos= str.find("is") 3…
A: Answer the above question are as follows
Q: 5. Implement fl(x2, x₁) = Σ 0,3, and £2(x2, x₁) = 0,1,2, using a 4×2ROM? ✓ CI Familia v
A: It is defined as Read Only Memory, is a memory device or storage medium that stores information…
Q: What gets printed by executing the following code? def sets() : - {'a','b','c','d'}…
A: Question:-
Q: What is the output of the following C++ code? #include using namespace std; class A { public:…
A: Code: #include <iostream> using namespace std; class A { public: A(int n ) {…
Q: [CLO-5] What is the value of the variable ss after the following code is executed? int x[ 7 ] =…
A: What is value of variables ss after the following code is executed???
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- 12. What is the output of the following program? (2, 3, 6, 8) #include #include #include #include using namespace std; int main() { double x, y; string str; x = 9.0; y = 3.2; cout (sqrt(pow (y, 4))) = " (sqrt(pow (y, 4))) << endl; str = "Predefined functions simplify programming code!"; cout << "Length of str = " << str.length() << endl; return 0; }(7) Implement the ShortenSpace() function. ShortenSpace() has a string parameter and updates the string by replacing all sequences of 2 or more spaces with a single space. ShortenSpace() DOES NOT output the string. Call ShortenSpace() in the PrintMenu() function, and then output the edited string. Ex: Edited text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue!5.18 C++ Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a comma, including the last one. Ex: If the input is: 5 2 4 6 8 10 the output is: 10,8,6,4,2,
- Python 3.7.4 Write a statement that associates d with a one-entry dictionary that maps the str 'answer' to the int value 42.13.16.1: Overload salutation printing. Complete the second PrintSalutation function to print the following given personName "Holly" and customSalutation "Welcome":Welcome, Holly End with a newline. #include <iostream>#include <string>using namespace std; void PrintSalutation(string personName) { cout << "Hello, " << personName << endl;} // Define void PrintSalutation(string personName, string customSalutation)... /* Your solution goes here */ int main() { PrintSalutation("Holly", "Welcome"); PrintSalutation("Sanjiv"); return 0;}6.28 In Python, Write a program that replaces words in a sentence. The input begins with word replacement pairs (original and replacement). The next line of input is the sentence where any word on the original list is replaced. Ex: If the input is: automobile car manufacturer maker children kids The automobile manufacturer recommends car seats for children if the automobile doesn't already have one. the output is: The car maker recommends car seats for kids if the car doesn't already have one. You can assume the original words are unique.
- 6.28 In Python, Write a program that replaces words in a sentence. The input begins with word replacement pairs (original and replacement). The next line of input is the sentence where any word on the original list is replaced. Ex: If the input is: automobile car manufacturer maker children kids The automobile manufacturer recommends car seats for children if the automobile doesn't already have one. the output is: The car maker recommends car seats for kids if the car doesn't already have one. You can assume the original words are unique. END WITH A NEW LINEWhat will be the two lines displayed after executing the following code? def pair(e,f): ka=e-f api() return ka def api(): ka=4 print(ka) print(pair(934,91)) Separate your answers by a decimal point, eg, if the two lines are 17 and 15, then write 17.15Python 3.7.4 Write a statement that associates d with an empty dictionary.
- 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.4.10.1: LAB: Exception handling to detect input string vs. integer The given program reads a list of single-word first names and ages (ending with -1), and outputs that list with the age incremented. The program fails and throws an exception if the second input on a line is a string rather than an integer. At FIXME in the code, add try and except blocks to catch the ValueError exception and output 0 for the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 then the output is: Lee 19 Lua 22 Mary 0 Stu 34 # Split input into 2 parts: name and ageparts = input().split()name = parts[0]while name != '-1': # FIXME: The following line will throw ValueError exception. # Insert try/except blocks to catch the exception. age = int(parts[1]) + 1 print('{} {}'.format(name, age)) # Get next line parts = input().split() name = parts[0]Complete and modify the code. 1 def to_share(total_candies, n_friends=4): 2 """Return the number of leftover candies that must be 3 smashed after distributing 4 the given number of candies evenly between 3 friends. 5 6 >>> to_share(91) 7 1 8 """ 9 return total_candies 10 11 to_share(10, 4) 12 to_share(5) 13 to_share(1, 5)