some questions for you to answer and ponder. the sooner, the better...
Kristofer Younger 30a0bcb2f1 Update 'README.md' 6 年之前
README.md Update 'README.md' 6 年之前

README.md

Week-9-Questions

some questions for you to answer and ponder. the sooner, the better... You really should be able to answer these questions easily by the beginning of week 12. These are common Java Interview questions.

A Few Java Questions

  • Name some OOP Concepts in Java?
  • What is meant by platform independence of Java?
  • What is the JVM ?
  • What is the difference between JDK and JVM?
  • What is the difference between JVM and JRE?
  • Which class is the superclass of all classes?
  • Why Java doesn’t support multiple inheritance?
  • Why is Java not a pure Object Oriented language?
  • What is difference between path and classpath variables?
  • What is the importance of main method in Java?
  • What is overloading and overriding in java?
  • Can we overload the main method?
  • Can we have multiple public classes in a java source file?
  • What is a Java Package and which package is imported by default?
  • What are the access modifiers?
  • What is the final keyword?
  • What is the static keyword?
  • What is finally and finalize in java?
  • Can we declare a class as static?
  • What is a multi-catch block in java?
  • What is a static block?
  • What is an interface?
  • What is an abstract class?
  • What is the difference between abstract class and interface?
  • Can an interface implement or extend another interface?
  • What are Wrapper classes?
  • What is an Enum in Java?
  • What are Java Annotations?
  • What is the Java Reflection API? Why it’s so important to have?
  • What is composition in java?
  • What is the benefit of Composition over Inheritance?
  • How can one sort a collection of custom Objects in Java?
  • What is inner class in java?
  • What is anonymous inner class?
  • What is the Classloader in Java?
  • What are different types of classloaders?
  • What is ternary operator in java?
  • What does super keyword do?
  • What are break and continue statement used for?
  • What is the this keyword used for?
  • What is a default constructor? A null constructor?
  • Can we have try block without a catch block?
  • What is Garbage Collection?
  • What is Serialization and Deserialization?
  • How does one run a JAR file through command prompt?
  • What is the use of System class, name an example?
  • What is instanceof keyword?
  • Can we use String with switch case?
  • Is Java a Pass-by-Value or Pass-by-Reference language? Explain the difference?
  • What is the difference between Heap and Stack Memory?

Loops

Describe the features of Java for controlling the repeated execution of a block of code. Show how general uses of for, while and do could all be emulated using only loops that start of while (true).

Exceptions

Describe some circumstances where it is useful for functions to return errors as exception, and some where it is not. Give an example of an algorithm which is simplified by the use of exceptions.

Big Addition

Java comes with a class BigInteger that represents potentially huge numbers. Suppose it did not, or for some reason you were prohibited from using it but still needed to work with large positive integers. To fit your needs you will define a new class called Big that stores integers as arrays of byte values, where each byte holds a single decimal digit from the number being used, with the least significant digit held at position 0 in the array. Write a definition of such a class including in it methods to create a big integer from an int (provided that int is positive), to add two Big values together and to convert from a big to a String ready for printing. You need not implement any other methods unless they are needed by the ones mentioned here.

Lists in Java

A list in Java can be represented as a sequence of links. Each link is an object containing one value in the list and a reference to the rest of the list following the link. A null reference indicates the end of the list. Write a Java class that can represent such lists, where the items stored in lists are of type Object. Provide your implementation with two static public methods that append lists. The first of these should be called append and should take two arguments, its result should be the concatenation of the two lists and neither input should be disturbed. The second should be called conc and should have the same interface, but it should work by altering the final reference in the first list to point it towards the second, and it should thus not need to use new at all.

Some Tiny Questions 1 List the eight Java primitive data types. 2 What is a class? 3 Name the java access modifies for instance variable, classes and methods. 4 What can an abstract class do that an interface cannot? 5 What result will be printed if the following fragment of Java code is executed? Why?

System.out.println(‘h’+’e’+”llo worl”+’d’)

6 What result will be printed if the following fragment of Java code is executed? Why? ```

double d = 6.6; 
try
    { d=1.0/0.0; }
finally 
    {
       System.out.println("d = " + d);
    }
    ```