Quiz 1 Sectiunea 4 1. When Eclipse launches, the Welcome page displays. Once this page is closed you cannot return to the resources available on this page. True or False? True False (*) 2. Eclipse provides an edit area to help you navigate a hierarchy of information. True or False? True False (*) 3. Eclipse provides views to help you navigate a hierarchy of information. True or False? True (*) False 4. Tabs are used when more than one file is open in the edit area. True or False? True (*) False 5. A perspective is described as: Mark for Review o A combination of views and editors (*) o A combination of views and windows o A combination of editor tabs o None of the above 6. The ______________ is the location onto which you will store and save your files. o Perspective o Workspace (*) o Editor o None of the above 7. A workspace can have one or more stored projects. True or false? True (*) False 8. Identify the components in the image below. A-Main Method, B-Class, C-Package A-Class, B-MainMethod, C-Package A-Package, B-Main Method, C-Class (*) None of the above 9. In Eclipse, when you run a Java Application, the results may be displayed in the Console View. True or False? True (*) False Quiz 2 Sectiunea 4 2. When importing another package into a class you must import the entire package as well as the package classes that will be called. True or False? True False (*) 4. A counter used in a For loop cannot be initialized within the For loop statement. True or False? True False (*) Sectiunea 4 1 1.Which of the two diagrams below illustrate the general form of a Java program? Example A Example B (*) 3. Which of the two diagrams below illustrate the correct syntax for variables used in an if-else statement? Example A (*) Example B 5. The syntax below represents a valid initialization of a For loop counter. True or False? public class ForLoop { public static void main (String args[]) { for (int i=10; i <20; i++)< {System.out.println("i: "+i); } } } True (*) False 7.In a For loop, the counter is automatically incremented after each loop iteration. True or False? True False (*) 8. In an if-else construct, the condition to be evaluated must be contained within parentheses. True or False? True (*) False Quiz 3 Sectiunea 4 1. The six relational operators in Java are: >,<,=,!,<=,>= >,<,=,!=,=<,=> >,<,=,!=,<=,>= >,<,==,!=,<=,>= (*) 2. Determine whether this boolean expression evaluates to true or false: !(3<4&&5>6||6<=6&&7-1==6) True False (*) 3. The three logic operators in Java are: Sectiunea 4 2 !=,=,== &&, ||, ! (*) &&,!=,= &,|,= 4. What will print if the following Java code is executed? 0 3 (*) 4 5 5. What is the difference between the symbols = and == ? The symbol = is used in if statements and == is used in loops. The symbol == is used to assign values to variables and the = is used in declarations. The = is use to assign values to variables and the == compares values. (*) There is no difference. 6. What is the output of the following lines of code? int j=7,k=5,m=8,result; result=j/m*k; System.out.println(result); 0 (*) 4.375 0.175 280 7. What is the output of the following lines of code? int j=7,k=5,m=8,result; result=j-k%3*m; System.out.println(result); 0 16 2 -9 (*) 8. Which of the following is not correct Java code? double x=Math.sqrt(16); double x=Math.pow(3,4)*5.0; double x=Math.PI*5.0; double x=Math.pow; (*) 9. Which line of Java code assigns the value of 5 raised to the power of 8 to a? double a=15^8; double a=Math.pow(5,8); (*) int a=Math.pow(8,5); int a=Math.pow(5,8); double a=pow(8,5); 10. Write a declaration statement that will hold a number like 2.541. char number; int number; float number; (*) boolean number; 11. Which of the following is the name of a Java primitive data type? String int (*) Rectangle Object 12. Which of the following is not a legal name for a variable? R2d2 Sectiunea 4 3 dgo2sleep 4geeks (*) to_be_or_not_to_be 13. Which of the following examples of Java code is not correct? int x=6; double d=4.5; boolean b=1; (*) char c='r'; 14. Which of the following statements correctly assigns "3 times 10 to the 4th power" to the variable number? double number=3*10^4; double number=3(e4); double number=3e4; (*) double number=3*10e4; 15. Which line of code does not assign 3.5 to the variable x? double x=3.5 x=3.5; 3.5=x; (*) x=7.0/2.0; 16. Consider the following: You are writing a class and are using a global variable. Inside a method you declare a local variable with the same name as the global variable. This programming style is poor because inside the method the global variable will have precedence over the local variable with the same name. True or false? True False (*) 17. What will the method methodA print to the screen? 18 (*) 15 6 3 18.Which line of Java code properly calculates the volume of a cone using where r and h are Java primitive integers? double V=1/3*3.14*r*r*h; double V=(double)1/3*Math.PI*Math.pow(r,2)*h; (*) double V=1/3*Math.PI*Math.pow(r,2)*h; double V=(double)1/3*Math.PI*Math.pow(2,r)*h; double V=1/3*3.14*r(2)*h; 19. Given the following declaration: int z=5,m=6; Which line of Java code properly casts one type into another without data loss? double x=(double)z/m; (*) double x=z/m; double x=(double)(z/m); double x= double z/m; Sectiunea 4 4