You are on page 1of 26

21:41 wom A 299 Heo “Gil al 98% Caw

Q = @ -e.swayam2.ac.in +@® }
Week1 Assesment
The due date for submitting this assignment has passed.
Bue on 2022-10-16, 23:59 IST.

Assignment submitted on 2022-10-16, 16:55 IST


1) Which feature of OOPs describes reusability of code? 7 point

Abstraction
Inheritance
Encapuslation

Polymorphism

Yes, the answer is correct.


Score: 1
Accepted Answers:
Inheritance

2) Which are the features of OOPS describes security of data fram outside of Inference? 7 point

Abstraction

Inheritance
Encapuslation

Polymorphism

No, the answer is incorrect.


Score: 0
Accepted Answers:
Abstraction

3) Output of java compiler is highly optimized set of instructions which is designed to be executed by JVM State true or false? T point

True
False
Yes, the answer is correct.

Accepted Answers:
True

4) File extension of output of java compiler is T point


java

class

Obj

ONE
Yes, the answer is correct
Score: 1
Accepted Answers:
.class

5) Which feature exhibits cross platform execution? T point


Inheritance
Bytecode

Polymorphism

Abstraction
‘Yes, the answer is correct
Score: 1
Accepted Answers:
Bytecode

6) Which feature supports to invoke the methods across the network? 7 point

JVM
JIT
RMI
JAR
Yes, the answer is correct.
Score: 1
Accepted Answers:
RMI

7) Java support dynamically typed languages. State true or false? T paint

True
False
Yes, the answer is correct.
Score: 1
Accepted Answers:
False

8) How many bits of memory occupied by char variable? T point

2
16
4

= O
21:41 “Som AX $99 Heo Sal il 98% ow
3) Output of java compiler is highly optimized set of instructions which is designed to be executed by JVM State true or false? T point

True
False
Yes, the answer is correct.
Score: 1
Accepted Answers:
True

4) File =tension of output of java compiler is 7 point

java

class
Obj

BNE
Yes, the answer is correct
Score: 1
Accepted Answers:
class

5) Which feature exhibits cross platform execution? 7 point

Inheritance
Bytecode

Polymorphism

Abstraction
Yes, the answer is correct
Score: 1
Accepted Answers:
Bytecode

6) Which feature supports to invoke the methods across the network? 1 paint

JVM
JIT
RMI
JAR
Yes, the answer is correct.
Score: 1
Accepted Answers:
RMI

7) Java support dynamically typed languages. State true or false? T paint

True
False
Yes, the answer is correct.
ore: 1
Accepted Answers:
False

8) How many bits of memory occupied by char variable? 1 point

2
16
4
3

‘Yes, the answer is correct.


ore: 1
Accepted Answers:
16

9) What Kind of code to represent character


in java? 7 point

ASCIl
UNICODE
BYTECODE
ENCODE
Yes, the answer is correct.
Score: 1
Accepted Answers:
UNICODE

10) Which kind of variable shared by all the instances of the class? 7 point

Local variable
Global variable

Instance varible
static variable
Yes, the answer is correct.
Score: 1
Accepted Answers:
Static variable
A
I

O
21:43 wom XQ 299 Heo 4Sal wil 98%
® Quiz: Week! Assesment
® Quiz: Week 2 and Week 3 Assesment

Classes - Objects - Constructors

Exception Handling, Threads, String, StringTokenizer, Dictionary, System, Hashtables, |O Package and
FileStreams

Applets - Basics, Life cycle, Graphics Methods and AWT Controls

Event Handling

Week 2? and Week 3 Assesment


The due date for submitting this assignment has passed.
Due on 2022-10-16, 23:59 IST.

Assignment submitted on 2022-10-16, 16:59 IST


1) Type of operators decided by ——-— 7 point

on which datatype it works

number of operators
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
number
of operators

2) Modulus operator can be work on float datatype. state true or false? 7 point

tue
false
Yes, the answer is correct.
Score: 1
Accepted Answers:
tue

3) Find out short circuit operator? 1 point

+
*

aa
f
Yes, the answer is correct
Score: 1
Accepted Answers:
4a

4) Find out the operator to check the object reference? T point

dot operator

arrow operator
instance of
modulus operator

Yes, the answer is correct


Score: 1
Accepted Answers:
instance of

5) We can create array without name. State true or false? 1 point

false
tue
Yes, the answer is correct.

Accepted Answers:
tue

6) Which language supports jagged arrays? T point

c
cH
Java
All the above
Yes, the answer is correct.
Score: 1
Accepted Answers:
Java

7) Changes made on source array does not reflects its cloned array. State true or false? 1 point

tue
false
Yes, the answer is correct
Score: 1
Accepted Answers:
tue
A
I

O
21:43 Som A ae tf o Sil tl 98% Go)

Q = @ -e.swayam2.ac.in + @
3) Find out short circuit operator? 1 point
+
*

aa
f
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
a

4) Find out the operator to check the object reference? 1 point


dot operator

arrow operator

instance of
modulus operator

Yes, the answer is correct.


Score: 1
Accepted Answers:
instance of

5) We can create array without name. State true or false? 1 point


false
tue
Yes, the answer is correct
Score: 1
Accepted Answers:
tue

6) Which language supports jagged arrays? T point


Cc
GH
Java
All the above
Yes, the answer is correct.
Score: 1
Accepted Answers:
Java

7) Changes made on source array does not reflects its cloned array. State true or false? T point
tue
false
Yes, the answer is correct.
Score: 1
Accepted Answers:
tue

8) Identify the statement that helps the programmer to bypass the current iteration? 1 point

break
goto

continue
loop

Yes, the answer is correct.


Score: 1
Accepted Answers:
continue

9) How do you determine the number of elements in an array given int buses] = new int[5];? 1 point

buses.length

buses.length()
buses.size
buses.size(}

‘Yes, the answer is correct.


Score: 1
Accepted Answers:
buses.Jength

10) Which is not a true statement about an array? 1 point

An airay expands automatically when itis full.

An array is allowed to contain duplicate values.

An airay understands the concept of ordered elements.

An airay uses 4 zero index to reference the first element,

Yes, the answer is correct.


Score: 1
Accepted Answers:
An array expands automatically when it is full,

i O
21:50 “om A Os ¥ o Gal tl 97% Go:

Week4 and Week5 Assessment


The due date for submitting this assignment has passed.
Due on 2022-10-32

Assignment submitted on 2022-10-23, 22:09 IST


1) Inclass, ds are represent the state of an object. Say true or false?

true
false

Yes, the answer is correct.


Score: 1
Accepted Answers:
true

2) Which operator is used to access the member in one class?

re

>

Yes, the answer is correct.


Score: 1
Accepted Answers:

3) How many ways to initialize the obkect?

4
1

3
2

Yes, the answer is correct.


Score: 1
Accepted Answers:
3

4) ——-is called instance ofa class?

class definition
object

method
data

Yes, the answer is correct.


Score: 1
Accepted Answers:
object

5) Which operator is used to create object for one class?

@
Yes, the answer is correct.
Score: 1
Accepted Answers:
new

6) Different methods with common name but differed in input parameters?

overriding

overloading

virtual

class

Yes, the answer is correct.


Score: 1
Accepted Answers:
overloading

7) When does method overloading is determined?

At run time
At compile time

At coding time

At execution time

oe te ee eee

i O
21:50 “om A 8 Mo a || all 97%

4) ——~is called instance ofa class?

class definition
object

method
date

Yes, the answer is correct.


Score: 1
Accepted Answers:
object

5) Which operator is used to create object for one class?

Yes, the answer is correct.


Score: 1
Accepted Answers:
new

6) Different methods with common name but differed in input parameters?

overriding

overloading

virtual
class

Yes, the answer is correct.


Score: 1
Accepted Answers:
overloading

7) When does method overloading is determined?

At run time
At compile time

At coding time

At execution time

Yes, the answer is correct.


Score: 1
Accepted Answers:
At compile time

8) When Overloading does not occur?

More than one method with same name but different method signature and different number or type of parameters

More than one method with same name, same signature but different number of signature

More than one method with same name, same signature, same number of parameters but different type

More than one method with same name, same number of parameters and type but different signature

Yes, the answer is correct.


Score: 1
Accepted Answers:
More than one method with same name, same number of parameters and type but different signature

9) Which of the following is 4 type of polymorphism in Java?

Compile polymorphism

xecution time polymorphism

Multiple polymorphism

Multilevel polymorphism

Yes, the answer is correct.


Score: 1
Accepted Answers:
Compile polymorphism

10) "this" keyword represents current —

object

class
data
method

Yes, the answer is correct.


Score: 1
Accepted Answers:
abject
O
I
21:52 “om A 29 tte a || all 97%

i} Applets - Basics, Lite cycle, Graphics Methods and AWT Controls

Event Handling

Week 6 Assessment
The due date for submitting this assignment has passed.
Due on 2022-10-30, 23:59 IST.

Assignment submitted on 2022-10-30, 19:38 IST


1) Methods declared as ‘static’ has the follawing constraint : 1 point
Can only directly call other static methods
Cannot directly access static data

(Can refer to ‘this’ or ‘super’ keyword

Cannot access other static methods


Yes, the answer is correct.
Score: 1
Accepted Answers:
‘Can only directly call other static methods

2) A static final variable that is not initialized at the time of declaration is 1 point
static blank final variable
final variable
static variable
blank final variable
Yes, the answer is correct.
Score: 1
Accepted Answers:
static blank fina! variable

3) What will happen during the execution of the following code for the command line input? 1 point
public class CMODemo
{
public static void main(String args|])
{
System.out printin(args[4]};
}
fi
‘Consider the following input on command line.
A. Welcome to My First Program
B. SWAYAM NPTEL Portal
. Welcome to SASTRA Online
D 123

Program
First
Compilation Error

No Output

No, the answer is incorrect.


Score: 0
Accepted Answers:
Program

4) What will be the output of the below program? 1 point


class Mainolase
C
statie String text = "About":
elass Main_Inner
1
static String text = ' inner classes’;
void inner)
{
System. out. printin(Innes.
text);

]
public class Clisntelass
t
public atatic void main(String[] arga)
1
Outer outer = new Outer();
Syatem.out. print (outer.text};
Outer. Inner inner = outer.new Inner():
inner.method_inner(}:

About inner classes


About
inner classes
About inner class
Compile time Error - cannot access a static variable in inner class

Yes, the answer is correct.


Score: 1
Accepted Answers:
About inner classes
I

O
21:52 “Som A 928 Heo 4Sal il 97%
Outer. Inner inner = outer.new Inner();
inner.method_inner(}:

About inner classes


About
inner classes
About inner class
Compile time Error - cannot access a static variable in inner class

Yes, the answer is correct


Score: 1
Accepted Answers:
About inner classes

5) In Java, a class which inherits the properties of other class is known as: T point
Sub class
Super class

Derived sub class


Inherited class
Yes, the answer is correct.
Score: 1
Accepted Answers:
Sub class

6) Which keyword is used to connect multiple classes 1 point


extends
extend
implements

connect
Yes, the answer is correct.
Score: 1
Accepted Answers:
extends

7) Which facility in java is used to control inheritance to different classes and levels2 1 point
Static keyword
Access modifiers like default, public, protected and private

Retum types like void and Object

Constructor
Yes, the answer is correct.
Score: 1
Accepted Answers:
Access modifiers like default, public, protected and private

8) What is the maximum number of classes required for the implementation of single inheritance? 1 point
on
wo

4
Yes, the answer is correct.
Score: 1
Accepted Answers:
2

9) To implement Hierarchical inheritance, all the member variables and methods of the classes must be declared as default only. 1 point
False
True
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
False

10) A class member declared as protected in super class becomes member of subclass of which type? T point
Public member
Private member

Protected member
Default member
Yes, the answer is correct.
Score: 1
Accepted Answers:
Private member

FOLLOW US

0oe°9
A
I

O
21:53 “Som XQ 299 Heo Sal tl 96%

QQ @@ceswayam2acin + ©] 3:
® Week 8 : Packages and Interfaces - Problem Scenario with Program Solution

Exception Handling, Threads, String, StringTokenizer, Dictionary, System, Hashtables, |O Package and
FileStreams

Applets - Basics, Life cycle, Graphics Methods and AWT Controls

Event Handling

Week 7 : Assessment
The due date for submitting this assignment has passed.
Due on 2022-11-06, 23:59 IST.

Assignment submitted on 2022-11-06, 21:31 IST


1) Which of the following is NOT true about an abstract method in a class? 7 point

An abstract class can be declared as final.


No object of the class can be created.

Any subclass of the class may or may not be abstract class.

An abstract class cannot have abstract method(s).

Yes, the answer is correct.


Score: 1
Accepted Answers:
An abstract class can be declared as final.

2) The process of extracting the essential elements of a class without including the background details is called 7 point

Polymorphism

Encapsulation

Inheritance
Abstraction
Yes, the answer is correct.

Accepted Answers:
Abstraction

3) Which of the following access specifier(s) should you choose for the class properties, if youneed to accomplish access restricted to all 1 point
subclass in the same and different packages?

default
public

protected

private

No, the answer is incorrect.


Score: 0
Accepted Answers:
private

4) The keyword used to connect “Multiple interfaces” is called 7 point

interface
packages

extends
implements

No, the answer is incorrect.


Score: 0
Accepted Answers:
extends

5) What willbe the output of the below program? T paint


class Test
{static int x = 20;}
class Demo extends Test
{
public static void main(String[] args)
{
System_out printin(++x);

20
Compiletime error

21
Garbage value will be printed

Yes, the answer is correct.


Score: 1
Accepted Answers:
21
A
I

O
21:53 “Som XQ 299 Heo 4Sal wil 96% 7
21
Garbage value will be printed

Yes, the answer is correct.


Score: 1
Accepted Answers:
20

6) What will be the output of the below program? T paint


elasa Parent
public void display)
{
System.out .printin(*One::show() called");

class Child extends Parent


public void diaplay()
t
System.out.printin("Two::ahow() called");
]
J
public class MyClass
f
public statie void main(String!) args)
Child obj = new Parent(};;
ob}.display();

Compile time error


One:show() called
Two::show() called

Garbage value

Yes, the answer is correct.


Score: 1
Accepted Answers:
Compile time error

7) Amethod in a subclass has the same name and type signature as a method in its superclass, then the method in the subclass is called 1 point

method overriding

method overloading

abstract methods
static final methods
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
method overriding

8) Ifa super class reference variable can refer to a subclass object and is called T point

upeasting
method overloading

encapsulation
abstraction
Yes, the answer is correct.
Score: 1
Accepted Answers:
upcasting

9) The mechanism ‘interface’ in java is used to achieve T point

abstraction
multilevel inheritance
constructor overloading
method overriding

Yes, the answer is correct.


Score: 1
Accepted Answers:
abstraction

10) A class that connects an interface must utilize all the variables declared in the interface 1 point

True
False
Yes, the answer is correct.
Score: 1
Accepted Answers:
False

FOLLOW US:

0oe°90
21:55 Som XQ 999 Ho “Sil tl 96%

Week 8 Assessment - Exception Handling : Fundamentals


- Multiple Catch - Builtin Exception; Multithreaded
Programming;
The due date for submitting this assignment has passed.
Due on 2022-11-14, 23:59 IST.

Assignment submitted on 2022-11-14, 20:29 IST


1) Which subclass of Throwable class is checked at java program compilation process7 7 point

[OException

NullPointer Exception
NullpointerException

ArrayindexOutOfBoundsException

Yes, the answer is conmect.


Score: 1
Accepted Answers:
IOException

2) Which of the following is TRUE about try-catch construct in Java? 7 point


L.A try-catch blocks must have a finally block.
I. Attry block is limited to maximum two catch blocks.
IIL Barring the Jave Virtual Machine from exiting, the finally block will always be executed

Land Il Only

Ill Only
Only

flan II! Only

Yes, the answer is correct


‘Score: 1
Accepted Answers:
Ht Only

3) Which Method is used to get the Priority value of a Thread ? T point


getPrionity()
getPriorityValue()

getThreadPriority()
getValue()
Yes, the answer is comect.
Score: 1
Accepted Answers:
getPriority()

4) Which of the following step is suitable to create a Thread Instance ? 1 point

By implementing the Threadable interface


By extending the Runnable interface

By implementing the Thread class

By implementing the Runnable interface

Yes, the answer is correct.


Score: 1
Accepted Answers:
By implementing the Runnable interface

5) For the program given below, what will be the output after its execution? 7 point
public class Demo

public static void main(String] args)


{Thread thread = Thread currentThread(};
System.out printin(thread isAlive()};
}

false
Yes, the answer is correct.
‘Score: 7
Accepted Answers:
tue

6) What the method notifyAll() does? 1 point

Wakes up all threads that are waiting on this object's monitor


Wakes up only one thread among a group of threads that are waiting on this object's monitor

Wakes up all threads that are not waiting on this object's monitor

ft doesn’t Wake up any thread that are waiting on this object's monitor

Yes, the answer is correct.


Score: 1
Accepted Answers:
Wakes up all threads that are waiting on this object's monitor

7) Which of the following is wrong regarding the feature interface ? 1 point


All the methods in an interface are abstract and public implicitly.

An interface can be implemented by a class.

An interface can contain constructors.

i O
21:55 “om XQ 299 Heo 4Sal wil 96% 7
see eer

4) Which of the following step is suitable to create a Thread Instance ? 1 point

By implementing the Threadable interface

By extending the Runnable interface

By implementing the Thread class


By implementing the Runnable interface

Yes, the answer is correct.


ore: 1
Accepted Answers:
By implementing the Runnable interface

5) For the program given below, what will be the output after its execution? 1 point
public: class Demo
{
public static void main(String[] args)
{Thread thread = Thread.currentThread(};
System out printin(thread isAlive());
t}

false
Yes, the answer is correct.
Score: 1
Accepted Answers:
tue

6) What the method notifyAll) does? 1 point

Wakes up all threads that are waiting on this object's monitor

Wakes up only one thread among a group of threads that are waiting on this object's monitor

Wakes up all threads that are not waiting on this object's monitor

ft doesn’t Wake up any thread that are waiting on this object's monitor

Yes, the answer is correct.


Score: 1
Accepted Answers:
Wakes up all threads that are waiting on this object's monitor

7) Which of the following is wrong regarding the feature interface ? 1 point

All the methods in an interface are abstract and public implicitly.

An interface can be implemented by a class.


An interface can contain constructors.
An interface can be extended by another interface.
Yes, the answer is correct
Score: 1
Accepted Answers:
An interface can contain constructors.

8) Which of the following package offers all the supportive classes for the exception handling mechanism ? 1 point

java.util

java.io
java.lang

java.awt

Yes, the answer is correct


Score: 1
Accepted Answers:
javaJang

9) Allthe properties defined in the interface are implicitly specified as 1 point


public

private

default and static


static and final
Yes, the answer is correct.
Score: 1
Accepted Answers:
static and final

10) The two types of distinct multitasking are 1 point


Process based and Thread based
Process oriented and Content Based
Content based and Task Oriented
Task Based and Content based
Yes, the answer is correct.
Score: 1
Accepted Answers:
Process based and Thread based

e i
A
I

O
21:56 Som AQ 9:00 von Sal tl 96%

Week 9 Assessment - Creating Multiple Threads,


Methods, Thread Priorities; Synchronization in Threads;
String Handling;String Tokenizer class; Dictionary Class;
The due date for submitting this assignment has passed.
Due on 2022-11-21, 23:59 IST.

Assignment submitted on 2022-11-21, 16:30 IST


1) Which of the following variable is used to set the Priority value of a Thread to law? 7 point

public static int LOW_PRIORITY


public static int NORM_PRIORITY

public static int MIN_PRIORITY

public static int PRIORITY_LOW

Yes, the answer is correct.


Score: 1
Accepted Answers:
public static int MIN_PRIORITY

2) The task of coordinating the execution of processes iin a way that no two processes can have access to the same shared data and T paint
resources is called

Thread Synchronization

Inter Thread Communication


Process synchronization
Inter thread interference
Yes, the answer is correct.
Score: 1
Accepted Answers:
Process synchronization

3) The mechanism in which a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same 7 point
critical section to be executed is called

Inter Process Synchronization

Inter Thread Communication


Process synchronization

Preventing thread interference

Yes, the answer is comect.


Score: 1
Accepted Answers:
Inter Thread Communication

4) Synchronization block is used to 1 point

Lock an abject for any shared resource

Perform Inter Thread Communication


Deal with dead lock identification
Handle efficient memory management process

Yes, the answer is correct


Score: 1
Accepted Answers:
Lock an object for any shared resowce

5) Which of the below is a class which utilizes the class String as 4 key to store the value in Object 7 7 point

Dictionary

Properties
Array

StringBuffer
Yes, the answer is correct.
Score: 1
Accepted Answers:
Properties

6) Whatis the output forthe following code: 7 point


public class StringExample
{
public static void main(String args[])
(
String s1="Online degree";
char ch ={J-AsV Ay;
String 32=new String(ch);

System.out_printin(s1+" “+s2);

Compile Time Error


JAVA Online Degree

Online degree J

Online degree JAVA

No, the answer is incorrect.


So ore: 0
Accepted Answers:
Online degree JAVA
21:56 “om A 399
Heo Sal tl 96%
5) Which of the below is a class which utilizes the class String as a key to store the value in Object ? 1 point
Dictionary
Properties

Array

StringBuffer
Yes, the answer is correct.
Score: 1
Accepted Answers:
Properties

6) What is the output forthe following code : 1 point


public class StringExample
fi
public static void main(String args[])
{
String s1="Online degree";
char chJ={JVAV A,
String s?=new String(ch);

‘System.out_printin(s1+" “+s2);

Compile Time Error

JAVA Online Degree

Online degree J

Online degree JAVA

No, the answer is incorrect.


Score: 0
Accepted Answers:
Online degree JAVA

7) What will be the exact output of the following code snippet 7 point
public class Mains

public static void main(String ar[])


{
char chars|] = {'a’ "k:
String s = new String(chars);
System.aut printin(s.length());
}

Compile Time Error


4
a

0
No, the answer is incorrect.
Score: 0
Accepted Answers:
4

8) Which of the following method of String class is used to convert alphabets from lower case to upper case? 1 point
boolean lowertoUpper()
String toupper()
String teCaseUpper()
String toUpperCasel)
Yes, the answer is correct.
Score: 1
Accepted Answers:
String toUipperCase()

9) Which of the following statements is wrong ? 1 point


StringTokenizer class is used to break a string into tokens

Offer facility to differentiate numbers, quoted strings, identifiers etc.,


Offer methods to break a string

Belongs to the package java.util

Yes, the answer is correct.


Score: 1
Accepted Answers:
Offer facility to differentiate numbers, quoted strings, identifiers etc.,

10) Which of the following statements is wrong about Dictionary ? 1 point


Dictionary class is used to break a string into tokens

It belongs to java.util package facility to differentiate numbers, quoted strings, identifiers etc.,
itis an abstract class
Direct known sub class is HashTable
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
Dictionary class is used to break a string inte tokens
A
I

O
21:57 Som DX 192 Yon “Gil wil 96%

Week 10 Assessment_2
The due date for submitting this assignment has passed.
Due on 2022-11-28, 23:59 IST.

Assignment submitted on 2022-11-28, 22:10 IST


1) Which of the following is false about HashTable class 7 T point
It inherits the Dictionary class and implements the Map interface
Permits null key or value

HashTable contains values based on the key

HashTable class is synchronized

‘Yes, the answer is correct.


Score: 1
Accepted Answers:
Permits null key or value

2) Which of the following method can be used to store a specified value with a specified key in hash table ? T point
V replace (K key, V value)
Vinsertat(V value: key)
V insert (K Key, V value)
V putt K Key, V value)

Yes, the answer is correct.


‘Score: 7
Accepted Answers:
V puty
K Key V value)

3) Which of the following interface is NOT a member of java.io package? 1 point


Runnable
Datalnput

Objectinput

FileFitter
Yes, the answer is correct.
Score: 1
Accepted Answers:
Runnable

4) Which of the following command is used to create a directory in a location? T paint

mkdir)

createdirectory()
newdir()
dir(} list
Yes, the answer is correct.
Score: 1
Accepted Answers:
micdir()

5) Which of the following exception is thrown, when the file is not found? 7 paint

[OException

FileException

FileNotFoundException
FileinputException

Yes, the answer is correct.


Score: 1
Accepted Answers:
AlleNotFoundException

6) Which of the following code is correct? 1 point

FilelnputStream files = new Filewriter(”./file txt");


File file = new File(files );
BufferedWriter bufferedOutputWriter = new Buffered Writer{files);

Buffered Writer bufferedOutput Writer = new Buffered Writer(".../file-txt’);


File file = new File(bufferedOQutputWriter };
File Writer fileWriter = new FileWriter(file);

File file = new File("../file tet");


File Writer fileWriter = new FileWriter(file);
BufferedWriter bufferedOutputWriter = new Buffered Writer(fileWriter),

File file = new File("../file tet");


BufferedWriter bufferedQutputWriter = new Buffered Writer(new
InputStreamReader(fite));
File Writer fileWriter = new FileWriter(bufferedQutputWriter };
Yes, the answer is corect.
Score: 1
Accepted Answers:
File file = new File(*../file tet");
FileWriter fileWriter= nev FileWriter(file);
Buffered Writer bufferedOutput Whiter = new BulferedWriter(file Writer};

7) Which of the following method of the System class supports to display text in multiline?

System.nextLine(}

= O q
21:57 Som XQ 390 von Sal tl 96% ow)
6) Which of the following code is correct? 1 point

FilelnputStream files = new Filewriter("../file.txt");


File file = new File(files );
BufferedWriter bufferedOutputWriter = new Buffered Writer(files);

BufferedWriter bufferedOutputWriter = new Buffered Writer(’../file-txt");


File file = new File(bufferedOutputWriter };
FileWriter fileWriter = new FileWriter(file);

File file = new File{"../file.tct");


FileWriter fileWriter = new FileWriter(file);
BufferedWriter bufferedOutput Writer = new Buffered Writer(fileWriter|;

File file = new File("..,/file.tut");


BufferedWriter bufferedOutputWriter = new Buffered Writer(new
InputStreamReader(file));
File Writer fileWriter = new FileWriter(bufferedOutputWriter );
Yes, the answer is correct.
Score: 1
Accepted Answers:
File file = new File("./file. tet’);
FileWriter fileWriter = new FileWriter(file);
BufferedWriter bufferedOutputWriter = new BufferedWriter(fileWriter);

7) Which of the following method of the System class supports to display text in multiline ? 1 point

System.nextLine[}
System. lineSeparator()

System. newLine()
System.endi(}
Yes, the answer is correct.
Score: 1
Accepted Answers:
System lineSeparatar()

8) Which of the following cade is correct? 1 point

Two abstract classes of the byte stream family are InputStream and OutputStream

Two abstract classes of the byte stream family are Reader and Writer
Two abstract classes of the character stream family are InputStream and OutputStream

Byte Stream supports te deal with Unicode character Streams in java

Yes, the answer is conmect.


Score: 1
Accepted Answers:
Two abstract classes of the byte stream family are InputStream and OutputStream

9) What is the output forthe following code snippet: 1 point


public class Mains
{
Public static void main (String ar{])
{
intx, x= "A;
System.out.write(x); System,out. write("\n')};
}

4
Qo

Compile time Error


65

Yes, the answer is correct.


Score: 1
Accepted Answers:
A

10) Automatic resource management is based on an expanded form of 1 paint

try statement
AutoClosable class
Closeable interface
gc() method of System interface
Yes, the answer is corect.
Score: 1
Accepted Answers:
try statement

MHRD
FOLLOW US

0oe°9o
I

O
21:58 “om A 13.0 vi
tes Meo “Sal tl 96%

o @ ‘e.swayam2.ac.in + @ :

Week 11 assessment 2
The due date for submitting this assignment has passed.
Due on 2022-12-04, 23:59 IST.

Assignment submitted on 2022-12-04, 16:37 IST


Week 11 8

1) Anapplet runs in 1 point


Java enabled web browser
Web server
A servlet
Java beans
Yes, the answer is correct.
Score: 1
Accepted Answers:
Java enabled web browser

2) Anapplet does not require 1 point

4 compiler

Main()
Interpreter
Browser
Yes, the answer is correct.
Score: 1
Accepted Answers:
Main()

3) Anapplet class extends 1 point

Panel
Serviet
Japplet

SQL
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
Panel

4) The methed drawRoundRect() belongs to which class 1 point

Applet

Serviet
Jdbe

Graphics

Yes, the answer is correct.


Score: 1
Accepted Answers:
Graphics

5) The showStatus() displays the output in T point


Command prompt

Status bar of the applet


No display

In the printer

Yes, the answer is correct.


Score: 1
Accepted Answers:
Status bar of the applet

6) What is the return type of getSize(}? T point


Color
Graphics

Dimension
Applet

Yes, the answer is correct.


Score: 1
Accepted Answers:
Dimension

7) What is the return type of setColor()? 1 point


Int
Color
Void
Double
Yes. the answer is correct.
21:58 “om XQ 109 Heo 4Sal il 96%

4) The method draveRoundRect{) belongs to which class 7 point

Applet

Servlet
Jdbe

Graphics

‘Yes, the answer is correct.


Score: 1
Accepted Answers:
Graphics

5) The showStatus(} displays the output in 7 point

Command prompt
Status bar of the applet
No display

In the printer

Yes, the answer is correct.


Score: 1
Accepted Answers:
Status bar of the applet

6) What is the return type of getSize(}? 7 point

Color
Graphics

Dimension
Applet

Yes, the answer is correct.


Score: 1
Accepted Answers:
Dimension

7) What is the return type of setColor(}? 7 point

Int
Color
Void
Double
Yes, the answer is correct.
Score: 1
Accepted Answers:
Void

8) Which method is used to load images using URLs T paint

getimaget)
insertimage()
ImageGet(}
loadimagef)
Yes, the answer is correct.
Score: 1
Accepted Answers:
getimaget)

9) Which interface defines the imageUpdate()? 7 point

ImageObserver

ImageDetails

ImageStore

ImageGet

Yes, the answer is correct.


Score: 1
Accepted Answers:
ImageObserver

10) The getAudioClip() belongs to which class? 7 point

Applet

Servlet
Graphics
Image

Yes, the answer is correct.


Score: 1
Accepted Answers:
Applet

FOLLOW US.

0e0 8
A
I

O
21:59 “om QA 13.9 Ven -43a1 wl 96%

week 12 assessment 2
The due date for submitting this assignment has passed.
Due on 2022-12-11, 23:59 IST.

Assignment submitted on 2022-12-11, 23:19 IST


week 12 assessment 2

1) Which package provides the class Choicelist? 1 point


Java.io
Java.awt
Javax.serviet
Javanet
Yes, the answer is correct.
Score: 1
Accepted Answers:
Java.awt

2) Which is the preferred API for windows based applications? 1 point

Javax.swing

Java.io
Javalabel
Java.net
Yes, the answer is correct.
Score: 1
Accepted Answers:
davax.swing

3) How many types of containers available in AWT? 1 point


Bow

2
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
4

4) From which class the Dialog class is inherited from 1 point

Component

Windows
Layout

Servlet
Yes, the answer is correct.
Score: 1
Accepted Answers:
Windows

5) Labelis a T point
Active control
Passive control
Interactive control
Monolithic control
Yes, the answer is correct.
Score: 1
Accepted Answers:
Passive control

6) How many types of constructors are available in Label control T point


mown

3
Yes, the answer is correct.
Score: 1
Accepted Answers:
3

7) How many types of constructors are available in Button control? 1 point


homo

3
Yes, the answer is correct.
Score: 1
Accepted Answers:
2

8) How many types of constructors are available in Checkbox control?

i O
21:59 “om A 0.00
KB/s Hi o Sil tl 96%
3) How many types of containers available in AWT? 1 point

Bow ow
2

Yes, the answer is correct.


re:
Accepted Answers:
4

4) From which class the Dialog class is inherited from 1 point


Component

Windows
Layout

Servlet
‘Yes, the answer is correct.

Accepted Answers:
Windows

5) Labelis a T point
Active control
Passive conirol

Interactive control
Monolithic control
Yes, the answer is correct.
Score: 1
Accepted Answers:
Passive control

6) How many types of constructors are available in Label control T point


Down

3
Yes, the answer is correct.
Score: 1
Accepted Answers:
3

7) How many types of constructors are available in Button control? 1 point


hom os

3
Yes, the answer is correct.
Score: 1
Accepted Answers:
2

8) How many types of constructors are available in Checkbox control? 1 point


5
6

7
8
Yes, the answer is correct.
Score: 1
Accepted Answers:
5

9) The Choice class is 1 point


Used to create a pop-up list

Used to draw an Image

Used to add an icon


None of the above
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
Used to create a pop-up list

10) How many methods are present in Scrollbar class? 1 point

25
7
5
6

Yes, the answer is correct.


ore: 1
Accepted Answers:
z
I

O
22:00 “\ om AQ 140 von Gil 1 96%

QQ @@ceswayam2acin + ©] 3:
Week 13 Assessment 2?
The due date for submitting this assignment has passed.
Due on 2022-12-18, 23:59 IST.

Assignment submitted on 2022-12-18, 20:06 IST


1) Default layout manager for subclasses of “Window” is 7 point

CardLayout

GridBagLayout
Frame
BorderLayout

‘Yes, the answer is correct


Score: 1
Accepted Answers:
BorderLayout

2) What is the default layout for Dialogs? 7 point

FlowLayout

BorderLayout
CardLayot

GridLayout

Yes, the answer is correct


Score: 1
Accepted Answers:
BorderLayout

3) The default layout manager of an applet is 7 point

FlowLayout

BorderLayout
CardLayout

GridBagLayout

Yes, the answer is correct


Score: 1
Accepted Answers:
FlowLayout

4) Which method is used to enable an event for a particular object? T point

enableEvent(}
enable()

enableObject()
enableEventst)
Yes, the answer is correct.
Score: 1
Accepted Answers:
enableEvents()

5) The layout manager that lays out a container's components in a rectangular grid T point

BorderLayout
GridLayout

CardLayout

FlowLayout

Yes, the answer is correct.


Score: 1
Accepted Answers:
GridLayout

6) Whatis the super class of all components of Java? T point

java.all.Component

all. awt.Component

java.awt.Component

awt.Component

Yes, the answer is correct.


Score: 1
Accepted Answers:
java.awt. Component

7) A dictates the style of arranging the components in a container T paint

border layout

panel

grid layout
layout manager

Yes, the answer is correct.


Score: 1
Accepted Answers:
Jayout manager

8 Which listener ie teed tn handle the events of atevt field? A naint

i O d
22:01 “om XQ 299 Heo 4Sal wil 95% 7
None of the above
Yes, the answer is correct.
Score: 1
Accepted Answers:
Returns the item which was clicked and triggered the ttemEvent

3) The paramSrting() 1 point


Retums string with current settings of ActionEvent

Retums string with current settings of AdjustmentEvent

Retums string with current settings of temEvent

Yes, the answer is correct.


Score: 1
Accepted Answers:
Retums string with current settings of ItemEvent

4) getClass() T point
Retums the component when its lost focus

Retums the runtime class of this object


Retums the component when its got focus

Yes, the answer is correct.


Score: 1
Accepted Answers:
Returns the runtime class of this object

5) When the user changes the value of the scrolling component, it receives an instance of 7 point

AdjustmentEvent

FocusEvent
AdjustmentType Event

‘Yes, the answer is correct.


Score: 1
Accepted Answers:
AdjustmentEvent

6) The two flavours of Focus Events are 1 point


Random , optimal

Permanent , temporary

Permanent, random
Temporary , random

Yes, the answer is correct.


Score: 1
Accepted Answers:
Permanent, temporary

7) public ttemSelectable getitemSelectable() returns 7 point

The item which was clicked


The item which was moved
The item which was deletes
The item which was inserted
Yes, the answer is correct.
Score: 1
Accepted Answers:
The item which was clicked

8) Number of constructors in Item event is 1 point

2
3
4
No, the answer is incorrect.
Score: 0
Accepted Answers:
2

9) Permanent focus events occur with 1 point

Implicit focus changes

Do not change
Explicit focus changes
Both A and B
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
Explicit focus changes

10) What is the parameter of public void addltemListener() 1 point


ItemListener object

EventListener Object
void
HtemSelectable object

Yes, the answer is correct


Score: 1
Accepted Answers:
itemListener object
I

O
22:01 “om A 2.99
¥en 24S al tl 95% ow)

QQ @:eswayam2acin + ©] :
Week 15 Assessment
The due date for submitting this assignment has passed.
Due on 2023-01-02, 23:59 IST.

Assignment submitted on 2023-01-02, 16:21 IST


Week 15 assessment
1) temEvent must implement an interface named 1 point

MouseEvent
ftemEvent
ActionEvent

ltemInterfaceEvent
Yes, the answer is comect.
Score: 1
Accepted Answers:
ttemEvent

2) The method geiltemn() 7 point

Respond to mouse click

Retums the current state of item which was clicked


Retums the item which was clicked and triggered the ltemEvent

None of the above


Yes, the answer is correct.

Accepted Answers:
Retums the item which was clicked and triggered the (temEvent

3) The paramSrting(} 1 point

Retums string with current settings of ActionEvent

Retums string with current settings of AdjustmentEvent

Retums string with current settings of ItemEvent

Yes, the answer is correct.


Score: 1
Accepted Answers:
Retums string with current settings of ItemEvent

4) getClass() 1 point

Retums the component when its lost focus

Retums the runtime class of this abject


Retums the component when its got focus

Yes, the answer is correct.


Score: 1
Accepted Answers:
Retums the runtime class of this object

5) When the user changes the value of the scrolling component, it receives an instance of T paint

AdjustmentEvent

FocusEvent
AdjustmentType Event

Yes, the answer is corect.


‘Score: 1
Accepted Answers:
AgjustmentEvent

6) The two flavours of Focus Events are 7 point

Random , optimal

Permanent , temporary

Permanent, random
Temporary , random

Yes, the answer is correct.


Score: 1
Accepted Answers:
Permanent, temporary

7) public ItemSelectable getltemSelectable() returns 1 point

The item which was clicked


The item which was moved
The item which was deletes
The item which was inserted
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
The item which was clicked

8) Number of constructors in ttem event is Qo

i O q
22:00 “om A 3.90 Ven -4Sa1 wl 96% C7

o @ ‘e.swayam2.ac.in +
@
Yes, the answer is correct
Score: 1
Accepted Answers:
java.util

4) Which of these class is super class of all the events? 1 point


EventObject
EventClass
ActionEvent
ItemEvent
Yes, the answer is correct.
Score: 1
Accepted Answers:
FventObject

5) Which of these methods are used to register a mouse motion listener? 1 point
addMousef}
addMouseListener()
addMouseMationListner()
eventMouseMotionListener()

Yes, the answer is correct.


Score: 1
Accepted Answers:
addMouseMotionListner()

6) Which of these events is generated when a button is pressed? 1 point


KeyEvent

ActionEvent
WindowEvent
AdjustmentEvent

Yes, the answer is correct.


Score: 1
Accepted Answers:
ActionEvent

7) Which of these methods can be used to obtain the reference to the container that generated a ContainerEvent? 1 point
getContainer()
getActionEvent()
getContainerEvent()
getContainerCommand()

Yes, the answer is correct.


Score: 1
Accepted Answers:
getContainerEvent()

8) Which of these interfaces define a method actionPerformed()? 1 point


InputListener

ActionListener
ContainerListener
ComponentListener

Yes, the answer is correct.


Score: 1
Accepted Answers:
ActionListener

9) Which of these methods can be used to determine the type of event? 1 point

getIDi)
getSource(}

getEvent()
getEventObject()
Yes, the answer is correct.
Score: 1
Accepted Answers:
getlD()

10) Which of these events will be generated if we close an applet’s window? 1 point

ActionEvent
ComponentEvent

AdjustmentEvent
WindowEvent
‘Yes, the answer is correct.
Score: 1
Accepted Answers:
WindowEvent
22:00 “om XX %99 Heo 44) il 96% Ga

QQ @@ceswayam2acin + ©] 3:
WEEK 14 ASSESSMENT 2
The due date for submitting this assignment has passed.
Due on 2022-12-25, 23:59 IST.

Assignment submitted on 2022-12-25, 17:15 IST


weekl4 sesecsment 2

1) Which of these packages contains all the classes and methods required for even handling in Java? T point

java.applet
java.awt

java.event

java.awt.event

Yes, the answer is correct.


Score: 1
Accepted Answers:
java.awt.event

2) Which of these methods are used to register a keyboard event listener? T paint

KeyListener()
addKistener()
addKeyListener()

eventKeyboardListener(}

Yes, the answer is correct.


Score: 1
Accepted Answers:
addKeyListener()

3) Event class is defined in which of these libraries? 7 point

java.io

java.lang

java.net
java.util

‘Yes, the answer is correct.


Score: 1
Accepted Answers:
java.util

4) Which of these class is super class of all the events? 1 point

EventObject

EventClass
ActionEvent
ItemEvent
Yes, the answer is correct.
Score: 1
Accepted Answers:
EventObject
5) Which of these methods are used to register a mouse motion listener? T paint

addMause{}

addMouseListener(}
addMouseMationListner()
eventMouseMotionListener()

Yes, the answer is correct.

Accepted Answers:
addMouseMotionListner|)

6) Which of these events is generated when a button is pressed? 1 point

KeyEvent

ActionEvent
WindowEvent
AdjustmentEvent

Yes, the answer is correct.

Accepted Answers:
ActionEvent

7) Which of these methods can be used to obtain the reference to the container that generated a ContainerEvent? 1 point

getContainer()
getActionEvent()
getContainerEvent()
getContainerCommand()

‘Yes, the answer is correct.


Score: 1 8
Accepted Answers:
getContainerEvent/)
A
I

O
22:00 “om A 0.00
KB/s Hi o Sil tl 96%
FlowLayout

BorderLayout
CardLayout

GridBagLayout

Yes, the answer is correct


Score: 1
Accepted Answers:
FlowLayout

4) Which method is used to enable an event fora particular object? T point


enableEventt(}
enable()
enableObject()
enableEventst)
Yes, the answer is correct
Score: 1
Accepted Answers:
enableEvents()

5) The layout manager that lays out a container’s components in a rectangular grid 1 point
BorderLayout
GridLayout

CardLayout

FlowLayout

Yes, the answer is correct.


Score: 1
Accepted Answers:
GridLayout

6) What is the super class of all components of Java? 1 point


java.all.Component
all. awt.Component

java.awt.Component

awt.Component

Yes, the answer is correct.


Score: 1
Accepted Answers:
java.awt. Component

7) A dictates the style of arranging the components in a container 1 point


border layout

panel

grid layout
layout manager

Yes, the answer is correct.


Score: 1
Accepted Answers:
layout manager

8) Which listener is used to handle the events of a text field? 1 point


java.awt. ActionListener interface

java.awt.event ActionListener

awt.event ActionListener interface


java.awt.event ActionListener interface

Yes, the answer is correct.


Score: 1
Accepted Answers:
java.awt.eventActionListener interface

9) The most commonly used layout managers are 1 point


FlowLayout

BorderLayout

GridLayout
Allaf these
Yes, the answer is correct.
Score: 1
Accepted Answers:
All of these

10) How many layout managers defined in java.awt package? 1 point


h
Bow

5
Yes, the answer is correct.
Score: 1
Accepted Answers:
a

You might also like