Sunteți pe pagina 1din 32

BASIC JAVA BOOK 1 QUESTIONS AND ANSWERS

*****************************************************

Final keyword

of the following are not true about Extension methods.

rst parameter in this method identifies the type of objects in which the method

sion methods are non static methods


an declare an extension method by specifying the first parameter with this

ment 1: The this keyword is required before the first argument in extension

ment 2: The this keyword is not required in its argument declaration in static
Both the statements are False
Statement 1is True and Statement 2 is false
Both the statements are True
Statement 1is False and Statement 2 is True

e C# compiler generates the anonymous type at run time not at compile time

True
False

Which of the following are the not true about partial methods:

Partial methods do not return void


Partial methods can return ref but not out
They are implicitly public
The partial keyword is not a must while defining a partial method

Which of the following is the correct syntax of initializers class:

1) ClassName objname=new CollectionClassName{ collection-initializer}


2) ClassName objname=new CollectionClassName, collection-initializer
3) ClassName objname= CollectionClassName{ collection-initializer}
4) ClassName = new CollectionClassName{ collection-initializer}
1
2
3
4

________ is an inline expression or statement block having a compact sytax and


ed wherever a delegate or anonymous method is expected.

collection
Partial method
Query expression
Lambda
A lambda with only one statement is called a statement lambda

True
False

hich of the following query operators can be used with Lambda expressions

Sum
Count
SortBy

Container

Sl
Right Column
Correct Answer for column A
No.
Used in a
B1
B2
B3
B1
group clause
Used to
introduce a
range variable
to store subB2
B1
B2
B3
expression
results in a
query
expression
Used to
indicate an
identifier
which serves
B2
B3
B3 as a reference B1
to the results
of a
join,select,or
group clause

ual C# 2008 type inference causes arrays of pointer types to be excluded from the
d overload resolution process.

True
False

2008 it is possible to define an explicit implementation of an indexer in which


plementation has a __________parameter but the interface definition does not

public
private
params
global

happens when a static type is used as a parameter in a delegate or in a lambda

An error
Program terminates
Program executes successfully
None of the above

nvalidCastException exception is thrown when an explicit conversion from the


ype to another type fails.

True
False
The is operator in c# returns an integer value.

True
False

ich of the following are the restrictions for an implicitly typed local variable:

he variable should be declared and initialized with some value or expression.


hey can be initialized to null type.
he local variable declaration cannot include multiple declarations.
he var keyword cannot be used in the argument list of a method.
1.3,4
1,2
2,4,1
All the above

Total Questions 15
Aptech Ltd. All Rights Reserved
Version 3.0.17 Build-0.0.2

______________ is an API provided by Microsoft for accessing the Database, it uses SQl as
its database language.
JDBC
ODBC
MDBC
DBDC
Java application is connected to a JDBC driver using an object of the ___________ class.
JDBCDriverManager
ODBCDriverManager
SQLDriverManager
DriverManager
______________ driver converts the JDBC calls into database specific calls for databases
such as Oracle, MS SQL Server or Sybase.
JDBC_ODBC
Native API/partly Java driver
Net-protocol/all-Java driver
Native-protocol/all-Java driver
______________ interface provides methods for retrieving data returned by a SQL

statement.

Statement
Class.forName
ResultSet
Connection

______________ is a graphical framework that includes abstract window tool kit, Swing, and
Java2D classes.
Java Tool Kit(JDK)
Java Foundation Classes (JFC)
Java Development Kit (JDK)
Java Development Tool (JDT)

______________ is a stand alone Application that runs on its own without depending on the
browser.
JFrame
JClass
Java Main Class
Applet
______________ method is called when the applet interface is to be redrawn, this method
accepts a parameter of java.awt.Graphics class.
init()
paint()
repaint()
draw()

A ____________ manager is a Java object associated with a container, which governs the
placement and size of the component, when it is added to a container.
Frame
Layout
Applet
Main Class

The Listener object is an object of any class which implements the ActionListener interface
and provides implementation of the _______________ method.
Actionperform()
ActionPerformed()
Actionperformed()
ActionPerform()

____________ is a protocol that sends independent packets of data from one computer to an
other with no guarantee about its transmission.
TCP
UDP
SMTP
FTP

Port numbers ranging from ______________ are reserved.


0 to 6655
0 to 1234
0 to 1023
0 to 1024

If the host does not exist, Socket(String host, int port) throws ___________ exception.

UnknownHostException
HostnotFoundException
HostMissingException
HostNotExistException

Once the ServerSocket instance is created, we can invoke the ______ method to listen for
client request.
request()
accept()
listen()
receive()

A _____________ is a standard dialog box that is used to navigate the file system to choose a
directory or a file.
JFileChooser
JColorChooser
JSaveChooser
JOPenChooser

The __________________ is an abstract class with no default implementation provide your


own implementation to specify the filter criteria.
javax.swing.filechooser.FileFilter
javax.swing.Filechooser.FileFilter
javax.swing.filechooser.filefilter
Javax.swing.filechooser.FileFilter

__________ is a class used to displays group of items, allow to choose more or one items.
JCombobox
JTree
JTable
JLsit

In order to support scrolling in JTable ____________ is used.


JScroll
JScrollPane
JScrollPanel
JScrollingPane

18.The rmiregistry program listens on port ___ for incoming request:


(a) 1099(b) 1024(c) 80

(d) 1211

19.The ___ is the default layout manager for the content pane of a
swing-based applet.

FlowLayout

(b) Card Layout(c) Border Layout

(d) Grid Layout.

20.____ is the model used with all Swing components

Java Model (b) Spiral Model(c) MVC Model (d) Contorller.

21.___class is used to create tree-like structure while__ class is used to create table-like structure.
(a) JTree, JTable

(b) Tree, Table (c) JTree, JScrollPane

(d) JMenu, JItem

___ cursor can move forward or backward and also can be moved to a particular row
relative to the current position:

TYPE_SCROLL_INSENSITIVE

TYPE_FORWARD_ONLY

TYPE_SCROLL_SENSITIVE
TYPE_BACKWARD_ONLY

23. The developer uses the API to make calls to a database with the help
of SQL and retrieve
the results in the _ layer:
(a) Application

(b) Data

(c) Driver

(d) Network.

24. The __ class attempts to locate a driver that can connect to the
database represented by the URL.

Driver Manager

(b) Connection (c) Prepared Statement

(d) Called Statement.

25.A__ object compiles and executes the SQL statement when the
program is executed.

Prepared Statement (b) Called Statement

(c) Statement

The conditional attribute allows to create ____________methods

Conditional

Exponential

Functional

Practical

(d) Execute Statement

A conational method is invoked only when a specific symbol has been defined via #define
otherwise, the method is ________.

Overload

Override

bypassed

Overwrite

A conditional method offers an alternative to conditional compilation using _____

#define

#if

@define

@if

Conditional is another name for _____________________

System.Diagnostics.ConditionalAttribute

System.Diagnostics.ConsoleTraceListener

System.Diagnostics.ConditionalListener

System.Diagnostics.ConditionalTrace

______________ namespace must be included in the program in order to add a Conditional


Attribute.

System.Text

System.Collections

System.Diagnostics

System.Condition

The ________ attribute is used to define types or members of types that should no longer be
used.

Obsolete

Archaic

Condition

Order

In .NET Win32 API using platform _________ services is called

Import

Interop

InterApp

InterAPI

For Interop services resides at ____________ namespace

System.InteropServices

System.Runtime.Interop

System.Service.Interop

System.Runtime.InteropServices

Win32 API consists of a set of _____________

COM (Component Object Model)

DCOM (Component Object Model)

DLL (Dynamic Link Libraries)

Assemblies

__________ attribute is used to import functions from User32.dll

DLLImport

DLLExecute

DLLBring

GetDLL

DllImport method is prefixed with the ________ keyword.

Implicit

Extern

Interface

Protected

___________ is a mechanism of discovering class information solely at runtime.

Reflection

Emitting

Manifest

Extending

_____________ Class contains methods for obtaining attributes information for


programming elements like classes, methods, properties and so on.

System.Attributes

System.Type

System.Obtain

System.Windows

The custom attributes information can be retrieved into an object array by calling the
__________ method.

GetAttributes()

GetAllAttributes()

GetCustomAttributes()

GetAttributesAll()

The .NET Framework is equipped with a number of built-in attributes that performs a
____________ of function.

Host

Class

Type

Service

A software component that an application links at runtime is called ______________

COM (Component Object Model)

DCOM (Component Object Model)

DLL (Dynamic Link Libraries)

Assemblies

Every assembly contains ______

Data

Dynamic Data

MetaData

Linked Data

MSIL stands for

Microsoft Integrated Language

Microsoft Intermediate Language

Microsoft Intermediary Language

Microsoft Internal Language

_________ contains the complete information about the type in the types in the assembly and
MSIL code.

Metadata

Reflection

Manifest

GAC

GAC stands for

Global Assembly Cache

Global Attributes Collector

Global Assembly Collection

Global Access Collection

The minimum unit of deployment and security is called

Remoting

Web Service

Assemblies

None of above

Assembly can contain one more files and these can be any ________ files.

Native

Recourse

Physical

Module

NIC stands for

Native Image Cache

Native Image Collection

Native Internal Cache

Native Internal Collection

____________ assemblies are used for storing localized data

Global

Local

Satellite

None of above

Reflection is the ability to discover the composition of a type at ________

Compile

Runtime

Debug

None of above

__________ Class provide the static methods for creating, copying, deleting, moving, and
opening files.

File

FileInfo

StreamReader

StreamWriter

_________ Class provides the instance methods for creating, copying, deleting, moving, and
opening files.

File

FileInfo

StreamReader

StreamWriter

_________ Class Contains methods that read characters from a byte stream.

File

FileInfo

StreamReader

StreamWriter

________ Class Contains methods for writing characters to a stream.

StreamReader

StreamWriter

TextReader

TestWriter

___________ Class Contains methods that read a sequential series of characters.

StreamReader

StreamWriter

TextReader

TestWriter

___________ Class Contain methods that write a sequential series of characters.

StreamReader

StreamWriter

TextReader

TestWriter

___________ Method reads a Boolean value from a stream of data and advances the current
position of the stream by one byte.

ReadBoolean

ReadBooleanValue

ReadBooleanStream

ReadBooleanCurrent

___________ Method Reads next character from the stream, and returns the data in a
character array, and advances the current position in accordance with the encoding used
and the specific character being read from the stream.

ReadCharValue

ReadChar

ReadCharStream

ReadCharCurrent

___________ Method reads am 8-byte floating point value from the current stream and
advances the current position of the stream by eight byte.

ReadDoubleStream

ReadDoubleValue

ReadDouble

ReadDoubleCurrent

___________ Method Reads a 4-byte point value from the current stream and advances the
current position of the stream by four bytes.

ReadSingleStream

ReadSingleValue

ReadSingleCurrent

ReadSingle

___________ Method Reads a 4-byte signed integer from the current stream and advances
the current position of the stream by four bytes.

ReadInt

ReadInt32

ReadIntValue

ReadIntCurrent

___________ Method returns a string that represents a current object.

ToString

ForString

ToStr

String

___________ Method sets the position with the current stream.

Look

Seek

Position

Index

___________ Method closes the Stream object and frees all of the recourses it consumes.

Close

Dispose

End

Quit

___________ Method forces the contents of the buffer to be written to the underlying device.

Blush

Glow

Flush

Wash

___________ Method reads available data to an array of bytes and returns an integer that
indicates the number of byte read and if the pointer is at the end of the stream when Read is
called the method will return zero.

Read

ReadArray

ReadByte

ReadStream

___________ Method writes an array of byte into stream.

WriteStream

WriteByte

WriteArray

Write

___________ Method writes single bytes of stream and accepts a byte as its argument and
does not return a value.

WriteSingle

WriteByte

WriteStream

None of above

___________ Method releases system resources that are consumed by the object

Close

Dispose

Release

None of above

___________ Method Closes the TextReader and releases the system resources.

Close

Dispose

Release

None of above

___________ Methods returns the date and time of the specified file or directory that was
last accessed.

GetLastAccess

GetLastAccessTime

GetAccessLast

GetAccessLastTime

___________ Methods returns the date and time when specified or directory was last written

to.

GetLastWrite

GetWriteLast

GetLastWriteTime

GetWriteLastTime

___________ Methods replaces the content of a specified file with the contents of another file.
It deletes the original file and creates a back-up of the replaced file.

Another

Backup

Original

Replace

The FileInfo is ____________ class

Heritable

Irheritable

non-Irheritable

non-heritable

___________ Methods when overloaded returns the names of all files and subdirectories in
specified directory.

GetFileSystemEntries

GetSystemEntries

GetEntries

None of above

___________ Methods returns the volume information, root information of the specified
directory.

GetRoot

GetDirectory

GetDirectoryRoot

GetRootDirectory

___________ Method retrieves the current working directory of the application.

GetCurrentDir

GetCurrrentDirectory

GetDirectory

GetCurrent

The GetDirectories() method of Directory class has ______ overloads.

Two

Three

Four

Five

The __________ namespace contains classes that allow reading and writing to files and data
streams.

System.File

System.Files

System.IO

None of above

The __________ and ___________ classes are used to read and write binary data into file.

BinRead, BinWrite

BinaryReader, BinaryWriter

BinReader, BinWriter

BinaryRead, BinaryWrite

The BinaryWriter class writes ________ type in the binary to a stream and supports writing
strings in a specific encoding.

Primitive

Elaborate

Refined

None of above

The Stream class provides functionality that enables programmers to manipulate a _____

File

Data

Stream

Structure

A thread is part of a program that can execute ___________ of other part

Independently

Dependently

Liberally

Freely

Type of threading

Single

Apartment

Free

All of above

Which of the following is true for Threading

A single thread handles all the work in the application.

It doesnt occupy all the space that was allocated to process

A set of process within multiple application

Not shares portion of memory with other threads in the same application.

_____________ delegates in System.Theading namesspace that indicates the method that


executes on a Thread.

ThreadExe

ThreadStart

ThreadExecute

ThreadBegin

_____________ delegates in System.Theading namesspace that indicates the method that


handels calls from a Timer.

TimerCall

Timer

TimerCallBack

TimerHandel

_____________ delegates in System.Theading namesspace that indicates callback method to


be executed by a thread pool thread.

WaitCall

WaitBack

TimerCallBackWait

WaitCallBack

The enumerations in System.Threading namespace which indicates the priority of the


Thread.

ThreadPriorty

PriorityThread

PriorityThreadCall

ThreadPriortyCall

The enumerations in System.Threading namespace which indicates the execution state of


Thread.

StateThreading

CallState

CallStateThread

ThreadState

The enumerations in System.Threading namespace which Specifies whether an


EventWaitHandele is reset.

ResetEvent

EventHandle

EventResetMode

EventReset

The class manages the resourses efficiently especially when multiple threads are used is

called.

ThreadQueue

ThreadWork

ThreadResourse

ThreadPool

_________ method of the thread pool adds threads to be executed whenever the processor is
free.

QueueUserWorkItem

QueueWorkItem

QueueUserItem

QueueUserWork

The method of ThreadPool class which gets the difference between the maximum number of
thread pool threads and the number currently active.

GetAvailable

GetAvailableThreads

AvailableThread

There is no such method exists in ThreadPool class

The method of ThreadPool class which lines up a method for execution when a thread pool
thread becomens available.

QueueUserWork

QueueUserWorkItem

QueueWorkItem

QueueItem

The method of ThreadPool class which sets the number of requests that can be active
concurrently in the thread pool.

SetMaxThreads

MaxThreads

MaximumThreads

SetMaximumThreads

A timer is called automatically when its due time is ____________

Over

OverDue

Elapsed

Late

__________ method of the Timer class can used to change the values of the timer object or to
disable the timer.

Disable

Stop

ChangeValue

Change

__________ method of the Timer class can used to to free the resourses when it is no longer
needed.

Disable

Close

Dispose

None of above

The methods associated with a Timer object cab be specified by the ________________
delegate.

TimerCall

TimerCallBack

SetTimerCall

SetTimerCallBack

The first overload will suspend the thread for the number of miliseconds specified as

An Intger

As Dobule

As Boolean

None of above

_________ method is the best way to bring the sleeping thread back life.

Disrupt

Interrupt

Suspend

Barge

__________ method can accept an integer or a TimeSpan as a parameter.

Unite

Link

Join

Connect

When _____ method is called on a thread that is in the Unstared state.

Unstared

Cancle

Interrupt

Abort

By using ____________ property, a threads priority can be adjusted.

Priority

Adjuest

Order

Importance

The object of __________ class lock the critical sections of code so that only one thread can
access the critical sections of code so that only one thread can access the critical sections at
one point of time.

Critical

Access

Section

Monitor

The object of _______ class grant exclusive access to a resourse that shared across processes
to only on thread.

Shred

Access

Mutex

Service

_________ class notify one or more waiting threads that an event has occurred.

AutoResetEvent, ManualResetEvent

ResetEvent, ResetEvent

AutoReset, ManualReset

None of above

The methods in _________ class provide a mechanism for synchronizing access to a variable
that is shared by mutiple threads.

Synchroniz

Interlocked

Multiple

Shred

The ___________ class ensures that only one thread can access an object at a time.

SynchronizationAccess

AccessSynchronization

Synchronization

SynchronizationAttribute

The _____________ class notifies the complier on how the method should be implemented.

MethodImplAttribute

ImplAttribute

ImplementedAttribute

None of above

When two or more threads are waiting for their turn to perform but application is not

allowing the to execute is called _________.

Hang

Deadlocks

Suspend

Fall

RCW stands for

Remote Callable Wrapper

Remote Call Wrapper

Runtime Collection Wrapper

Runtime Callable Wrapper

COM Stands for

Common Object Model

Component Object Model

Callable Object Model

Collection Object Model

COCLASS ia an abbreviated from for ___________

Common Object Class

Callable Object Class

Component Object Class

Collection Object Class

Argument can be exchanged between managed and unmanaged code by a process know as
___

Marshaling

Assembling

Collecting

Organizing

__________ method informs the garbage collector that an object is no longer needed and can
be removed.

Liberate

Release

Discharge

Let

XML is designed to describe

Object

Tags

Data

Collections

____________ class is used to handle any XML errors that may occur during parsing of
XML file.

XMLException

XMLError

XMLErrorOccur

XMLExceptionOccur

______________ enumeration has a list of members that indicate the type of node contained
in the XML document.

XMLNode

XMLNodeType

XMLNodeContained

XMLContainedNode

____________ namespaces provides a verity of classes that use the XPath model.

System.Xml.PathModel

System.XmlXPath

System.XmlPath

System.Xml.XPath

XslTransfrom class is considered obsolete in .NET 2.0 and replaced by the _______ class

XslCompliedTransform

XMLXslComplied

XslTransform

XMLXslTransform

XPathNodeIterator class provides an iterator over a ________ set of nodes.

Elected

Current

Selected

Special

In XML DTD stands for

Document Type Definition

Document Type Development

Development Type Document

None of above

Which of the following true for XML

A serialized data coming in different business transactions

A collection of data coming in range of business transactions

A formatted data coming in specific business transactions

A common data format for data coming in various business transactions

INTERNAL TEST (IT2) JAVA


Batch Code: PRO-201305C

Student Name:________________
Date: 3rd July 2014
Duration: 50 Minutes

______________ is an API provided by Microsoft for accessing the


Database, it uses SQL as its database language.
JDBC
ODBC
MDBC
DBDC

Java application is connected to a JDBC driver using an object of the

___________ class.
JDBCDriverManager
ODBCDriverManager
SQLDriverManager
DriverManager

______________ driver converts the JDBC calls into database specific


calls for databases such as Oracle, MS SQL Server or Sybase.
JDBC_ODBC
Native API/partly Java driver
Net-protocol/all-Java driver
Native-protocol/all-Java driver

______________ interface provides methods for retrieving data returned


by a SQL statement.
Statement
Class.forName
ResultSet
Connection

______________ is a graphical framework that includes abstract window


tool kit, Swing, and Java2D classes.
Java Tool Kit(JDK)
Java Foundation Classes (JFC)
Java Development Kit (JDK)
Java Development Tool (JDT)

______________ is a standalone Application that runs on its own without


depending on the browser.
JFrame
JClass
Java Main Class
Applet
______________ method is called when the applet interface is to be
redrawn, this method accepts a parameter of java.awt.Graphics
class.
init()
paint()
repaint()
draw()

A ____________ manager is a Java object associated with a container,


which governs the placement and size of the component, when it is
added to a container.
Frame
Layout
Applet
Main Class

The Listener object is an object of any class which implements the


ActionListener interface and provides implementation of the

_______________ method.
Actionperform()
ActionPerformed()
Actionperformed()
ActionPerform()

____________ is a protocol that sends independent packets of data from


one computer to another with no guarantee about its transmission.
TCP
UDP
SMTP
FTP

Port numbers ranging from ______________ are reserved.


0 to 6655
0 to 1234
0 to 1023
0 to 1024

If the host does not exist, Socket(String host, int port) throws
___________ exception.
UnknownHostException
HostnotFoundException
HostMissingException
HostNotExistException

Once the ServerSocket instance is created, we can invoke the ______


method to listen for client request.
request()
accept()
listen()
receive()

A _____________ is a standard dialog box that is used to navigate the


file system to choose a directory or a file.
JFileChooser
JColorChooser
JSaveChooser
JOPenChooser

The __________________ is an abstract class with no default


implementation provide your own implementation to specify the filter
criteria.
javax.swing.filechooser.FileFilter
javax.swing.Filechooser.FileFilter
javax.swing.filechooser.filefilter
Javax.swing.filechooser.FileFilter

__________ is a class used to displays group of items, allow to choose


more or one items.
JCombobox
JTree

In order

JTable
JLsit
to support scrolling in JTable ____________ is used.
JScroll
JScrollPane
JScrollPanel
JScrollingPane

18.The rmiregistry program listens on port ___ for incoming request:


(a) 1099

(b) 1024

(c) 80 (d) 1211

19.The ___ is the default layout manager for the content pane of a
swing-based applet.

FlowLayout
Layout.

(b) Card Layout

(c) Border Layout (d) Grid

20.____ is the model used with all Swing components

Java Model
Contorller.

(b) Spiral Model

(c) MVC Model

(d)

21.___class is used to create tree-like structure while__ class is used to


create table-like structure.
(a) JTree, JTable(b) Tree, Table (c) JTree, JScrollPane

(d) JMenu, JItem

___ cursor can move forward or backward and also can be moved to a
particular row relative to the current position:

TYPE_SCROLL_INSENSITIVE

TYPE_FORWARD_ONLY

TYPE_SCROLL_SENSITIVE
TYPE_BACKWARD_ONLY

23. The developer uses the API to make calls to a database with the help
of SQL and retrieve
the results in the _ layer:
(a) Application

(b) Data

(c) Driver

(d) Network.

24. The __ class attempts to locate a driver that can connect to the
database represented by the URL.

Driver Manager
(b) Connection (c) Prepared Statement
(d) Called Statement.

25. A__ object compiles and executes the SQL statement when the
program is executed.

Prepared Statement (b) Called Statement


(d) Execute Statement

(c) Statement

S-ar putea să vă placă și