Qno. 1 () Construct a program where implicit conversion would have been done. ii) Construct a program where you declare and initialize a constant variable, now try to reassign some value to that variable and notice what happens.
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Here I have taken input from the user. Next, I have taken a while loop, and inside the loop, I have…
Q: 2.2 what is the value of S1, S2 and S3 where S1, S2 and S3 type is float and each one is equal the…
A: Given: x=4, y=10, w=-10 ceil() = returns the nearest integer greater than the argument passed sqrt()…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Errors in program: Variable “i” which is used for loop traversing is not declared. This error is…
Q: erm is ude by CodeChum Admin Construct a class called Term. It is going to represent a term in…
A: According to the question Here I have created the class named Term In this class, I created a…
Q: Consider the following C++ code: int* length = new int; int* height = new int; *height = 12;…
A: Step 1:- Introduction:- The pointer is a variable that stores the address of another variable.…
Q: 4.main(){ int i,j; long int f=1; for (i=1, i< 10; i++) f=f*i; } prinf(“%ld",f);}
A: Factorial Program in C: Factorial of n is the product of all positive descending integers. Factorial…
Q: 10.25 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3…
A: The above code is solved using Python Language below:
Q: Example 05 Assume the definitions and initializations: char c = 'T', d = 'S'; char "pl = &c; char…
A: The output of the program is given in step 2.
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Introduction :
Q: Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression…
A: Since you have not specified what needs to be done in else part so we have included a print…
Q: int i = 0; i < a.ler [1] = a[(a[i] + 3)
A: Dear Student, Here array a contains 5 elements thus length of a is 5 and a.length is 5 , based on it…
Q: 7. Implement the complex number ADT in C++ using a class. The complex ADT is used to represent…
A: Note: As you have asked multiple part questions, as per our policy, we will solve the first three…
Q: T/F 4. The assertion is a legal stumbling block.
A: Given that, The assertion is a legal stumbling block.
Q: 1- What does the following lines of code do? A=[2 3 1 5 8 96 7 11 41; ind=find (A>8I A<3); 2- If the…
A:
Q: Tasks: 1. Construct a program where implicit conversion would have been done. 2. Construct a program…
A: 1) Code: #include <iostream>using namespace std; int main() { // assigning an int value to…
Q: Predict what the following code will do. Write a rationale as to why the code will do what you…
A: In general the variables i1, i2 and i3 are allocated consecutive memory locations Let's see what…
Q: (define (add-one x) (+ x 1)) Add the following lines in the above statements and give the…
A: Getting started in DrRacket DrRacket supports a number of different dialects of Scheme, and it's…
Q: f a memory cell of 5 has an 8 value, how is the difference between entering the 5 value to cell…
A: Given statement syas that if a memory cell of 5 has an value, how the difference between entering…
Q: Create a class “name” with two data members: one for the first name (String) and one for the surname…
A: #include<iostream> #include<string> using namespace std; A) class name{ pubic:…
Q: Write assignment statements for the following: Assign a value of 1 to between if n is in the range…
A: The answer is as follows:-
Q: Step #1: Create a function to output the values of an integer array. You will have two parameters:…
A: As per Bartleby guideline: “Since you have posted a question with multiple sub-parts, we will solve…
Q: 1. Examine the following code: After this code executes, what is the value of x? y? 2. Examine the…
A: 1) When the value of x = 9 and y = ++x Code ( in java ) - public class Main{ public static void…
Q: b) The following code fragment passes data by reference. Convert it to the one that passes data by…
A: #include <bits/stdc++.h> using namespace std; void exponen(double num); // Declaration the…
Q: Q4. Read the following program and answer the questions given at the end. class Example { Example…
A: Q1: A data member belongs to an object of a class whereas local variable (int a, int z, int n)…
Q: C++ Assume the following declaration: vector* ages; Which statement is syntactically correct?…
A: syntactically c++ vector code from give syntax of code.
Q: Assume int i[5] ={2,3,4,5,7}; Does the following statement work (yes/no)? cout << i…
A: A statement cout << i << endl; is meant to print the 5 numbers stored in the array i.…
Q: The word limit for this explanation is 350.
A: Final variable: ==>In general we represent a variable as final variable using "final" keyword.…
Q: Explain the different between a pointer variable and other variables such as int, float, char. You…
A: Introduction of Pointer Variable: In the programming language, the pointer variable stores the…
Q: Assume bool foundPair and int pairCount are both declared and have valid values. if (foundPair)…
A: Here foundPair is boolean variable so it can hold either true or false value. The if statement in…
Q: isplaying a Sentence with Its Words Reversed
A: Program structure Include header files <stdio.h> and <string.h> to perform input/output…
Q: Assuming the following declarations, write C++ expressions to set all integer values of b’s members…
A: Given: //structure A struct A { //structure data m1 int m1[2]; } //structure B struct B { //…
Q: 1) State whether the following declarations are valid or invalid. Give reasons for the invalid…
A: According to the guidelines i can answer only first 3 parts
Q: (Counting the Number of Words in a String) Write a program that inputs several lines of t ext and…
A: A C program is as follows, File name: “main.c” #include <stdio.h> #include <string.h> //…
Q: Command Line Arguments
A: We can provide 2 command line arguments in double format and use Double.parseDouble for parsing the…
Q: Explain the difference between the following :Passing value by reference, Passing value by…
A: Passing information from calling function (Method) to the called function (method) is known as…
Q: Write C++ statement(s) to allocate space for 10 doubles (using dynamic memory allocation).
A: new is used to allocate space dynamically. syntax: new data-type; statement to allocate space for…
Q: 5.14 For each of the following sets of integers, write a single statement that will print a number…
A: a) Program code: //import required data package import java.util.Random; //main class public…
Q: PLEASE USE JAVA Equivalence Class Software Testing Question: A function foo has k integers…
A: Given The answer is given below
Q: #include void f(int a[]) { int i; for (i=0; i<3; i++) a[i]+=i; } main() { int i,a[] f(a); for (i=0;…
A: The output of the c program will be 10 21 32
Q: Create union floating point with members float f, double d and long double x. Write a program that…
A: Below is the required C program: - Approach: - Include the header files. Create the union…
Q: 1. Consider the following statements: DATAENDFLAG is off; ERROR equals 0; and SUM is less than 1024.…
A:
Q: 1. Examine the following code segment. What will be printed?If there are any errors indicate the…
A: The given C++ code segment is: int a[8] ={16, 12, 10, 7, 15, 18, 17, 29}; int *ptr ; ptr = & a[…
Q: 2. Modular arithmetic Write a function that returns the result of any integer modulo of n (i.e.,…
A: Actually, function is a group of statements. The given information is: /* precondition: n is greater…
Q: 3. Write a JavaScript function to calculate the circumference of the circle, note that pi=3.14 and…
A: Actually, JavaScript is a programming language for the web.
Q: Problem 2 A number in base 2 (binary) is a number such that each of its digits is 0 or 1. To convert…
A: Introduction :
Q: Generate the Three Address Code for the following void main( ) {int a; a = 2 + a; Print(a); }
A: The syntax of the three address code is shown below. operand = operand operator operand; Example:…
Q: in C For each of the following, write a single statement that performs the indicated task. Assume…
A: Actually, pointer is a variable whose value is address of another variable. syntax type *var_name;
Step by step
Solved in 3 steps with 2 images
- 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. Solve the full question in c language without using pointers1.4 An abstraction allows programmers to say more with less in their code. Justify this statement with two examples.4.18 Password requirements (JAVA) Websites commonly require a password that satisfies several requirements. Write a program in java that checks if an input string satisfies the following (error message is shown for each): At least 8 characters (Too short) At least one letter (Missing letter) At least one number (Missing number) At least one of these special characters: !, #, % (Missing special) Output OK, or all related error messages (in above order). If the input string is "Hello", the output is: Too short Missing number Missing special Hints: Declare a boolean variable for each requirement. Use a for loop to visit each character, setting the corresponding boolean to true if satisfied (length is done differently though). Use the functions Character.isLetter() and Character.isDigit() to detect if a character is a letter or a number. this is what i was able to do so far ......... Code starts here: import java.util.Scanner;public class Main { public static void…
- Python 3.7.4 Given that add, a function that expects two int parameters and returns their sum, and given that two variables, euro_sales and asia_sales, have already been defined: Write a statement that calls add to compute the sum of euro_sales and asia_sales and that associates this value with a variable named eurasia_sales.PLEASE USE JAVA Equivalence Class Software Testing Question: A function foo has k integers as input arguments, i.e., foo(int n1, int n2, …, int nk). Each argument may belong to a different equivalence class, which are stored in an Eq.txt file. In the file, the nth row describes the nth input. Take the second row for example. The data 1, 10; 11, 20; 21, 30 indicates that n2 has three equivalence classes separated by the semi-colons. There is an internal method “int check(int n)” that returns the equivalence class n is in. The result of check(n2 = 3) will be 1 and check(n2 = 25) will be 3. Regarding the function foo, it computes the sum of the returned values by the check function for all input arguments. Follow the Eq.txt file to automatically create test cases for Strong Normal Equivalence class testing. The input argument values are randomly generated. Store your prepared test cases to a test.txt file. Each test case comes with an expected output at the end. All values are delimited…10 - In an examination, 500 students appeared. Out of these students, 38 % got A+ grade, 45 % got B+ and the remaining just passed. Assuming that no student failed, find the number of students who got A+, B+ and the number of students who just passed.(Python code)
- 5.21 In Python: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is: 1913 is not a leap year. Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise.def is_leap_year(user_year)Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression whose value is true if and only if C is what is called a whitespace character. (that is a space or a tab or a newline-- none of which result in ink being printed on paper) When I attempted it myself, MyProgrammingLab said that I "almost certainly should be using or."def integer_0_or_1(interger): #if value is true return 1 if truth_value: return 1 else: #else return 0 return 0def truth_value(integer): """Convert an integer into a truth value.""" # Convert 0 into False and all other integers, # including 1, into True if integer == 0: truth_value = False else: truth_value = True return truth_value print(truth_value(True))print(truth_value(False)) This question assesses Block 2 Part 4. It assumes an understanding of binary notation and truth tables (Block 1 Part 1). Write a function and_binary(), which takes two integers (each is either 0 or 1) and returns an integer in accordance with the truth table: A B and_binary(A, B) 0 0 0 0 1 0 1 0 0 1 1 1 Before you dive into writing your function, first decompose the problem. Then, write an algorithm. Only after that, implement your solution in Python. Hint: When you have decomposed the…
- In C++build a program to read that data with the following promptsa-) Create a class “name” with two data members: one for the first name (String) and one for the surname (String). The last name must be a pointer to char, the first name construct it as you prefer.b-) Create a grade class to store a subject name (String) and a grade (floating).c-) Create a class "student" that inherits from the class "name" and by composition can store the student's grades (consider that the maximum possible grades will be 6).d-) Create a group class to store the data of several students (consider a maximum of 10 students)e-) Develop a method that returns the average of the group of students.f-) Develop a method that returns the average of a student given his name and surname.g-) Develop a method that returns a list of students who have failed a subject (less than 6.0 points) given the name of the subject.h-) Develop a method that returns the first and last name of the student with the lowest…Generate the Three Address Code for the following void main( ) {int a; a = 2 + a; Print(a); }Describe how memory allocation is done to objects and also develop a C++ programfor employee class with following attributes such as Employee ID, Employee Name,Designation and Salary. Program should sort and display the list of employees inascending order of their salaries using object as a function argument. (Note:Employee ID must not be inputted by the user i.e., auto incremented.)