Comment on the following 2 C programs. #include //Program 1 int main() { int a; int b; int c; } #include //Program 2 int main() { int a; { int b; } { int c; }
Q: -. The popular expression "Divide-And-Conquer" refers to a kind of A Top-down design B Object…
A: The popular expression" Divide And Conquer " refers to a kind of :
Q: Question 3: Rewrite the program in Question 2 part a in Java and C#, run them, and compare the…
A: Given: Rewrite the program in Question 2 part a in java and c#, run them and compare the results.
Q: WRITE IN JAVA AND C++ BOTH
A: cpp code and output #include<iostream> using namespace std; int main(){ cout<<"…
Q: reate a program in C++ that will display your name, Birthday, age and gend
A: 1- In this assignment require, take the information from the user and display all the information.…
Q: Computer Science LAB Print a big 'C':(static) ######…
A: the code in c language is below:
Q: Section A: Short Questions (20 marks) 1. What is structure in C? (3 marks) 2. Is there any syntax…
A: Answer to the above question is in step2.
Q: Write C++ program : Write base class that ask the user to enter a complex number and derived class…
A: The programming methodology for the program is given by: Including header files Base class with…
Q: Print a big 'C':(static) ######…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Write static function in C# that displays the following pattern and call it in main function which…
A: Algorithm Static function myPrintFunc() Start Var k, j for k=1 to 3, go to step 4 else to step 6…
Q: Generate target code for the following source language statements: a := b + c*(d-e) + f * (d-e).
A: Actually, given statement : a := b + c*(d-e) + f * (d-e).
Q: Write a short program in C++ to evaluate the Mean and Total class attendance in a week.Use your code…
A: Program #include <iostream> using namespace std; int main() { int week, a[7], total_no; float…
Q: Please solve the following question correctly. Write a C++ program to demonstrate example of default…
A: Constructor are the method whose name is same as the class name and it the first method called when…
Q: Explain the concept of command line arguments with suitable example in C
A: Command line arguments When a program is run, it receives a parameter called a command line…
Q: Create a design of a c programming using c(turbo c) language (a money if possible)
A: C language is a high level programming language and it is the basic language to all high level…
Q: Create a C++ program using classes and objects that determines if the number is prime or not
A: Code #include<iostream>using namespace std;class PrimeNumber { int a, k, i;public:…
Q: What is the output of C Program.? int main() { int a[] = {1,2,3,4}; int b[4] = {5,6,7,8};…
A: Answer is option b. 1,5.
Q: T/F 1. Java interprets a negative value as false and a non-zero value as real, much like the other…
A: True, even in some cases the value 1 is considered as true. All the non-zero values are real and…
Q: 4. C++ Program to build Simple calculator (addition, subtraction, multiplication, division) using…
A: code: #include<bits/stdc++.h>using namespace std;class calculator{ public: int a,b;};int…
Q: Write a C++ program to define the days of the week and a date class. Use a user defined data type…
A: Steps: Take a string array to hold name of months. Take a sting array to hold days of the week.…
Q: Implement the following with one-one C++ program Constructor Destructor copy constructor
A: CONSTRUCTOR: Program code: // C++ program to demonstrate the use of default constructor#include…
Q: C# Programming Create a C# program that has the following methods and corresponding usage. 1.…
A: Answer the above program are as follows:
Q: Need help with example 7, written in c++. Please and thank you
A: Here is the complete code of the example 7, written in c++ #include <iostream>#include…
Q: Print "Hi There I am Programmer" in C++ langauge
A: Please find the answer below :
Q: What is the difference between call by reference and call by address? Explain with C++program
A: Difference between the Call by Value and Call by Reference: A function is a block of statement used…
Q: 7. Rewrite the C program segment of Programming Exercise 4 using if and goto statements in C. j -…
A: goto statement is used to move the execution to a particular block whenever required These are…
Q: Write C++ program to demonstrate example of destructors.
A: Syntax: ~ Constructor name(); What is destructor? Destructor is a member function which…
Q: create a program on c++ Topic - Scientific Calculator
A: Answer: Below are the CPP code that is satisfied your question, I have given the scientific…
Q: 4. Construct a C program source code that builds a triangular shaped pattern as shown in the program…
A: I have provided C CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT---------------------
Q: Write a C++ program to define the days of the week and a date class. Use a user defined data type…
A: Algorithm: 1. Define time variable 2. Define the local time pointer. 3. Print output of…
Q: Convert this C++ program to pep/9 int main(){ int cop; int driver; cop = 0;…
A: Actually, c++ is a general purpose language.
Q: number overload the Operators: ++,--,+,-,/,*, >>, <<).
A: Code #include <iostream>#include <conio.h> using namespace std; class calculator{…
Q: 1. Write a Class in C++ that converts kilometres to miles. 2. Write a Class in C++ to add two binary…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: examples using Lambda Expressions.| Example: 1 public void al0 { System.out printin ("Hi");…
A: parameter->expression for single parameter. parameter1,parameter2->expression for multiple…
Q: Write the general procedure of dynamic programming.
A: Question. Write the general procedure of dynamic programming. Answer. The dynamic programming…
Q: a C++ program using classes and objects that determines if the number is prime or not. wit
A: Create a C++ program using classes and objects thatdetermines if the number is prime or not. with…
Q: Computer Science LAB Print a big 'C':(static) ######…
A: C programming language is the basic programming language, that's used to develop software like…
Q: .8 Define a recursive factorial function in any of the following languages (or in any language for…
A: Code : # Define the rec_fact(num) to Recursively find Factorial of numdef rec_fact(num): #…
Q: int main(){ int cop; int driver; cop = 0; driver = 40; while (cop <= driver) {…
A: The following is the program : __gthread_key_delete(int): str fp, [sp, #-4]! add…
Q: Write a c++ program in abstract class to implement basic arithmetic operations
A: #include <iostream> using namespace std; class Operation { public: //Declare pure…
Q: Write an interesting program to illustrate the concept of self referential class in c++ and display…
A: Write an interesting program to illustrate the concept of self referential class in c++ and display…
Q: 2. Some programming languages have static variables. What are the obvious advantages and…
A: Advantages of having static variables are: Globally Accessible i.e., not tied with any particular…
Q: Computer Science Write a program in either Java or C++ that performs a large number of…
A: #include<iostream>#include<cstdlib>#include<ctime>using namespace std; int main(){…
Q: Define the following keywords' usages with java code example. this super static
A: To be determine: Define with examples this super static
Q: Write a C++ Program To Create Empty Class
A: Given Program is Write a C++ Program To Create Empty Class
Q: A lady behaves like a teacher in a classroom, mother or daughter in a home and customer in a market.…
A: #include <iostream> using namespace std; class Lady { public: void info(){…
Step by step
Solved in 2 steps
- Implement in C programming language Question 1 Write a program in c to detect if the system will face any deadlock in the future. If a deadlock is detected then print “Deadlock Ahead” otherwise print “Safe here”. The situation is given below. (Allowed to use Banker’s Algorithm). Note: The code can be implemented in several different ways, but make sure the parameter remains the same as shown below. n = 5; // Number of processes m = 4; // Number of resources int alloc[5][4] = { { 0, 1, 0, 3 }, // P0 // Allocation Matrix { 2, 0, 0, 0 }, // P1 { 3, 0, 2, 0 }, // P2 { 2, 1, 1, 5 }, // P3 { 0, 0, 2, 2 } }; // P4 int max[5][4] = { { 6, 4, 3, 4 }, // P0 // MAX Matrix { 3, 2, 2, 1 }, // P1 { 9, 1, 2, 6 }, // P2 { 2, 2, 2, 8 }, // P3 { 4, 3, 3, 7 } }; // P4 int avail[4] = { 3,…Write a simple java program with the following specifications: In the main method add the following declarations: int[ ] arr1 = {1,2,3,4,5,6,7,8,9,10}; int[ ] arr2 = {10,9,8,7,6,5,4,3,2,1}; int[ ][ ] arr3 ={{1,2,3},{4,5,6},{7,8,9},{10}}; System.out.print(arr1[0]); Save, compile and run the program. 1: What is the output when you run the program? 2: What is the value of: arr3[arr1[0]][arr2[arr1[8]]] 3: What is the value of: arr3[2][arr1[1]] 4: What is the value of: arr1[arr2[arr1[arr2[3]]]] 5: What is the value of: arr1[x++] 2. Add the following codes at the end of your main method: for(int x=1; x<=5;x++) System.out.print(arr1[5-x]); Save, compile and run the program. 6: What is the output when you run the program? 7: What would be the output if you arr2[5-x] instead of arr1[5-x]; 3.Open the file again and modify add the following codes in the main method: for(int x = 0; x<10; x++) { arr1[x]=arr2[x]; arr2[x]=x; }…Write a simple java program with the following specifications: In the main method add the following declarations: int[ ] arr1 = {1,2,3,4,5,6,7,8,9,10}; int[ ] arr2 = {10,9,8,7,6,5,4,3,2,1}; int[ ][ ] arr3 ={{1,2,3},{4,5,6},{7,8,9},{10}}; System.out.print(arr1[0]); Save, compile and run the program. 2. Add the following codes at the end of your main method: for(int x=1; x<=5;x++) System.out.print(arr1[5-x]); Save, compile and run the program. 3.Open the file again and modify add the following codes in the main method: for(int x = 0; x<10; x++) { arr1[x]=arr2[x]; arr2[x]=x; } System.out.print(arr2[0]); Save, compile and run the program.
- Topic: Concepts of programming Language 4. a) Consider the following JavaScript program: var a, y, c;function sub1() {var b, z, c;function sub2() {var a, b, y;. . .}. . .}function sub3() {var a, x, w;. . .}List all the variables, along with the program units where they are declared,that are visible in the bodies of sub2 when the sequence of function call is:“sub1 calls sub3 and sub3 calls sub2”, assuming dynamic scoping is used.Concepts of programming language Consider the following JavaScript program: var a, y, c;function sub1() {var b, z, c;function sub2() {var a, b, y;. . .}. . .}function sub3() {var a, x, w;. . .}List all the variables, along with the program units where they are declared,that are visible in the bodies of sub2 when the sequence of function call is:“sub1 calls sub3 and sub3 calls sub2”, assuming dynamic scoping is used.Please answer in Java 1. A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design the class Point that can store and process a point in the x-y plane.-We should then perform operations on a point, such as showing the point, setting the coordinates of the point, printing the coordinates of the point, returning the x-coordinate, and returning the y-coordinate. -Write a test program to test various operations on a point. The class Point should contain the following methods and data members: 1. protected members x and y2. default constructors3. constructors with parameters4. setPoint(x)5. getX()6. getY()7. toString()8. equals(x)9. makeCopy(x)10. getCopy()11. printPoint() The output should show the following: -Initialize myPoint = [5.00,4.00]-Initialize yourPoint = [0.00, 0.00]-Print both of these objects-Set yourPoint to [5.00, 45.00] and print it-Determine if the 2 points are equal or not-Change the myPoint coordinates to [6.00, 9.00]-Print this new myPoint…
- first, define the rectangle class which has two functions for calculating area and perimeter. then write a c++ program that in its main function has 2 square objects and calculate their area and perimeter. for each object ask the user to give you the sides.Consider the following JavaScript skeletal program: //The main program var x; function sub1() { var x; function sub2() { . . . } } function sub3() { . . . } Assuming Dynamic scoping, which declaration of x will be used inthe following functions: a) sub1() b) sub2() c) sub3() You can consider the first declaration of x as x1 and the second as x2(For thought) a. What’s an advantage of namespaces? b. What’s a possible disadvantage of namespaces?
- Implement a C++ program for a RESTAURANT that has multiple branches, and each branch has menus of food items, their stock and a list of customers. A branch may have for example a breakfast menu and lunch menu with different food items, and the stock (available quantity) of each food item in the branch. Also, the branch will have a list of regular customers and their contact information to contact them for offers and new food items. Class Names Data and Member Functions Food Data Members: ID, Name, Calories, Price Member Functions: getID, getName, getCalories, getPrice setID, setName, setCalories, setPrice Stock Data Members: ID, Food, Stock Member Functions: getID, getFood, getStock setID, setFood, setStock Customer Data Members: ID, Name, Phone Member Functions: getID, getName, getPhone setID, setName, setPhoe Menu Data Members: ID, Name, foodList Member Functions: getID, getName, getFoodList setID, setName Branch Data Members: ID, Address, menuList, stockList, customerList Member…1)- What is meant by a dynamic array, and write a line of C++ code to create a dynamic array of 10 doubles. 2)-What is a constructor? 3)-What is meant by the prototype method of software development?Please give a full detailed optimized solution in Java 8 for the given problem, use the example code provided as well. Please provide comments and screenshots of code and output. Also, add the time/space complexity and the reason for it.Java 8 Code Example:import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String args[] ) throws Exception { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ } }