int* p; int a[3] = {1, 2, 3); p = a; What is the value of *(p+2)?
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: #include using namespace std; class test{ public: test(){ cout<<"alpha\n"; } ~test(){…
A: This is about classes and the constructors.
Q: #include using namespace std; int BinSearch(int arr[],int beg, int end, int key){ if(beg >…
A: Program after removing function #include<iostream>#include<stdlib.h>using namespace…
Q: #include using namespace std; class Box { Public: int length, width, sum, sub, div; Box…
A: The given program is written in the c++ programming language. It can be executed in any one of the…
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: #include #include using namespace std; //hasHelpOption() definition int hasHelpOption(int argc,…
A: Your program gives the following warning on compilation: It is because the compiler can not tell…
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: Code: #include using namespace std; void BUBBLE(int A[],int N){ for(int k=0;kA[ptr+1]){…
A: Explanation: To remove the function from the program and writing everything into a main function is…
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: = {a; b; c; d} and R= {(a; a); (b; c); (c; b); (d; d)Łithen R is Transitive O Equivalent O
A: A relation is said to be transitive if all the element in Set, if aRb and bRc then aRc.
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: #include #include using namespace std; int main() { int arr [7] = {9, 4, 1, 6, 2}; int i, j, k,…
A: Answer: A function is a block of code that runs when we call any function. You can pass data into…
Q: Problem Description Gary being the smartest guy in the town is a friend of you. He challenges you…
A: String In their most basic forms, there are two different sorts of string datatypes: fixed-length…
Q: Complete the code: string cars[5] = {"Volvo", "BMW", "Ford", "Mazda", "Honda"}; for(int i = 0; i< _;…
A: string cars[5]={"Volvo","BMW","Ford","Mazda","Honda"}; for(int i=0;i<5;i++){…
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: how to tweak the code so that when i enter for computer's ship it only shows whether i missed or hit…
A: So to do this you just have to remove the display_board() method from line no. 94 and line no.100…
Q: b[2] A. int В. ВОХ x.n a[2].a C. pointer to pointer to char p.n D. char x.args[3] E. int pointer v…
A: The question is on match the correct option.
Q: #include #include typedef struct Car_struct { char type [20]; int year; } Car; int main (void) {…
A: Result: truck Explanation : In the above program, we create a structure which contains two variables…
Q: 1- If A=[1,2; 3,4], and B=A*2; then A*B=? O [14, 30; 28,44] O [14, 30,20,44] O [14, 20; 30,44] O…
A: Answer in step 2
Q: #include using namespace std; void main() { double pi = 0, denominator = 1; int counter = 999999;…
A: Modified program code: //including necessary header file #include<iostream> using…
Q: // this solves the area of a circle #include #define PI3.1415927 double Area(double r) double…
A: We need to debug the given c++ code and correct it.
Q: #include using namespace std; const int y = 1; int main () ( int static y - 2; int i = 3, j - 4, m…
A: The output along with the explanation is given below:
Q: include using namespace std; bool isPalindrome(int x) { int n=0,val; val = x; while(x > 0) { n = n *…
A: Solution :
Q: What is the value of the variable ss after the following code is executed? int x[ 7 ] =…
A: In the given program, an array of size 7 is defined which contains 6 elements. Then, a variable ss…
Q: Declaration int a[4][3]; declares an array that contains this many total elements:
A: Declaration int a[4][3]; declares an array that contains this many total elements:
Q: Lab 6 Use the lab5.cpp as a started file. Modify the program is it generates 1000 points with a…
A: The Algorithm of the code is as follows:- 1. Set up an array of structs to hold 1000 points2. Set up…
Q: using namespace std; int main() [double degree [6] [2] =(30,40,10,70, 20, 30, 60, 70, 30, 10, 10,…
A: Answer: 60 Correct option is : 4
Q: In this code snippet that performs a binary search, what code should replace the placeholders…
A: The question asks to choose the correct expression and statement to replace placeholders in a binary…
Q: #include int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key);
A:
Q: class A Q5: Correct the following code fragment and what will be the final results of the variable a…
A: Source Code #include <iostream> using namespace std; class A { protected: int…
Q: #include using namespace std; class Student public: void setMarks(){ } double getAV(double a[]){…
A: The output will be 40 (option 2) Explanation:- Output In this program, the array are initialized…
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: #include using namespace std; class test{ public: test(){ cout<<"alpha\n"; } ~test(){…
A: Given: #include <iostream>using namespace std;class…
Q: #include using namespace std; class test{ public: test(){ cout<<"
A: Code: #include <iostream>using namespace std;class…
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: #include using namespace std; void some_action_1(int); int main() { cout<<some_action_1(2); return…
A: Because function return type is void, means it doesn't return any value. While function call is in…
Q: #include #include typedef struct Number_struct { int num; } Number; void Swap(Number*…
A: Code: Swap Function void Swap(Number* numPtr1, Number* numPtr2) { int temp = numPtr1->num;…
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: include
A: 1) Computers store data in memory in binary. One thing that is often overlooked is the formatting at…
Step by step
Solved in 3 steps with 2 images
- 2- Let a = [123; 2 3 4; 12 5], b = [ 2133 points ; 50 -2; 2 3 -1] prod = a* b. What is the value of prod?Q1 #include <stdio.h> int arrC[10] = {0}; int bSearch(int arr[], int l, int h, int key); int *joinArray(int arrA[], int arrB[]) { int j = 0; if ((arrB[0] + arrB[4]) % 5 == 0) { arrB[0] = 0; arrB[4] = 0; } for (int i = 0; i < 5; i++) { arrC[j++] = arrA[i]; if (arrB[i] == 0 || (bSearch(arrA, 0, 5, arrB[i]) != -1)) { continue; } else arrC[j++] = arrB[i]; } for (int i = 0; i < j; i++) { int temp; for (int k = i + 1; k < j; k++) { if (arrC[i] > arrC[k]) { temp = arrC[i]; arrC[i] = arrC[k]; arrC[k] = temp; } } } for (int i = 0; i < j; i++) { printf("%d ", arrC[i]); } return arrC; } int bSearch(int arr[], int l, int h, int key) { if (h >= l) { int mid = l + (h - l) / 2; if…#include <iostream>using namespace std;double median(int *, int);int get_mode(int *, int);int *create_array(int);void getinfo(int *, int);void sort(int [], int);double average(int *, int);int getrange(int *,int);int main(){ int *dyn_array; int students; int mode,i,range;float avrg;do{cout << "How many students will you enter? ";cin >> students;}while ( students <= 0 );dyn_array = create_array( students );getinfo(dyn_array, students);cout<<"\nThe array is:\n";for(i=0;i<students;i++)cout<<"student "<<i+1<<" saw "<<*(dyn_array+i)<<" movies.\n";sort(dyn_array, students);cout << "\nthe median is "<<median(dyn_array, students) << endl;cout << "the average is "<<average(dyn_array, students) << endl;mode = get_mode(dyn_array, students);if (mode == -1)cout << "no mode.\n";elsecout << "The mode is " << mode << endl;cout<<"The range of movies seen is…
- #include using namespace std; int main() (double degree [6] [2]= (30,40,10,70, 20, 30, 60, 70, 30, 10, 10, 85); int buffer=degree[0][0]; for (int i=1;ibuffer) buffer=degree[i][0]; cout<#include <iostream>using namespace std;double median(int *, int);int get_mode(int *, int);int *create_array(int);void getinfo(int *, int);void sort(int [], int);double average(int *, int);int getrange(int *,int);int main(){ int *dyn_array; int students; int mode,i,range;float avrg;do{cout << "How many students will you enter? ";cin >> students;}while ( students <= 0 );dyn_array = create_array( students );getinfo(dyn_array, students);cout<<"\nThe array is:\n";for(i=0;i<students;i++)cout<<"student "<<i+1<<" saw "<<*(dyn_array+i)<<" movies.\n";sort(dyn_array, students);cout << "\nthe median is "<<median(dyn_array, students) << endl;cout << "the average is "<<average(dyn_array, students) << endl;mode = get_mode(dyn_array, students);if (mode == -1)cout << "no mode.\n";elsecout << "The mode is " << mode << endl;cout<<"The range of movies seen is…Q1/ find code optimization of this code then find type to this code. for (i=1;iQuestion 37 public static void main(String[] args) { Dog[] dogs = { new Dog(), new Dog()}; for(int i = 0; i >>"+decision()); } class Counter { private static int count; public static void inc() { count++;} public static int getCount() {return count;} } class Dog extends Counter{ public Dog(){} public void wo(){inc();} } class Cat extends Counter{ public Cat(){} public void me(){inc();} } The Correct answer: Nothing is output O 2 woofs and 5 mews O 2 woofs and 3 mews O 5 woofs and 5 mews O] ] has_perfect You are to write a function has "perfect (graph)" that takes in a BIPARTITE graph as its input, and then determintes whether or not the graph has a perfect matching. In other words, it will return the Boolean value True if it has one, and False if it does not. After compiling the above cell, you should be able to compile the following cell and obtain the desired outputs. print (has perfect({"A" : ["B", "C"], "B" : ["A", "D"], "C" : ["A", "D"], "D" : ["B", "C"]}), has perfect ( {"A" : ["B"], "B" : ["A", "D", "E"], "C" : ["E"], "D":["B"], "E": ["B","C","F"], "F":["E"]})) This should return True False Python PythonDon't delete the code. Fix the error and make sure it runs. #include using namespace std; class Puzzle { public: char arr[4][4] // constructor Puzzle() { char arr[4][2] = {'f', 'k', 's','s'} {'b', 'j', 'o','u'} {'b', 'o', 'b', 'n'} {'x', 'y', 'w', 'y'} } // destructor ~Puzzle() { } // print method void print() { for (int i=0; i> word; if (p.search(word)) cout << "The word is found in the puzzle." << endl; else cout << "The word is not found in the puzzle." << endl; return 0; }SEE MORE QUESTIONSRecommended textbooks for youDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill EducationDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education