What is the value stored at variable "x" after executing the following code segment double vol(3112) - (1.1, 2.2,3.3,4.4,5.5,6.6): double x-0 int i,j for (i-01 i<21 i++): for (j-01 je«l; j++) X+ vol (i] 1j11
Q: What would be output of the following code, assuming that normal order evaluation is used? (You may…
A: (1) The function count returns the count in 1. The counter is defined as 1 Since, the function is…
Q: A-1D-9 Given the code segment below, what will be the sum of ALL elements of dCData after running…
A: Please upvote. I am providing you the correct answer below. Please please please.
Q: Assuming the code x = (2* (3 – (4 * (9 + 8 * 6 /10) % 4) + 7) / 9); has been executed correctly,…
A: () Parentheses has the highest priority. Then *, /, % have the priority and associativity from left…
Q: iterate func s 0 = s iterate func s n = func (iterate func s (n-1)) What is the output of the…
A: see first x is changed to 2x then rest of the things are done
Q: Assuming the code x = 5 % 2 / 3 *7+ 4 /2 -6; has been executed correctly, what is the value of…
A: Q: Output the given code
Q: int [] X = {12,15,12}; int [] Y = {1,2,3}; int i=0; for(int a:X) %3D if(a%2==1) { Y[i]=a; i++; else…
A: I have given an answer in step 2.
Q: What is wrong with the following code? int *p;. //Line 1 int *q;. //Line 2 p = new int [5];.…
A: Errors in program: The program statements should end with the semi colon (;), and not with a dot…
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: Self-Assessment Quiz What is the output of the following program? b d i= 3, j = 5 i = 5, j = 5 i= 5,…
A: There are methods/ways to pass the data into the function: Call by Value and Call by Reference. In…
Q: Assuming the code x =( 2 * 5 / 9 % 3 ) * (x++) - 8 / 5 ; has been executed correctly, what is the…
A: Given Question: To give the value of the integer x.
Q: What are the values of i and j obtained after the following code fragment is run? int i = 50; %3D…
A: To choose the correct output for the given program.
Q: 6. int i,sum=0; for (i=10 ; i>0 ; i++){ sum+=i*i; i++; printf("%d\n", sum); 7. int a[3] [3]={{1, 2,…
A: 6. This code doesn't print sum. Because the loop executes infinitely. Because the condition is…
Q: What is the result after execution of the following code: int i 1, x 4; while (++i <= 10) { x++:…
A: The output of the given c++ program is discussed below.
Q: Give the output from this code fragment: c++ int *p1, *p2; p1 = new int; p2 = new int;…
A: Given: Give the output from this code fragment: c++ int *p1, *p2; p1 = new int; p2 = new int;…
Q: Q#2: Convert the code into descriptive code, and verify using White Box Testing.( FlowGraph) int…
A:
Q: Describe the execution of the following program segment. 1. int c[2] [3]; 2. int a[2] [3] ={ {5},…
A: Here the content of array a is 5 0 0 1 2 0 Content of array b is 2 4 6 8 0 0
Q: Give the output from this code fragment: int *p1, *p2; p1 = new int; p2 = new int;…
A: 1) Above code fragment create two integer pointer variable(p1 and p2) and dynamically allocate…
Q: QUESTION 12 What will be the value of P after the execution of the following code P = 1 ; for ( k =…
A: As per Q and A guidelines, solving only 1 question. Please post the other question separately.…
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: a. Translate with a three-address statement, the following expression: n = f((x+2), y) – 5; b. If…
A: a. Given n = f((x+2), y) – 5; Three Address Code for the given expression is- (1) T1 = x+2 (2) T2 =…
Q: Consider the following code fragment. After execution of the program fragment is finished, what is…
A: Explanation: The question is asked the value of x after the execution of code fragment. The last…
Q: int X[10]={2,0,6,11,4,5,9,11,-2,-1); %3D From the code above, what is the value of X[8] ?
A: Code: #include <iostream>using namespace std; int main(){ //as index value starts from 0…
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: 1. Consider the following code segment: for (int i = 200; i > 0; i /= 3) { } if (i % 2 == 0)…
A: Answer: Option C: 200 66 22 2
Q: Consider that the program uses student ID for interface i.e., input and output purposes but use a…
A: #include <stdio.h>#include <stdint.h>int getStdCode(int stdID){ // move 13 bit to 18…
Q: 3. Consider the following C code fragment, which makes use of the strcpy version that truncates a…
A: Memory corruption can be described as the vulnerability that occurs when memory is replaced without…
Q: What is the output of the following code? int *p1, *p2; p1 = new int; p2 = new int; *p1 =…
A: A) The Correct Output : 11 11 p1 and p2 will have the same value.
Q: What would the output if dynamic scoping is used. Consider that execution of the code starts from…
A: There are two types of scoping used while coding: Dynamic and Static Difference between Dynamic…
Q: Calculate average, variance, and standard deviation of the array B and print those on the screen
A: #include <stdio.h>#include <math.h>#define MAXSIZE 10 int main(){ float B[MAXSIZE];…
Q: Q2. Write a C++ program that define an empty array of size 10 and user has to input marks scored by…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: 18. int x,y; x = 1 / 2; y = 3.0 / 2.0 double z, w, t; z = 1 / 2; w = 3 / 2 t = 3.0 / 2.0%; x = y =…
A: We are two codes where we are initialising variable with some values. We will have to find their…
Q: /*Question: What is the output after run the following C++ statements, Assume all libraries already…
A: Here we have defined the function named Quiz2(). This function has been defined 4 different times…
Q: need hello writing a JAVA code segment to add two matrices A and B, and store the results in matrix…
A: Code import java.util.Scanner;public class sample { public static void main(String args[]) {…
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: a) Write Java code fragment for handling 2D array, as required below: O Write only one statement to…
A:
Q: Q-No.5: Consider the following code and write the output of this code. (a) int *point; point = new…
A: In the above program, First we are declaring Integer pointer of array size 20 and name is point…
Q: Rajesh loves lucky numbers. Everyone knows that lucky numbers are positive integers whose decimal…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
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: 3. Describe the execution of the following program segment. 1. int c[2] [3]: 2. int a[2] [3] ={ (5}.…
A: - We need to fill the tables according to the code provided.
Q: What will be the output of the following code,
A: The array name acts as a constant pointer which points to the first element of the array. The…
Q: What is the result after execution of the following code: int i 1, x 4: while (++i <= 10) { x++:…
A: The given C++ code is executed and the result which is the correct answer is provided with…
Q: Assuming the code x = (6 – 8 * (7 / 7 – 5) + 3 / ++x); has been executed correctly, what is the…
A: Answer: Given x = (6 – 8 * (7 / 7 – 5) + 3 / ++x) we need to executed correctly and find the value…
Q: Consider the block of code below and find how many times line 8 gets executed when input has values:…
A: Given:
Q: Consider the following lines of code: int a = 5; %3D double b = 10; double c = a / b; C (int)c +1;…
A: After the code have been executed,the value of c is 1.0. Therefore the correct option is None of the…
Q: 3. Describe the execution of the following program segment. C++ 1. int c[2] [3]; 2. int a[2] [3] ={…
A: int a[2][3]={{5},{1,2}}; Here we are creating array of size 2*3, but we but one element in first row…
Q: Consider the following code fragment: int reps = 10; int x = 0; int y, z; y = (3 + 10) / 5; z = 3 +…
A: Consider the following code fragment int reps = 10; int x= 0; int y ,z; y=(3+10)/5;…
Q: Consider the following source code : c = a + b d = c c = c – e a = d – e b = b * e b = d/b…
A: Given source code is c = a + b d = c c = c – e a = d – e b = b * e b = d/b
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: Assuming the code x = 3 % 4 - 2 * 5 / 6 * (3 * 2 – 1); has been executed correctly, what is the…
A: Introduction: Here we are asked what will be the value of x which have a equation given above.
Q: void foo(long *a, long +b, long *c, int n); Its body compiles to the following code: # a in %rdi, b…
A: The C code is: for( i=0; i<=n; i=i+1 ) a=b+c; According to the bartleby guidelines, we…
Step by step
Solved in 2 steps with 1 images
- #include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/types.h>#include <sys/wait.h> int main(){ int i, s; int a[] = {23,4,8,33,25,7,12,6,49,50,11,20,21,24,35}; pid_t pid; pid = fork(); if (pid == 0) { printf("I'm a child, I'll be printing the even numbers:\n"); for(i=0;i<(sizeof(a)/sizeof(int));i++) if(a[i]%2 == 0) printf("%d ",a[i]); } else { printf("I'm the parent, I'll be printing the odd numbers:\n"); if (pid > 0) pid = waitpid(pid, &s, 0); for(i=0;i<(sizeof(a)/sizeof(int));i++) if(a[i]%2 != 0) printf("%d ",a[i]); } return 0;} the output seem to have some error whereby it cannot output the number for the first if21.2 Project 1 (Checkpoint B): DNA Write the full C++ code for this Implement the following functions: /** * Reads from standard input a list of Short Tandem Repeat (STRs) * and their known counts for several individuals * * @param nameSTRs the STRs (eg. AGAT, AATG, TATC) * @param nameIndividuals the names of individuals (eg. Alice, Bob, Charlie) * @param STRcounts the count of the longest consecutive occurrences of each STR in the DNA sequence for each individual * @pre nameSTRs, nameIndividuals, and nameSTRs are empty * @post nameSTRs, nameIndividuals and STRcounts are populated with data read from stdin **/ void readData(vector<string>& nameSTRs, vector<string>& nameIndividuals, vector<vector<int>>& STRcounts) For example, consider the input: 3 AGAT AATG TATC Alice 5 2 8 Bob 3 7 4 Charlie 6 1 5 In the first line, the number of STRs followed by the names of those STRs, which will be populated into the vector nameSTRs. The remaining lines contain…• R7.21Find the mistakes in the following code. Not all lines contain mistakes. Each line depends on the lines preceding it. Watch out for uninitialized pointers, nullptr pointers, pointers to deleted objects, and confusing pointers with objects. 1 int* p = new int; 2 p = 5; 3 *p = *p + 5; 4 string s = "Harry"; 5 *s = "Sally"; 6 delete &s; 7 int* a = new int[10]; 8 *a = 5; 9 a[10] = 5; 10 delete a; 11 int* q; 12 *q = 5; 13 q = p; 14 delete q; 15 delete p;
- 8.15 (Displaying a Sentence with Its Words Reversed) Write a program that inputs a line of text, tokenizes the line with function strtok and outputs the tokens in reverse order Note:solve the program without using pointers and in c language4. b. If A is an array of integers with width = 4; Please translate withthree-address statement, the following expression: x = a[i] + 2;8.26 LAB: Word frequencies (dictionaries) Implement the build_dictionary() function to build a word frequency dictionary from a list of words. Ex: If the words list is: ["hey", "hi", "Mark", "hi", "mark"] the dictionary returned from calling build_dictionary(words) is: {'hey': 1, 'hi': 2, 'Mark': 1, 'mark': 1} Ex: If the words list is: ["zyBooks", "now", "zyBooks", "later", "zyBooks", "forever"] the dictionary returned from calling build_dictionary(words) is: {'zyBooks': 3, 'now': 1, 'later': 1, 'forever': 1} The main code builds the word list from an input string, calls build_dictionary() to build the dictionary, and displays the dictionary sorted by key value. Ex: If the input is: hey hi Mark hi mark the output is: Mark: 1 hey: 1 hi: 2 mark: 1 Use Python, please.
- 8.19 (Removing a Particular Word From a Given Line of Text) Write a program that inputs a line of text and a given word. The program should use string library functions strcmp and strcpy to remove all occurrences of the given word from the input line of text. The program should also count the number of words in the given line of text before and after removing the given word using the strtok function. Solve it Without using pointers15.11 LAB: Sorting user IDs C++ Given a main() that reads user IDs (until -1), complete the Quicksort() and Partition() functions to sort the IDs in ascending order using the Quicksort algorithm, and output the sorted IDs one per line. Ex. If the input is: kaylasimms julia myron1994 kaylajones -1 the output is: julia kaylajones kaylasimms myron1994 #include <string>#include <vector>#include <iostream> using namespace std; // TODO: Write the partitioning algorithm - pick the middle element as the// pivot, compare the values using two index variables l and h (low and high),// initialized to the left and right sides of the current elements being sorted,// and determine if a swap is necessaryint Partition(vector<string> &userIDs, int i, int k) { } // TODO: Write the quicksort algorithm that recursively sorts the low and// high partitionsvoid Quicksort(vector<string> &userIDs, int i, int k) { } int main(int argc, char* argv[])…#include <stdio.h>#include <conio.h> #define r 3#define c 4 int z[r][c] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};int main (){ int a, b, d = 999; for (a = 0; a < r; ++a){ for (b = 0; b < d; ++b){ if(z[a][b])<d){ d = z[a][b]; printf("%d", d);} getch (0);}} return 1;} Using c language, produce the output.
- 8) Write a Java code segment to sum (total) only the positive (greater than zero) values contained in a one dimensional array of integers named intArr that has already been filled with a variety of values (from -250 to +250, for example) and print the final total of the positive contents with an appropriate message.iv) Write a JAVA program to merge two sorted arrays into a single sorted array. Take the sample arrays given below and print the result in the output. The time complexity of the program should be O(N+M) where N and M are the sizes of both the arrays. int []arr1 = {1, 6, 10, 14} int []arr2 = {2, 4, 5, 11, 16, 19} Print the merged array in the output.15.11 LAB: Sorting user IDs C++ Given a main() that reads user IDs (until -1), complete the Quicksort() and Partition() functions to sort the IDs in ascending order using the Quicksort algorithm, and output the sorted IDs one per line. Ex. If the input is: kaylasimms julia myron1994 kaylajones -1 the output is: julia kaylajones kaylasimms myron1994 I can only change the //TODO and please answer in C++ #include <string>#include <vector>#include <iostream> using namespace std; // TODO: Write the partitioning algorithm - pick the middle element as the// pivot, compare the values using two index variables l and h (low and high),// initialized to the left and right sides of the current elements being sorted,// and determine if a swap is necessaryint Partition(vector<string> &userIDs, int i, int k) { } // TODO: Write the quicksort algorithm that recursively sorts the low and// high partitionsvoid Quicksort(vector<string> &userIDs, int i, int k) {…