Java program
java Questions
1. Write a Java program that uses a for loop to produce the following output:
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, Blastoff!
2. Write a Java program that reads three integers from System.in and prints the largest on
System.out. Use Scanner.nextInt() to read the integers.
3. Write a Java program that prints the following lines on output.
I was printed by Java
I was printed by Java
I was printed by System.out.println(I)
C++ Questions
1. What is printed by the following C++ code?
cout<< ”;
2. If a, b, and c are integer variables, some of these expressions are valid C++ and others are
not. For each expression, add parentheses to indicate the precedence and associative rules,
and hence decide which are valid and which are not. In each case, explain in words the
meaning of the valid expressions, or why the expression is not valid. The first one has been
done for you.
a = b = c;
a == b = c;
a = b == c;
a == b == c;
3. Write a C++ program to read a date in US standard format (mm ddyyyy) and print it in
Australia standard format (dd mm yyyy).