What does the following code snippet print? for (int i = 8; i < 17; i++) { if (i % 5 != ®) { print(i + " "); } } 9 10 11 12 13 14 15 16 89 11 12 13 14 16 17 89 11 12 13 14 16 89 10 11 12 13 14 15 16 17
Q: What the following code does? int * foo = new int [5]; if (!foo) { ...}
A: To find what the given code does - int *foo = new int[5]; if(!foo) {........}
Q: int fun(int k){ return ( ); void main(){ int n; cin >> n; n = n * fun(n); <-- 1 Fill in the…
A: Your answer is given below as you required with an output.
Q: What is the value stored at x, given the statements? int x; x = 6 / static_cast (4.5 + 6.4);
A: Static_cast<> is a compile time casting operation. It will perform conversion between types…
Q: #include int main() { int arr[10]; int i; for (i=0; i<10; i++){ arr[i] =…
A: As given, we need add the following code parts to the given code - (1) Copy the content of the first…
Q: 1. Is the following code legal? try { } finally { }
A: The answer is given below.
Q: sum = 0; for (int i = 1; i<n; i = sum++ 2*i)
A: Algorithm for the given code Declare a variable n and take the input for the value n. Declare sum…
Q: double tab1[5] = {2,3,4,5,6}; double tab2[5] = {6,5,4,3,2}; for(int i = 0;i<5;i++)…
A: The program declares two array named tab1 of size 5 and tab2 of size 5. For loop is used to iterate…
Q: int al] =(2, 6, 3, 8, 12, 10, 14); What is the sum of a[1] and a[5]? O a. 16 O b. 20 O c. 14 O d. 18
A: The solution is provided below.
Q: /** * calculate the product of numbers from start to end inclusive e.g. * calcProductOfRange(3, 6) =…
A: Code in java but if the result of the product is out of range then it will print 0; class…
Q: Can you just give a comment in short on what is this about . Or just give a comment on how dose it…
A: Here we have provided brief description for given code In main section of code we have used a…
Q: a) FindMinIterative public int FindMin(int[] arr) { int x = arr[0];…
A: Please refer below for your reference: Time complexitites are below: a) FindMinIterative public int…
Q: What the output forthe code fragments? int i = 7; do{ i = i/2; System.out.println(i);…
A: do while loop firstly executes statements atleast one time without checking condition
Q: 3: The code on the right is supposed to be the ARM code for procA; however, there are problems with…
A: The code given: C code: int procA(int x, int y) { int perimeter = (x+y)* 2; return perimeter; }…
Q: int a[ 10] = {1,5,3,8,4,2,6,9,7}; int *p; p = &a[2]; p[0] = 10; p[1] = 15; What are the values of a?
A: Required:
Q: Rewrite the code snippet in "What is the Output, Question #1" using do-while loops
A: Introduction: Write in do-while loop
Q: CFG: Example 1 • Draw the CFG for the following code: int f(int n){ } int m = n* n; if (n < 0) else…
A: CFG for the code has been written in step2
Q: int x-10; void func1() printf("x-*d\n", x); return; 10 } 11 12 13 int func2(int a, int b) 14 ( 15 16…
A: The code given: #include<stdio.h> int x = 10; void func1(){ printf("X=%d\n", x);…
Q: cmpl $4 , %edi movl %edi , %edi jmp .L4(,%rdi,8) .L3: movl $17, %eax ret .L5: movl $3, %eax int A (…
A: A = X B = W
Q: int mystery (int u, int v) { int a; a = u - V; u = a; V = u; return u + v; choose the output of the…
A: From. The given function mystery(9,7) int u = 9 And int v = 7 Now a = u-v a= 9-7 a= 2 Now u= a
Q: 1. Why does little-endian vs. big-endian matter here in this code 2. Describe how pointer casting…
A: Answer: I have given answer in the brief explanation.
Q: Int cube ( int x) { // returns cube of x : return x.x.x. ;}* False True
A: your question is about True false let's solve the question
Q: KLold T T=T+(K-2)*L T=T-10 T=0 T=T-10 K= 4, 8, 2 L=4, 3, -1 T=T+(K-2)*L
A: Given graph contains lines of codes and the variables present in this are T, K and L. The initial…
Q: Q1/ find code optimization of this code then find type to this code for (i=1;i<n;i++) { V=4* i ; S =…
A: Pseudocode-: Take input n. Find sum of natural number s by using s=n*(n+1)/2. Print 4*s. OPTIMIZED…
Q: void traceMe(double x, double y) { double z; z = (pow(x, y)); cout « fixed « showpoint «…
A: This is a power function code
Q: int func(int a, int b) { return (a<b)? a: b; } int main( ) { int x = 1, y = 3, z = 5; int w; w =…
A: Answer: 1
Q: int* p; int a[3] = {1, 2, 3); p = a; What is the value of *(p+2)?
A: We are we are given an array a and a integer pointer variable p. we are asked the value of *(p+2).…
Q: int a=10, b=15; test (b,a); test (a,b); cout<<a <<b<<endl; int test (int &x, int y) { x=66; y=44;}
A: Here &x denotes that first parameter is passed as reference and y means its passed by value. In…
Q: Why does little-endian vs. big-endian matter here in this code
A: Answer: Little-endian: The little-endian show is a kind of addressing that alludes to the request…
Q: What should be written in Q4? (Update for nUnits for O nUnits += nRev%10 - 1; O nUnits *= 10; O…
A: The answer of first case - correct option is nUnits-=1
Q: In the expression 48:(14*3), are the brackets necessary? What happens when you type 48:14*3?
A: In the expression 48:(14*3), the brackets are necessary to ensure that the multiplication operation…
Q: True/false: The following program has a race on the value of myid. void *printld(void *vargp) { int…
A: Race condition generates when two threads access a shared variable at the same time. That is, the…
Q: Part 2 - OddOrEven Class Write a program that prompts the user to enter an integer. The program…
A: In this question we need to write a program to check if number entered by user is even or odd and…
Q: Code in python: A certain company has encoded the accounts of its customers and requires that you…
A: We will create a check digit class in this Python code that validates the accuracy of account codes…
Q: int j; for (int i = 0; i < 5; i++) {j = 2*j*i;} What is j?
A: int j;for (int i = 0; i < 5; i++){ j = 2*j*i; } here j and i are the integer type variable. i is…
Step by step
Solved in 2 steps with 1 images
- Need to be anwseredvoid traceMe(double x, double y) { double z; z = (pow(x, y)); cout « fixed « showpoint <« setprecision(2)<« x « ", " « y « ", " « z « endl; int main() double one=2, two=6; traceMe(two, one); 2.00 , 6,00 , 36.00 6.00 , 2.00 , 36.00 6.00 , 2,00 , 64.00 O 6.00, 2.00, 4,00When I am putting - getline(cin, name); getline(cin, name); an error comes up underneath the first getline saying "Identifier not found"
- PLEASE HELP ME! ? Maximize and use alternative method to this code! package com.btech.pf101; import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.calendar; import java.util.date; public class pawnshopcode { private static final bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); private static string name; private static int age; private static string address; private static string contactno; private static int itemtype; private static string itemtypename; private static final int itemtype_gagdet = 1; private static final int itemtype_jewelry = 2; private static final int itemtype_musicinstrument = 3; private static final int itemtype_homeequipment = 4; private static final int itemtype_landtitle = 5; private static string itemdescription; private static int periodtype; private static string periodtypename; private static final int periodtype_days = 1; private…Can you just give a comment in short on what is this about . Or just give a comment on how dose it run. #include #define MAX_EMP 5 #include "employee.h" int count = 0; struct Employee emp[MAX_EMP]; void display() { printf("\n---=== EMPLOYEE DATA ===---\n"); printf("EMP ID\tEMP AGE\tEMP SALARY\n"); printf("======\t=======\t==========\n"); for(int i = 0; i < count; i++) { printf("%d\t%d\t%.2f\n", emp[i].id, emp[i].age, emp[i].salary); } } void add() { if(count == MAX_EMP) { printf("\nERROR!!! Maximum Number of Employees Reached\n"); return; } printf("\nAdding Employee ===============\n"); printf("Enter Employee ID: "); scanf("%d", &emp[count].id); printf("Enter Employee Age: "); scanf("%d", &emp[count].age); printf("Enter Employee Salary: "); scanf("%f", &emp[count].salary); count++; } void update() { int id, found = 0; float newSalary; printf("\nUpdate Employee Salary…What is 6*(0.aba) ? U 0 1 2 3 Not defined О a b 1 b 2 а b 3
- What is the output of following code? int n=10; // global class A() { private : int n; public : int m; A() { n=100; m=50; } void disp() { cout<<”n”<<m<<n; }; i) 1050100 ii) 1005010 iii) n5010 iv) n50100To write an application that uses recursion to solve a problem. Details: Create a class called Power that computes the value of base exponent. The class should have one recursive method: • public static int power(int base, int exponent) – Which computes the value of base exponent using recursion, returning the result. The recursion step should use the following relationship base exponent = base x base exponent - 1 and the termination condition should occur when exponent is equal to 1, because base 1 = base NOTE: For the power method, assume the exponent parameter value is always greater than 0. Create a second class called PowerTest that contains the main method, and tests the Power.power method. The test class does not need to ask for input from the user of the class, nor does it need to do any additional error checking. Upload both source files to Blackboard. Note: Ensure that your program is properly formatted and it follows all Java naming conventions.Trace through (show all the steps as we did in class) for the following java code for the factorial function. Show all the steps (illustrate, do not code) that lead to the final answer when myFactorial(6) is called: int myFactorial( int integer) { if( integer == 1) return 1; else { return(integer*(myFactorial(integer-1); } }
- In C++ QUESTION 14 class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Write the function definition for the function perimeterHow do you do 4)??void baz(int a, int * p) { pushq %rbp movq %rsp,%rbp subq $16,%rsp int c; c = a-*p; movl %ecx,16(%rbp) movq %rdx, 24(%rbp) movq 24(%rbp), %rax movl (%rax),%eax movl 16(%rbp),%edx subl %eax,%edx movl %edx,%eax movl %eax,-4(%rbp) cmpl $0, -4(%rbp) je L2 if (c) { int d = c*2; movl -4(%rbp),%eax addl %eax,%eax movl %eax,-8(%rbp) *p -= d; movl 24(%rbp),%rax movl (%rax),%eax subl -8(%rbp),%eax movl %eax,%edx movq 24(%rbp), %rax movl %edx, (%rax) jmp L4: } (continued on next page)