All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
computer science
advanced java programming
Questions and Answers of
Advanced Java Programming
Describe with examples the syntax of jcmd command.
Which of the following is the correct form of a Java file name?(a) .java(b) Java.(c) _java(d) Java_
Which of the following features is not supported by Java?(a) Abstraction(b) Pointer(c) Polymorphism(d) Inheritance
Demonstrate how jcmd can be used as flight recorder command.
The jdb is used to(a) Create a jar archive(b) Debug a Java program(c) Create C header file(d) Generate Java documentation
What is the full form of jhat?
The jar is used to(a) Create a jar archive(b) Debug a java program(c) Create C header file(d) Generate Java documentation
What is the function of jhat command?
What is the meaning of jar?(a) Java ARchive(b) Java ARray(c) Java ARchitecture(d) Java Advanced Routine
How do you obtain a JVM dump file?
Match the following.(i) Java 1) is a tool for debugging Java program(ii) Javah 2) is a tool for creating C-like header files(iii) Javap 3) runs java bytecode(iv) Jdb 4) prints Java code
What is the function of jdb?
JVM is a(a) Debugger(b) Assembler(c) Compiler(d) Interpreter
Demonstrate how jdm can be used in step by step program debugging.
Bytecode is given as input to(a) Linker(b) Assembler(c) JVM(d) Compiler
What is the purpose of debugging?(a) Developing software(b) Editing software(c) Removing errors from code(d) All of the above
The class at the top of exception class hierarchy is(a) ArithmeticException(b) Throwable(c) Class(d) Exception
What is the difference between throw and throws keyword?
What do you mean by exception propagation?
An exception thrown from outside try block will(a) Return the program normally(b) Be ignored(c) Terminate the program(d) None of the above
What are the two types of exceptions in Java? What are the differences between them?
Which of the following causes an exception(a) A run-time error(b) A hardware malfunction(c) An operating system problem(d) A syntax error
Why do you use multiple catch blocks?
When does exception occur in Java?(a) At compilation time(b) At run time(c) Any time(d) None of the mentioned
How will you write new exception classes?
Which of these keywords is not a part of exception handling?(a) Try(b) Catch(c) Finally(d) Thrown
What is the difference between ‘Exception’ and ‘error’ in Java?
Which of the following keywords is used to examine exceptions?(a) Try(b) Catch(c) Finally(d) Throw
Describe the principle of ‘finally’ block.
Which of the following keywords is used to handle exception?(a) Try(b) Catch(c) Throw(d) Throws
What happens if an exception is not caught?
Which of the following keywords is used to throw an exception explicitly?(a) Try(b) Catch(c) Throw(d) Throws
Describe the exception hierarchy in Java
The key words used with exception handling are:(a) Try, catch, handle(b) Try, hold, finally(c) Throw, catch, conclude(d) Try, catch, finally
What is the difference between ClassNotFoundException and NoClassDefFoundError?
Arithmetic Exception is(a) A checked exception(b) An unchecked exception(c) An error(d) None of the above
What are the advantages of using exception handling?
Which of following exception is thrown by the int z=2/0;?(a) ClassNotFoundException(b) NullPointerException(c) ArithmeticException(d) SecurityException
Why are Errors not checked?
Checked exceptions are processed by(a) Java compiler(b) Java interpreter(c) Both (a) and (b)(d) None of the above
Why are Runtime Exceptions not checked?
Unchecked exceptions are processed by(a) Java compiler(b) Java interpreter(c) Both (a) and (b)(d) None of the above
What is meant by ‘re-throwing’ an exception? How do you re-throw an exception?
Which one of the following statements is correct?(a) The ‘try’ block must be followed by a ‘catch’ block.(b) The ‘try’ block must be followed by a ‘finally’ block.(c) The ‘try’
Write some important methods of Exception Class?
Creating an exception object and handling it to the run time system is called(a) Exception handling(b) Catching exception(c) Passing exception(d) Throwing exception
What is the usefulness of multiple catch blocks?
Which of the following is an example of runtime exception?(a) FileNotFoundException(b) IOException(c) IllegalClassFormatException(d) ClassCastException
What is the use of throws keyword?
Which of the following is the super class of all exception classes?(a) Exception(b) Throwable(c) RuntimeException(d) IOException
When do you use a catch block and when do you use a finally block?
Which of the following blocks gets executed compulsorily whether exception is caught or not?(a) Finally(b) Throw(c) Throws(d) Catch
Write some example scenarios when finally block is not executed.
Which of the following is true of the object thrown by a throw clause?(a) It must be an Exception type(b) It must be a Throwable type(c) It must be an Error type(d) It must be a String type
Which of the following methods is used to print the description of an exception?(a) TraceException()(b) PrintStackTrace()(c) PrintDescription()(d) PrintStack()
Which of the following exceptions is thrown if an array element is accessed beyond the array
Which of the following is true when we write custom exception classes?(a) Extend the class Exception(b) Create our own try and catch block(c) Use finally block(d) Use throws keyword
Predict the output of the following Java program.(a) Exception 2(b) Exception 0(c) Compilation Error(d) None of the above class Test { public static void main(String args[]) { try { } M throw 2;
Which of the following is true about the Error and Exception classes?(a) The Error class is final and the Exception class is not.(b) The Exception class is final and the Error is not.(c) Both
What will be the output of the program?(a) Compilation error(b) Finished(c) Exception(d) Arithmetic Exception public class Test { public static void main(String[] args) { try { } } int x = 0; int y =
What will be the output of the following program?(a) Before End(b) Before Inside(c) Inside End(d) Before Inside End public class Test{ public static void main(String args[]) { System.out.print
Which of the following is thrown by the read() method of InputStream class?(a) Exception(b) FileNotFoundException(c) ReadException(d) IOException
What causes an IllegalMonitorStateException?(a) Two threads call a static synchronized method at the same time.(b) A thread invokes wait() on an object that is already waiting.(c) A thread invokes
In Java, a thread can be created by(a) Extending the Thread class(b) Implementing Runnable interface(c) Both (a) and (b)(d) None of these
What are the differences between a process and a thread?
Which one of the following methods is used to start a thread execution?(a) Run()(b) Init()(c) Resume()(d) Start()
What are the benefits of multi-threaded programming?
When a class extends the Thread class, it should override __________ method(a) Start()(b) Init()(c) Execute()(d) Run()
Show the different ways we can create threads in Java with their relative merits and demerits.
Which two are valid constructors for Thread?(i) Thread()(ii) Thread(Runnable r, String s)(iii) Thread(Runnable r, ThreadGroup g)(iv) Thread(String s, ThreadGroup g)(v) Thread(int priority)(a) (i) and
Which three are methods of the Object class?(i) Sleep(long ms); (ii) Notify(); (iii) Is Interrupted(); (vi) Wait(long ms);(v) Interrupt();(vii) Notify All();(iv) Synchronized();(a) (i), (vi),
Explain the life cycle of a thread in Java.
Explain with example inter-thread communication techniques.
Consider the following class declaration: class X implements Runnable {/*...*/} Which of the following code segments is used to start a new thread?(a) New Thread(new X()).start();(b) New
How do you make a method synchronized? How does it differ from a non-synchronized method?
Which of the following methods cannot directly cause a thread to stop executing?(a) SetPriority()(b) Wait()(c) Notify()(d) Interrupt()
Discuss the relative advantages and disadvantages of synchronized methods and synchronized blocks.
Which of the following methods causes a thread to stop executing?(a) Wait()(b) Stop()(c) Terminate()(d) Pause()
What is a deadlock? How does it differ from starvation?
Which of the following methods is used to release the CPU voluntarily?(a) Release()(b) Suspend()(c) GiveUp()(d) Yield()
How will you say that a program may suffer from a deadlock?
Which of the following methods must be implemented in a class that implements Runnable interface?(a) Start()(b) Run()(c) Execute()(d) Call()
What is the difference between yield and sleeping?
Which of the following types is used to represent thread priority in Java ?(a) Float(b) Double(c) Int(d) Long
What is the output of this program?(a) Thread[main,5,main](b) Thread[5,main](c) Thread[main,0](d) Thread[main,5] class Test { public static void main(String args[]) { Thread t = Thread.currentThread
What is race condition? How will you find and solve race condition?
How does thread synchronization occur inside a monitor?
What is the default thread priority used in Java?(a) 0(b) 1(c) 5(d) 10
How can we pause the execution of a Thread for a specific time?
Which of the following constants is used to represent the default priority of a thread?(a) DEF_PRIORITY(b) DEFAULAT_PRIORITY(c) NORM_PRIORITY(d) NORMAL_PRIORITY
What do you understand about Thread Priority?
The isAlive() method is used to(a) Know whether a thread is running or not(b) Know whether a thread was created or not(c) Restart a thread after stopping it(d) Resume a thread after blocking it
What happens when we make a static method synchronized?
Which of the following keywords are used to make a method synchronized?(a) Atomic(b) Block(c) Synchronized(d) Unit
What is the function of join( ) method? Write a real world program that uses join() method.
Which of the following is the priority range in Java?(a) 1–10(b) 0–9(c) 5–10(d) 1–5
Write a Java program to solve the producerconsumer problem in Java?
Which of the following statements is false?(a) The sleep() method should be enclosed in try-catch block(b) The yield() method should be enclosed in try-catch block.(c) A thread can be temporarily
Write a program which will result in deadlock.Now fix the deadlock in your program.
What happens if two threads having same priority are started?(a) The thread whose name lexicographically precedes the other is executed first.(b) Both of them will be executed
Showing 1100 - 1200
of 1226
1
2
3
4
5
6
7
8
9
10
11
12
13