AmbitionBox

Discover Best Places to work in India

Java Programming

Java Programming Questions and Answers

Showing 1 - 10 of 27 questions

1

Which of these class is used to make a thread?

a

String

b

System

c

Thread

d

Runnable

correct answer c
2

Which of these interface is implemented by Thread class?

a

Runnable

b

Set

c

Connections

d

Mapconnections

correct answer a
3

Which function of pre defined class Thread is used to check weather current thread being checked is still running?

a

isAlive()

b

Alive()

c

isRunning()

d

Join()

correct answer a
4

What is the output of this program?

classmultithreaded_programing{
        publicstaticvoidmain(String args[]){
            Thread t = Thread.currentThread();
            t.setName("New Thread");
            System.out.println(t);        
        }
    }
a

Thread[5,main]

b

Thread[New Thread,5]

c

Thread[main,5,main]

d

Thread[New Thread,5,main]

correct answer d
5

What is the priority of the thread in output of this program?

classmultithreaded_programing{
        publicstaticvoidmain(String args[]){
            Thread t = Thread.currentThread();
            t.setName("New Thread");
            System.out.println(t.getName());        
        }
    }
a

main

b

Thread

c

New Thread

d

Thread[New Thread,5,main]

correct answer c
6

What is the name of the thread in output of this program?

classmultithreaded_programing{
        publicstaticvoidmain(String args[]){
            Thread t = Thread.currentThread();
            System.out.println(t.getPriority());        
        }
    }
a

0

b

1

c

4

d

5

correct answer d
7

Which methods are utilized to control the access to an object in multi threaded programming

a

Asynchronized methods

b

synchronized methods

c

Serialized methods

d

None of these

correct answer b
8

Which of the following is used to force each thread to reconcile its working copy of a variable with the master copy in main memory?

a

Synchronized 

b

transient

c

volatile

d

native

correct answer c
9

What is multithreaded programming?

a

It’s a process in which two different processes run simultaneously.

b

It’s a process in which two or more parts of same process run simultaneously.

c

Its a process in which many different process are able to access same information.

d

Its a process in which a single process can access information from many sources.

correct answer b,c
10

Thread priority in Java is?

a

Integer

b

Float

c

double

d

long

correct answer a,b
Select a company to compare with

vs

Similar Companies