int Q3 Spr2021 (double y, char let, int number, string last name) {. . . }
Q: int Secret (int num1, int num2) if (numl > 0) for (int i = 1; i 0) for (int i = 0; i <= num2; i++)…
A: The working of Secret Function is to return the multiple of 2 or 3. If the value of num1>0,…
Q: Determine whether the following array declarations are valid. If a declaration is invalid, explain…
A: a) int primeNum[99]; here primeNum is an integer array with size 99. It is correct. b) int…
Q: #include int main(int arge, char * argy { int x = argc-1; int num1[x]:
A: #include<stdio.h> /* header file for input output statement */ #include<stdlib.h> /*…
Q: Q2-Write a C++ code to print the below table by creating which has int value Age' moreover to two…
A: According to the question we have to write C++ code to print the below table by creating which has…
Q: #include int main() int x = 23; %3D double y = 11; printf("%lu",size return 0;
A: Below the output of the program
Q: int Manipulate (char code [] [10]) { // Line 1 if (strcmp (code [1], code [2])) // Line 2 // Line 3…
A: Program Approach: Include necessary header files. Define method manipulate . Use if condition of…
Q: #include int main(){ int i=150.j=170, "pi=&i, *pj=&j; "pi=j-5; j="pi-5; printf("%d %d %d…
A: The code which you have mentioned is #include <stdio.h> int main(){ int…
Q: #include int k=0; int f(int t) { k += t; heturn k; } void main() int i, result=1; { for(i = 1;i <=…
A: Hello student Greetings Hope you are doing great. I will try my best to answer your question. Thank…
Q: // Assume all libraries are included void QQ(int n); // int main () { // Random questions QQ (5) ; 3…
A: this program in c++ it bascially call function QQ(5); QQ ( int n ) this function checks if…
Q: Time -hour:int -minute:int -second:int hour minute second [0, 23] [0, 59] [0, 59]…
A: public class TimeMain { public static void main(String[] args) { Time t1=new…
Q: 2. #include int main() { int num, count, sum = = 0; printf("Enter a positive integer: ");…
A: Answer: As per guidelines I can solve only first question. So i request you to please repost other…
Q: const int size =4; int r1[size]; int i; for (i=0;i<2;i++) r1[i]= 2 * i+ 3; r1[3]=2 * i + i;…
A: Here we have an array with a size of 4. Next, we have used a for loop to operate over the first 2…
Q: Arrays where the index is a string value. O a. Associative O b. Positive O c. Numeric O d. None
A: Arrays where the index is a string value. a Associative b Positive c Numeric d None.
Q: es = new int[2][8]; es = new int[4][4];
A: Declaring array syntax Data_type arrayName [ arraySize ]; Data_type is the type of data in array…
Q: int num; scanf("%d", &num); int n1; int pid = -1; for (int i=0; i<2; i++) { if(pid) { n1 = num%10;…
A: The above code is written in C language. when input is specified as integer type then it only…
Q: "<« z <<endl; %3D <« y<< %3D cout<<x<<" return e; } void calc(int a, int &b){ int c; c=a+1; a=a*2;…
A: Explanation In this Program, we have used both call by value and call by reference. while passing x…
Q: #include int main() short int i = 20; C - printf ("%d, %d, %d\n", sizeof (i), sizeof(c), sizeof (c…
A: Given, Code: #include <stdio.h> int main() { short int i = 20; char c = 97;…
Q: #include int main(). { char name[20]; printf("\nEnter your name :"); gets(name) ; printf("\nYour…
A: In given c program, it contains an array name of length 20 characters. gets() and puts() functions…
Q: Write a program that calculates the average of an array of 5 floating-point values.
A: Algorithm: Start Declare A[5] Set I = 0 Set Sum = 0 While I < 5 : READ A[I] Sum += A[I]…
Q: *please help in java* Array testGrades contains NUM_VALS test scores. Write a for loop that sets…
A: Step 1 : assign sumExtra = 0 Step 2 : Make for loop till testGrades.length Step 3 : check for values…
Q: a) b) C) d) CO 1 123 2 4 5 6 7 8 9 10 11 12 20 19 TELE 345 13 #include #include int main(){ 14 15…
A:
Q: (b) #include int main() { int a, b; a = -3 -- 3; b = -3 -- (-3); printf ( "a = %d b = %d\n", a, b )…
A: The code is having following errors which are listed below:
Q: #include using namespace std; int main() { const char * s = "pointer"; char x = * (s + 4) + 3; int…
A: Output of the program w5029113243612 I run the program and the result is above. I dont found the no.…
Q: 1. class array_output { 2. public static void main(String args) 3. { 4. char array_variable 0 - new…
A: The loop is used to execute a block of statements repeatedly. Java has three types of loops: for…
Q: #include void main () { int z[4][2]={{1, 2}, {3, 4}, {5, 6}, {7, 8}}; int a, b, c; for (a = 0; a <…
A: Given Program: // Online C compiler to run C program online#include <stdio.h> int main() {…
Q: const int SIZE = 7; int studyHours [SIZE]={3, 2, 4, 2, 4, 5, 3}; string day[SIZE] = {"Monday",…
A: answer is Study hour for the student one Wednesday is 4 Reason: indexing in array always starts…
Q: d) public static String getMonthName(int month) { // return the month name for month // e.g. if…
A: Ans d: Code: public static String getMonthName(int month){ switch(month){ case 1:…
Q: 0 is an element {{0},{1}}
A: Given representation denotes a two dimensional array and a two dimensional array is a data structure…
Q: Tamespac int main() 5- { int m=11, t=5, k=4; k=m++ +t; 8. cout <« "\n the value of k is : "; cout <<…
A: The output of above code will be: 16
Q: #include int main() short int i - 20; char c = 97; printf("%d, %d, %d\n", sizeof(i), sizeof(c),…
A: Here is the explanation about the size:
Q: Why Char array is preferred over String for storing password?
A: A character array is a sequence of characters just as a numeric array is a sequence of numbers.
Q: b) int Numl=4, Num2=8, sumOfTwoNumbers; sumOfTwoNumbers first Number + secondNumber; cout <<Numl<«…
A: EXPLANATION: In the first line, three variables are declared and two of them are initialized with…
Q: Declare an array named temperatures that can hold 10 doubles.
A: The datatype is double[] The name is temperatures The size is 10 So, let's see the statement how we…
Q: Declare an integer array named countingNumbers and fill it with the integers 1 through 10…
A: Java program to solve the given problem is below.
Q: . Display the array in the console using the Arrays.toString () method 2. Display the names and the…
A: As per our policy, we are supposed to answer only three subparts of question and kindly resubmit the…
Q: lic MyString(char[] chars); lic char charAt(int index); plic int length(); lic MyString…
A: We need to MyString class as per the given methods interfaces.
Q: #include #include struct user { char user_name[10]; char bank_name[10]; int…
A: Flow chart is a step by step process of the program which is represented using the symbols and flow…
Q: Q2-Write a C++ code to print the below table by creating which has int value 'Age' moreover to two…
A: Code:- #include <iostream>#include <iomanip> using namespace std; int main() { // your…
Q: Find errors in code below- #include int main()
A: Given: A C language code is given which reads an integer variable from user and print that number.…
Q: What is wrong with this code? int Money4Me( int dollars ) { int pennies, coins; coins =…
A: Solution :
Q: int main(int argc, char **argv) { float *rainfall; float rain_today; // rainfall has been…
A: Here is the answer:-
Q: c++complete and change #include using namespace std; int sumbyrow(int* m, int ncol, int row) {…
A: Note : I am considering that you are facing some logical error in this code which is not…
Q: Declare an int constant minutesPerHour whose value is 60
A: #include <iostream>using namespace std; int main() { const int minutesPerHour = 60; const…
Q: This is the code: String name = Doe, John"; int index =name.indexOf(" , "); String firstName=…
A: public class Main{ public static void main(String[] args) { String name = "Doe, John";…
Q: Write a C# application to find the number of even numbers and odd numbers in an array of 10…
A: here have to determine about code in c# for find the number of even numbers and odd numbers in an…
Q: #include int main() double score; scanf("%5.5lf", &score); return 0;
A: Scanf() is built library function which is used to accept and store value from user. The syntax is…
Q: #include int main(void) { int a[3][3] = {1,3,5,7,9}; int i,j,sum=0; for(i = 0; i < 3; i++) for (j =…
A: #include<stdio.h> int main() { int a[3][3] = {1,3,5,7,9}; int i,j,sum=0; for(i =…
Step by step
Solved in 2 steps
- Consider the following function definition. double funcTest(string name, char u, int num, double y){}Which of the following are correct function prototypes of the function funcTest?a. double funcTest(string, char, int, double);b. double funcTest(string n, char ch, int x, double t);c. double funcTest(name, u, num, y);d. int funcTest(string, char, int, double)Consider the following function definition: void too2(int a[ ], int howMany) { for (int index = 0; index < howMany; index++) a[index] = 2; } Which of the following are acceptable function calls? int myArray[29]; too2(myArray, 29); too2(myArray, 10); too2(myArray, 55); "Hey too2. Please, come over here." int yourArray[100]; too2(yourArray, 100); too2(myArray[3], 29);1. Write a function which takes one parameter int num, and prints out a countdown timer with minutes and seconds separated by a colon (:). It should print out one line for each second elapsed and then pause one second before printing out the next line. A few things to note: - You can assume that calling the function usleep(1000000) makes the program pause for one second - It should count down from num minutes:zero seconds to zero minutes:zero seconds - Your function must have the following signature: void timer(int num) You do not need to demonstrate calling this function from main(). You don't need to format the output nicely; the below is acceptable output for calling this function when minutes is 10: 10:0 9:59 9:58 … 9:1 9:0 8:59 8:58 … 0:2 0:1 0:0
- Write a function convertQuartersToDollars that has the noOfQuarters, noOfDollars, and remainingCents as formal parameters of data type int. The noOfQuarters is the number of quarters to be used to calculate noOfDollars, the number of dollars that the total number of quarters can be converted to, and remainingCents , the remaining cents. The noOfDollars and remainingCents are returned from the function,Engineers often measure the ratio of two power measurements in decibels, or dB, which can be calculated as follows:dB= log10P2/P1Where P2 is the power level being measured, and P1 is some reference power level. Write a function that calculates the level. The function’s prototype is as follows:double dBCalculator (double P1, double P2);Then, call dBCalculator from the main function to find the power ratio for the measurements from 1 to 20 Watts, in 2 Watt steps. You can assume that the reference power P1 is 1 Watt.Consider the following function. What is the purpose of the function f? Please do explain and describe in details all possible answers for this function given below.int f(int n) {if ((a >= b) && (c < b)) return b; else if (a >= b) return f(a, c, b); else return f(b, a, c);} To find the maximum number between a, b, and c. To find the middle number between a, b, and c. To find the minimum number between a, b, and c. None of the other statements.
- Consider the following function. What is the purpose of the function f? Please do explain and describe in details all possible answers for this function given below.int f(int n) {if ((a >= b) && (c < b)) return b; else if (a >= b) return f(a, c, b); else return f(b, a, c);} To find the maximum number between a, b, and c. To find the middle number between a, b, and c. To find the minimum number between a, b, and c. None of the other statements. Suppose the letters a,b,c,d,e,f have probabilities of 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. Which of the following is the Huffman code for the letter a,b,c,d,e,f? Please show how is the Huffman tree, so that you can determine one of the options below. 0, 10, 110, 1110, 11110, 11111 11, 10, 01, 001, 0001, 0000 11, 10, 011, 010, 001, 000 110, 100, 010, 000, 001, 111 An adjacency matrix of a graph is given below:First, draw the graph defined by that adjacency matrix, and label the vertices of the graph with 1, 2,…Suppose you have written the following function. function salesTax(price, rate) { let tax = price * rate; return tax;{ How can you call the function, passing in values of 9% for the sales tax rate and $20 for the price? a. salesTax(20, 0.09); b. salesTax(0.09, 20); c. function salesTax(20, 0.09); d. tax = 20 * 0.09;Write a function rps in Python that returns the result of a game of "Rock,Paper, Scissors". The function accepts two arguments, each one of 'R','P','S' , that represents the symbol played by each of the two players. The function returns: -1 if the first player wins0 if a tie1 if the second player winsScissors beats Paper beats Rock beats Scissors Sample usage: >>> rps('R','P') # player 2 wins, return 11
- Define a function CalcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. Relevant geometry equations:Volume = base area x height x 1/3Base area = base length x base width.(Watch out for integer division). #include <iostream>using namespace std; /* Your solution goes here */ int main() { double userLength; double userWidth; double userHeight; cin >> userLength; cin >> userWidth; cin >> userHeight; cout << "Volume: " << CalcPyramidVolume(userLength, userWidth, userHeight) << endl; return 0;}In Kotlin, write a higher-order function with an expression body that takes an int n and a function f from int to int and returns the result of calling f(f(n)). For example if you call the function with n = -5 anda function that calculates absolute value, your function will return 5, and if you send the value 2 and a function that calculates the sqaure of an int, the function will return 16. in addition to the function, write the syntax to call it with:a. a function name as the function arguementb. some lambda expression as the function argumentSuppose that you have the following function definition. int find(int x, int y){return (x + y - x * y);}Consider the following declarations:int list1[10], list2[10], list3[10];int u, v;In the following statements, which function call is valid?a. u = find(list1[0], v);b. cout << find(list1[0], list2[9]) << endl;c. cout << find(list1, list2) << endl;d. for (int i = 0; i < 10; i++)list3[i] = find(list1[i], list2[i]);