The expression: !( a > b || b <= c) is equivalent to which of the following?
Q: What is the terminating condition in the following code? int factorial(int n) { if(n <= 1)…
A: Refer to step 2 for the answer.
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: 1. Create a method with 2 string argument 2. Iterate on str1.argument 3. checking the if a…
Q: For the expression, c = (a!=b)?d:e; e will be assigned to c if: O a is greater than b O a is less…
A: Solution The given scenario has a ternary operator. The ternary operator checks a test condition and…
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: In this problem, we need to design a code in javascript Input - Two string arguemnt Output - array…
Q: Make the IF function to recognize a date in your logical test as a date, you have to wrap it in the…
A: Answer in step2
Q: Given the following statement: int v = rand() % 26 + 25; What is the range of v? O a. [0, 26] O b.…
A: The function rand() generates the random number. Here we have divided the random number by 26 and…
Q: What does the following function do? int fun(int x, int y) if (y == 0) return 0; return (x + fun(x,…
A: Lets dry run for x=2 and y=4 1.fun(2,4) y==4 So 2+fun(2,3)---------------------->2+6(returned by…
Q: long mult2(long, long); void multstore(long x, long y, long *dest) long t = mult2(x, y); *dest = t;…
A: To do: Convert the given code
Q: Create a function that validates whether a number n is within the bounds of lower and upper. Return…
A: NOTE: Programming language is not mentioned so I am doing in C++ Introduction: In this question, we…
Q: What will be the value stored in the variable "s" after executing the following code segment? double…
A: Programming Approach: Defining the necessary header files. Defining the main function. Defining 2-D…
Q: 4. The following expression: static_cast(static_cast(7.0/2.0) -2) is evaluated to. . a) 1.0 b) 1.5…
A: According to the information given:- We have to choose the correct option to satisfy the mentioned…
Q: Q: what is the left side of the following expression: x@y1?
A: XOR ⊕ returns 0 for the same input and 1 for different inputs. Given, x ⊕ y ⊕ 1
Q: Program which accepts the user's first and last name and print them in reverse order with a space…
A: The Answer is
Q: What will be the result after executing this statement: SELECT UPPER('Bakhit Said Ahmed') FROM dual?…
A: UPPER(): The UPPER() function in SQL converts a string to upper-case.
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: Coded using JavaScript.
Q: Q: what is the left side of the following expression: XOYO1?
A: x ⊕ y x ⊕ y ⊕ 1
Q: Read the following program and Identify the assignment operator used in the program int _tmain(int…
A: Option (a)is the correct option
Q: What will be the value stored in the variable "s" after executing the following code segment?double…
A: The complete code segment according to c language is given by: #include<stdio.h>int…
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A:
Q: For the expression, c = (a!=b)?d:e; e will be assigned to c if: a is greater than b O a is less than…
A: Given statement is ternary expression c=(a!=b)?d:e; If a!=b is true then it gives d I.e, a and b…
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: The question has been answered in step2
Q: What is the result of the following expression: 3 * 5 \ 2 + 30 / 5? a. 7.5 b. 13 c. 13.5 d. None of…
A: Expression: An expression is a statement, which will hold multiple operators and grouping symbols;…
Q: Consider the following code. How many times is the function rec_func_2() called in total? options: 0…
A: #lets trace the given code to find out how many times rec_fun2() called in total: def rec_func_2(n):…
Q: (i) val --h % k++ * 2;
A: value of h=2 k =4 public class Main{ public static void main(String[] args) { int h =2; int…
Q: Consider the following function func for answering question: int func( int "y) { *y += 4; return…
A: x=8 total=0 total=(8/2)+func(&x) if func(&x) calls it returns 36 because we giving x…
Q: Read the following program. int_tmain(int argc, _TCHAR* argv[]) { int a=6,b=3; cout<<--a; cout<<++b;…
A: Decrement operator is the "--" operator.
Q: What is the value of var after running the following piece of C code? int var-10; if (var10) var -…
A: Given code: int var =10; if(var<20) { var = var +5; if (var >10) { var = var +10; } else{…
Q: * What will be the contents of the variable x after the following statement is executed? x =…
A: Answer in step 2
Q: b- Write a program that allows the user to enter coordinates of circle center and radius then asks…
A: Given: Write a program that allows the user to enter coordinates of circle center and radius then…
Q: What is wrong in the following code: double d = 5.4;double* p1 = d;
A: Given Code:- double d = 5.4;double* p1 = d;
Q: What does the following code print out? $cash on hand = 31; $meal = 25; $tax 10; $tip 10; while (…
A: 1) Code in question does below activity It defines below variables and assign them values…
Q: Question 4 Rewrite the following statement without using variables. Then, give an exam- ple that…
A: Solution - For the above question 4 and 5 we have to rewrite their statements without using…
Q: Write a program that asks a user for an integer. Declare a variable num3. Let num3 --x; Display the…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: Q2/ (a) Write a program in C Language that asks a user to enter a value for x and displays the value…
A: Algorithm: 1. Read x value first 2. Using pow function calculate the value of the polynomial
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: The question has been answered in step2
Q: int x = 5, y = 2, z = 3; if ( x z) cout 2 ) { cout << z <<" "<< y-x << endl; cout << z * (x + y)<<…
A: The program is written in C++ Language. Please find the source code and output in the below steps
Q: Question 9 Electrical resistors are said to be connected "in series" if the same current passes…
A: Note :- You have not mention the language of program, so i'm answering your question in C++. Your…
Q: With multine text, you can do all of the following, except
A: We cannot insert an image.
Q: What are the final values of x, y, and z. int x = 2; int y = 3; %3D int z = 0; %3D X = -X; X = x &…
A: Explanation: - Initially the value of x, y and z are: 2, 3 and 0 respectively. The binary…
Q: public String toString () Gets a string in the following format: RestaurantBill…
A: Algorithm: Start Create a class called RestaurantBill with cost and service as its attributes…
Q: : Find the results if code below is ;int a = 3 %3! ;int b = 8 ;int x1,x2 ; x1= ((a ; x2= ((a 0) &&…
A:
Q: Complete the below function which takes two circles as tuples, and returns True if the circles…
A: Formula to check if two circles intersect using the below formula: If (x1,y1) and (x2,y2) are…
Q: Q: what is the left side of the following expression: XOY01?
A: X xor Y xor 1
Q: Write the following function that draws a line from point (x1, y1) to (x2, y2) with color (default…
A: Given: Write the following function that draws a line from point (x1, y1) to (x2, y2) with color…
Q: What does the following code segment output? int x= 5; for ( ; ; x++) { if (x < 6) cout<< x << " ";…
A: B. 5
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: What is the output of the following C++ code?double salary[5] = {35700, 96800, 55000, 72500,…
A: Output of above code. If you are using the setprecision then you will need to include the required…
Q: tes thild attends The Days Per Week 1 2 3 Age in Years 30.00 60.00 88.00 5 26.00 52.00 115.00 70.00…
A: Programming instructions: Include necessary header files. Declare functions. In the main, Declare…
Q: suppose u,v and w are int variables and u =1 ,v=2, w=3, what is the value of each variable after the…
A:
Q: Daniel Brown\rBrown Daniel\n"
A: \r meaning is carriage return. Whenever this \r is there in output statement it will go to starting…
Logical Not(!) operation alters the input from True to False and false to True
Logical OR(||) operation gives True if any of the two conditions in True
Logical AND(&&) operation gives true if both of conditions is True
Step by step
Solved in 2 steps
- Define an enumeration type triangleType that has the values scalene, isosceles, equilateral, and noTriangle.b. Write a function triangleShape that takes as parameters three numbers, each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note: In a triangle, the sum of the lengths of any two sides is greater than the length of the third side.)c. Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangle.1 - Nuclear Power Plant (python) The nuclear powerplant at Threeyedfish will automatically run a program to print a warning message when the reactor core becomes unstable. The warning message reads: NUCLEAR CORE UNSTABLE!!! Quarantine is in effect. Surrounding hamlets will be evacuated. Anti-radiationsuits and iodine pills are mandatory. Since the message contains crucial information, it should be printed three times. To do this, write a function that prints this message. This function has to be used three times.Question 1 is already done need help with the others though This is the C code I have so far #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; struct employees **emps = new employees()[10]; //Added new statement ---- bartleby // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for(int i =0; i <9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to…
- Assume that a, b, c are numbers.Return 'increasing' if they are in increasing order, 'decreasing' if they are in decreasing order, 'both' if they are both increasing and decreasing, and 'neither' otherwise.Here, 'increasing' means that each value is at least as largeas its predecessor. Similarly for decreasing.The sequence 3, 4, 4 is increasing. whereasthe sequence 4, 4, 4 is both increasing and decreasing.For example,lenient(3, 4, 5) returns 'increasing'lenient(3, 4, 4) returns 'increasing'lenient(4, 4, 4) returns 'both'lenient(4, 3, 2) returns 'decreasing'lenient(4, 3, 3) returns 'decreasing'lenient(4, 2, 3) returns 'neither'1. Assume x is an int which has been declared and assigned a valid value. x guaranteed to change after this code snippet. if (x<5) x--; if (x>=5) cout << x + 1; a) True b) False 2. Assume x is an int which has been declared and assigned a valid value. x guaranteed to change after this code snippet. if (x<5) x--; if (x>=5) x++; a) True b) Falseint p =5 , q =6; void foo ( int b , int c ) { b = 2 * c ; p = p + c ; c = 1 + p ; q = q * 2; print ( b + c ); } main () { foo (p , q ); print p , q ; } Explain and print the output of the above code when the parameters to the foo function are passed by value. Explain and print the output of the above code when the parameters to the foo function are passed by reference. Explain and print the output of the above code when the parameters to the foo function are passed by value result. Explain and print the output of the above code when the parameters to the foo function are passed by name.
- Write a code for craps game. Craps is a dice game in which the players make wagerson the outcome of the roll, or a series of rolls, of a pair of dice.The rules of the dice game craps are as follows:You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots,respectively. After the dice have come to rest, the sum of the spots on the two upward faces iscalculated. If the sum is 7 or 11 on the first throw, you win and play is over. If the sum is 2, 3or 12 on the first throw you lose and play is over. If the sum is 4, 5, 6, 8, 9 or 10 on the firstthrow, that sum becomes your “point.” To win, you must continue rolling the dice until you“make your point” (i.e., roll that same point value). You lose by rolling a 7 before making yourpoint(in python)Write a code for craps game. Craps is a dice game in which the players make wagerson the outcome of the roll, or a series of rolls, of a pair of dice.The rules of the dice game craps are as follows:You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots,respectively. After the dice have come to rest, the sum of the spots on the two upward faces iscalculated. If the sum is 7 or 11 on the first throw, you win and play is over. If the sum is 2, 3or 12 on the first throw you lose and play is over. If the sum is 4, 5, 6, 8, 9 or 10 on the firstthrow, that sum becomes your “point.” To win, you must continue rolling the dice until you“make your point” (i.e., roll that same point value). You lose by rolling a 7 before making yourpoint.gien two variables a and b of type int, that have been decalred and gien values, compute their sum then assign it to another int variable,c, that has also already been declared. c++
- Write C assignment statements for the following: a. Assign a value of 0 to a variable called between if n is less than -k or greater than +k; otherwise, assign 1. b. Assign a value of 1 to a variable called divisor if digit is a divisor of num; otherwise, assign a value of 0. c. Assign a value of 1 to a variable called lowercase if ch is a lowercase letter; otherwise, assign a value of 0.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; }Write a function using the following header:void printChars(char ch1, char ch2, int numberPerLine)This function prints the characters between ch1 and ch2 inclusive with the specified number of characters perline (numberPerLine). Assume ch1 and ch2 are both either uppercase or lowercase letters.Write a test program that reads two characters and the number of characters per line, uses printChars toprint the characters (pass the smaller one as the first character) with the required format. Characters areseparated by exactly one space.Enter first character: BEnter second character: HEnter number per line: 3The characters are:B C DE F GH