quiz 3 - solution

quiz 3 - solution - Advanced Programming in JAVA QUIZ 3...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Advanced Programming in JAVA QUIZ 3 Name: Marks: 15 Roll Number: Time: 10 min 1. What will happen when you attempt to compile and run the following code? [1] public class MyClass { int a = 99; public static void main (String args[]) { MyClass mc = new MyClass(); mc.myMethod(); } void myMethod() { int a; System.out.println(a); } } a The value 99 will be output. b The value 0 will be output. c Compile time error d Run time error 2. Which of the following statements are false about a variable created with the static modifier? [2] A. Once assigned, the value of a static variable may not be altered B. Can be used with the name of the class as well as the objects. C. Static modifier can be applied to primitive types only. D. Every instance of the class has a copy of the static variable 3. Java provides implicit down casting but needs explicit up casting. [1] A. true B. false 4. Consider the following: [2] float x[] = new float[100]; float y = x[99] * 12; After execution, which statement or statements are true?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
a. the value of y is 0.0
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/09/2010 for the course CS CS300 taught by Professor Abh during the Spring '10 term at lln.

Page1 / 2

quiz 3 - solution - Advanced Programming in JAVA QUIZ 3...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online