Quiz Space

Java End Term: 11 December 2022, Set ETD1 (September 2022 term)

Question 1

+4 marksOne correct option
  1. A
  2. B
  3. C
  4. D

Question 2

+4 marksOne correct option

Consider the code given below.

java
class Enquiry{
int available = 1;
public synchronized void request(int n, String name){
if(available >= n){
available = available - n;
System.out.println(name + " booked " + n + " ticket");
}
else{
System.out.println(name + " cannot book " + n + " ticket");
}
}
}
class TicketBooking implements Runnable{
Enquiry e;
String name;
int n_tickets;
public TicketBooking(Enquiry e1, String n, int t){
// constructor
}
public void run(){
e.request(n_tickets, name);
}
}
public class Test{
public static void main(String[] args){
Enquiry obj = new Enquiry();
TicketBooking tb1 = new TicketBooking(obj, "Sita", 1);
TicketBooking tb2 = new TicketBooking(obj, "Raju", 1);
Thread t1 = new Thread(tb1);
Thread t2 = new Thread(tb2);
t2.start();
t1.start();
}
}

Which of the following options is/are possible result/s of the above code?

  1. A
  2. B
  3. C
  4. D

Question 3

+4 marksOne correct option

Consider the code given below.

java
interface Displayable{
void display();
}
abstract class Delivery implements Displayable{
public abstract void deliver();
}
class Fpkart extends Delivery{
public void display() {
System.out.println("Fpkart display");
}
public void deliver() {
System.out.println("Fpkart delivery");
}
}
class Amzn extends Delivery{
public void deliver() {
System.out.println("Amzn delivery");
}
public void display() {
System.out.println("Amzn display");
}
}
public class User {
// CODE BLOCK
public static void main(String[] args) {
showDetails(new Fpkart());
showDetails(new Amzn());
}
}

Choose the correct option to fill in place of CODE BLOCK so that the output is:

Fpkart delivery
Fpkart display
Amzn delivery
Amzn display

  1. A

    12 9 6 3

  2. B

    9 6 3 0

  3. C

    10 7 4 1

  4. D

    7 4 1 0

20 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Java End Term 11 Dec 2022 Set ETD1 paper

The IIT Madras BS Programming Concepts using Java (Java) End Term paper sat on 11 Dec 2022, in the September 2022 term, set ETD1: 23 questions for 100 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureJava End Term 11 Dec 2022 Set ETD1 at a glance
TermSeptember 2022 term
SubjectProgramming Concepts using Java
Course codeBSCS2005
Questions23
Marks100
Duration180 min
MCQ20
MSQ3
Official paperIIT M DIPLOMA AN1 EXAM ETD1 11 Dec 2022
Negative markingNo negative marking.
Updated

Other sets that day

Same End Term, other subjects

More Java