Home / Study library / Programming Concepts using Java / End Term · Jan 2025 Programming Concepts using Java · End Term · Jan 2025 · AN
Programming Concepts using Java · End Term · Jan 2025 AN
← Course papers · Start practice / exam
Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
0 / 25 published solutions
Q94 Q95 Q97 Q98 Q99 Q100 Q101 Q102 Q103 Q104 Q105 Q106 Q107 Q108 Q109 Q110 Q111 Q112 Q113 Q114 Q115 Q116 Q117 Q118 Q119
Question 94 MSQ · 3.0 marks Which of the following statements are correct based on the KKT conditions and the solution to the
optimization problem?
A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q94
Question 95 NAT · 3.0 marks A published solution is not available for this question yet.
Report a correction for Q95
Question 97 MCQ · 4.0 marks A. The code always prints 2000.
B. The code prints any number in the range 1000 to 2000
C. The code prints any number in the range 0 to 1000
D. The code always prints 1000.
A published solution is not available for this question yet.
Report a correction for Q97
Question 98 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q98
Question 99 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q99
Question 100 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q100
Question 101 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q101
Question 102 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q102
Question 103 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q103
Question 104 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q104
Question 105 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q105
Question 106 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q106
Question 107 MCQ · 4.0 marks Consider the code given below.
What will the output be?
A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q107
Question 108 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q108
Question 109 MCQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q109
Question 110 MCQ · 5.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q110
Question 111 MCQ · 5.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q111
Question 112 MCQ · 5.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q112
Question 113 MCQ · 5.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q113
Question 114 MSQ · 4.0 marks Which of the following statements is/are correct regarding garbage collection?
A. The garbage collector frees unused memory in the heap.
B. The garbage collector frees unused memory in the stack.
C. The mark-and-sweep is a common garbage collection technique.
D. The garbage collection eliminates all memory leaks in every situation.
A published solution is not available for this question yet.
Report a correction for Q114
Question 115 MSQ · 4.0 marks Consider the Java code given below.
import java.util.concurrent .ConcurrentHashMap;
class AddItemThread extends Thread {
private ConcurrentHashMap<String, Integer> cart;
public AddItemThread(ConcurrentHashMap<String, Integer> c) {
cart = c;
3
public void run() {
cart.put("item3", 1);
cart.put("item4", 2);
£
}
class ListItemThread extends Thread {
private ConcurrentHashMap<String, Integer> cart;
public ListItemThread(ConcurrentHashMap<String, Integer> c) {
cart = c;
}
public void run() {
for (String item : cart.keySet()) {
System.out.println(item + ": " + cart.get(item));
3
}
public class ShoppingCart {
public static void main(String[] args) {
ConcurrentHashMap<String, Integer> cart = new ConcurrentHashMap<>() ;
cart.put("itemi", 1);
cart.put("item2", 2);
AddItemThread addItemThread = new AddItemThread(cart) ;
ListItemThread listItemThread = new ListItemThread(cart) ;
addItemThread.start();
listItemThread.start() ;
try {
addItemThread. join() ;
listItemThread. join();
} catch (InterruptedException e) {
e.printStackTrace() ;
}
System.out.println("Final Cart: " + cart);
}
Which of the following is true about the given code.
A. B. C. A published solution is not available for this question yet.
Report a correction for Q115
Question 116 MSQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q116
Question 117 MSQ · 4.0 marks A. B. C. D. A published solution is not available for this question yet.
Report a correction for Q117
Question 118 MSQ · 6.0 marks A published solution is not available for this question yet.
Report a correction for Q118
Question 119 MSQ · 6.0 marks Consider the Java code given below.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class TokenSystem extends JFrame implements ActionListener {
JButton btnTakeToken, btnCancelToken;
JLabel label;
JPanel pi, p2;
public TokenSystem() {
pi = new JPanel();
p2 = new JPanel();
btnTakeToken = new JButton("Take Token") ;
btnCancelToken = new JButton("Cancel Token") ;
label = new JLabel("Please select an option");
pi.add(btnTakeToken) ;
pi.add(btnCancelToken) ;
p2.add(label) ;
add(pi, "Center");
add(p2, "South");
btnTakeToken. setActionCommand("TakeToken") ;
btnCancelToken.setActionCommand("CancelToken") ;
btnTakeToken. addActionListener (this) ;
btnCancelToken.addActionListener (this) ;
setSize(350, 150);
setVisible(true) ;
3
public void actionPerformed(ActionEvent e) {
// CODE SEGMENT
B
z
public class HospitalQueue {
public static void main(String[] args) {
new TokenSystem() ;
BF
i
A. B. C. D.
**Appdev2**
**Section Id :** 64065387636
**Section Number :** 6
**Section type :** Online
**Mandatory or Optional :** Mandatory
**Number of Questions :** 31
**Number of Questions to be attempted :** 31
**Section Marks :** 100
A published solution is not available for this question yet.
Report a correction for Q119