1 .write c++ program using menu drive using switch to manipulate
case 1 for any user defined function, case 2 for passing argument by reference and value,
case 3 for passing argument by default, case 4 overloading function, case 5 recursive function, case 6 for built function.
2 .write c++ program to play game for dice by guessing the input random by using rand() function using loop.
What will the output of this python program be?
def test_function( length, width, height):
print ("the area of the box is ",length*width*height)
return length*width*height
l = 12.5
w = 5
h = 2
test_function(l, w, h)
Using C# and Visual Studio, design and implement a standalone command-line application that
fulfils the following requirements:
1. The user shall be able to enter the following values:
a. Gross monthly income (before deductions).
b. Estimated monthly tax deducted.
c. Estimated monthly expenditures in each of the following categories:
i. Groceries
ii. Water and lights
iii. Travel costs (including petrol)
iv. Cell phone and telephone
v. Other expenses
Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Write a program that allows Cindy to input the number of shares sold, the purchase price of each share, and the selling price of each share. The program outputs the amount invested, the total service charges, amount gained or lost, and the amount received after selling the stock.
Write a program that prompts the user to input the amount of rice, in pounds, in a bag. The program outputs the number of bags needed to store one metric ton of rice.
Predict the output of the following program?
class Test {
protected int x, y;
}
class Main {
public static void main(String args[]) {
Test t = new Test();
System.out.println(t.x + " " + t.y);
}
}
debug the code for displaying numbers 1 to 10 using dowhile loop.
Class doWhile
{
public static void main(String[] args)
{
int num =1;
do
{
System.out.println(num);
}while(num>=10)
}
}
The following code results in compile time error. Identify the error.
public static void display ()
{
int n =123456;
float f =100.12;
System.out.println(“Float value ” +f);
}
shift numbers -2
given a string, write a program to move all the numbers in it to its start.
input
the input will contain a string A.
output
the output should contain a string after moving all the numbers in it to its start.
explanation
for example, if the given string A is "1good23morning456",the output should be "123456goodmorning",as it contains numbers at the start.
sample input 1
1good23morning456
sample output 2
123456goodmorning
sample input 2
com876binat25ion
sample output 2
87625combination
sum prime numbers in the input
given a list of integers, write a program to print the sum of all prime numbers in the list of integers.
note.one is either prime nor composite number.
input
the input will be a single line containing space separated integers..
output
the output should be a single line containing the sum of all prime numbers from 1 to N
explanation
for example, if the given list of integers are
2 4 5 6 7 3 8
as 2,3,5 and 7 are prime numbers,your code should print the sum of these numbers. so the output should be 17
sample input 1
2 4 5 6 7 3 8
sample output 1
17
sample input 2
65 87 96 31 32 86 57 69 20 42
sample output 2
31