Dynamic Webpage Design: Java Programming and

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Java ramming and Dynamic Web Page Design

Progra

[B.1

MCQ
JAVA PROGRAMMING AND
DYNAMIC WEBPAGE DESIGN
Java
Q.1. Java is a Successor to which programming
language?
(1) B (2) C
C+ (4) D
Ans.(3) C++
Explanation: C++ introduced O0Ps (Object Oriented
Programming) concepts which are adopted by Java.
9.2. Who invented Java language?
(1) Dennis Ritchie (2Y James Gosling
(3) Larry Page (4) Serge Page
Ans.(2) James Gosling
Explanation : James Gosling along with his team
members Mike Sheridan and Patrick Naughton developed
Java language.
Q.3. What is the original name of Java Programming
language?
(1) J++ (2) C++
0AK (4) TEAK
Ans. (3) OAK
Explanation: Java was named after an OAK tree outside
James Gosling's office.
4. Which laboratory was Java invented or developed
in?
(1) Bell Laboratory (2)Sun Microsystems
(3) Dennis Ritchie (Office (4) Johnson and Johnson
Ans. (2) Sun Microsystems
was also
Explanation: NFS (Network File System)
invented by SUN Microsystems.
amming and DynamicWeb Page Design
[B.2 KPH MCO Java
Pro B.3]
Q.5. The name "JAVA" is known to the world as?
for Bn theie
problem with generation Executable
(1) A Tea Brand in India (2) A Coffee Software (EXE files)?
Q12.h

Brand
A n Island in Indonesia (4) Ragi Malt Juic in Af. 1 Run only on Windows machines.
Ans. (3) An Island in Indonesia Afri (2) Linux and Unix expect a different executable
format
Explanation : Indonesia is a group of than EXE
with Java sea on one side. olcanic T.Islan
Volcanie
8) Compiler for each machine
type like
Q.6. Java Windows and Processor Type needs to Linux, Unix,
language was originally be built for
operating?
(1) TV
developed developed t generating output files that can run.
4 A l l the above.
(2) TV
(3) Embedded System equipment Set-top box
All the abova" Ans.(4) All the above
Ans. (4) All the above.
0.13.What is an Interpreter?
Q.7. What type of Java (1) An interpreter converts instructions line by line
Java supported Web Programs can be run inside (2) An Interpreter converts source code to low-level code
Browser?
(1) Stand alone (2) Struts (3) Interpreters are slow to execute
L Applets (4) AWT 4All the above
Ans. (3) Applets
Ans.(4) All the above
Q.8. Which company owns Explanation: Opposite of Interpreter is a Compiler.
(1) IBM Java at present?
(2) Microsoft Q.14.What is a Compiler?
(3) Sun Microsystems Oracle
Ans. (4) Oracle (1) A Compiler converts all instructions in one go.
(2) A compiler converts source code to low-level code
Explanation : Oracle acquired Sun (3) Compilers work fast
year 2010. Microsystems in the
4All the above
Q.9. What was the reason for Ans. (4) All the above
Java? huge initial
g e nitial
succes
success of Explanation: So a compiler is preferred to
www (World Wide Web) EXpa an Interpreter.
(3)
Smart Home (2) Smart TV Q.15.What is the file name extension of a Java source
Ans. (1) www worldAutomation
Wide Web)
(4) None of theEvolution program?
above
Explanation
INTERNET.
: World
Wide Web is (1)
Ans. (3) java
(2) ja Y java (4) jax
also known as
the
Q.10.What is the advantage of Q.16.Choose a correct statement about Java source files.
(1) Run Faster EXE files? Java files are human readable
(1)
(2) Efficient (2) Java files contain Classes with Methods and
(3) No separate Variables
4All the aboveprogram required to run (3) Import statements import library Classes into our
Ans.(4) All the above class
Q.11.Computer Viruses and
4 A l the above
Ans. (4) All the above
transmitted along with which Trojans
(1) JPG files file are often Compilation
Q.17.What is the output of(2)
of Java Program?
(2) TXT files
3EXE files
Ans. (3) EXE (4) ICO files AY .class file cla file
(4) javax file
files je file
(3)
class file
Ans. (1)
KPH MCQIfor BCA Programming
and Dynamic Web Page Design
va
Java
[B.5]
of?
8.41
code is the
result
Q . 2 4
What is
. W
Portability offered by Java language?
Q.18.Byte
HCompiling
a
Java file
(1) Small code size easy to carry occupying less disk
Class file
a space
Compiling
Java File
(2) Interpreting
a
file (2) Generating suitable Byte Code for each machine by
(3) Interpreting
a
Class
the Compiler
(4) java file (
(1)
Compiling
a

Program?
Ability to
run the Byte on different
mchines
Ans.
compiles a
Java producing the same behaviour and output
software
Q.19.What Runtime
Environment)
(4) Java does not actually provide portability
JRE (Java
(1) Developer Kit) Ans. (3) Ability to run the Byte on different machines
2 J D K (Java producing the same behaviour and output
Virtual Machine)
JVM (Java
(3) Command Prompt
(4) Kit) Q.25.What is JIT in Java?
(Java Developer (1) Java In Timer (2) Java In Time Thread
Ans. (2)JDK Java program on a computasa
software runs a 3 J u s t In Time Compiler (4) Just In Time Runnable
Q.20.What
J R E (Java
Runtime Environment)
Ans. (3) Just In Time Compiler
JDK (Java Developer Kit)
(2) Q.26.Choose the correct statement about Java?
Command Prompt
(3) (1) JIT Compiler produces Byte Code from Java file.
above
(4) None of theRuntime Environment)
Ans. (1)JRE (Java JIT Compiler takes
chunks of Byte Code as input and
produces Executable code on that partieular machine.
stands for?
Q.21.What does JVM (3) JIT Compiler assists the actual JAVAC compiler to
(1)Java Variable Machine compile fast
Java Virtual Machine
(4) None of the above
(3) Java Virtual Mechanism Ans. (2) JIT Compiler takes chunks of Byte Code as input and
(4) None of the above produces Executable code on that particular machine.
Ans. (2) Java Virtual Machine
Explanation: JRE Software creates JVM in the PC. JVM 9.27.What happens in the absence of JIT Compiles in
is implemented differently on different machines and Java?
hardware so that the Byte Code present in the Class filk (1) Byte code is produced slowly
produces the same output. 2Executable Code is produced slowly because of line by
line Interpreting
Q.22.What is JVM1?
(1) JVM is the confined memory area
(3) Executable Code is produced without portability
(2) All java p rograms run inside JVM memory 4) None of the above
Ans.(2) Executable Code is produced slowly because of line by
(8)JVM provides security to the computer by
giv line Interpreting
controlled access to Files and Memory on a computer
4All the above Q.28.What are the main Distribution types of Java
Ans.(4) All the above Software?
Q.23.When was first Java SE (Java Standard Edition)
released? Version of Java i.e. Java Lo wa
(2) Java EE (Java Enterprise Edition)
(1) 1991 (2) (3) Java ME (Java Micro Edition)
1994
Ans. (3) 1996 31996 (4) 1999 4All the above
Ans. (4) All the above
ming and Dynamic Web Page Design
KPH MCO for BCA
r o g r a m m i n g

J a v a

B.6] Vhat is the mand used


Java distribution type used to build Weh Q33.
Command ILine or
to Run B.7)
Q.29.What is the form a
Java
Command Prompt orprogram
Apps in Java? (1)javac hello
2 J a v a EE (2) java hello.class ID? CMD
(1) Java SE 3 java hello
Java Embedded (4) java hello.java
(3) Java ME (4) Ans.( 3 )
java hello
Ans. (2) Java EE
used to build standalone
Explanation: "iava" command
Explanation: Java SE is
apns
expects
with GUI. AWT and Swingsused mainly.
are
without the file name
extension like. .class.only a Class Name
Embedded Chips like IOT a34.What is a Java Editor?
Java ME is used on

Boxes, ATMs and all. (1) Java editor is simply


devices, Vending Machines, Set Top an IDE

with Java Version edit java programs. It does notlike Notepad to type or
Q.30.What is LTS mentioned along Running java programs withouthave ability
n a m e s like Java SE 11 LTs?
or
Compiling
LTS stands for Long Term Support
Java Packages on the PC. installing separate
(1)
LTS Versions are patched for security vulnerabilities
(2) Java editor is like Eclipse IDE that
(2) options or buttons to compile and has shortcut
for up to 5 Years from the release date. run
java programs
without using CMD or Command Line.
(3) Java SE 8 LTS (supported up to March 2022) and
(3) Java IDE searches for the
Java SE 11 LTS (supported up to September 2023) installed
JAVAC, JAVA and JAWAH to Java location for
are available as of now.
programs for you. compile and run
4All the above 4All the above
Ans. (4) All the above
Ans.(4) All the above
Q.31.What is Ahead of Time Compiler in Java? Q.35.Every statement in Java
(1) Ahead of time compiler compiles java files as and
a?
language should end with
when you type and save.
(1) Dot or Period (2) Comma
(2) Ahead of time compiler turns byte code to executable
code line by line based on requirement 3Semicolon (4) Colon
Ans. (3) Semicolon
(3Ahead of time compiler is a replacement for JIT
compiler to translate all byte code to a single Q.36.A function in C language is similar to what in Java
executable file or code to run the program fast and language?
efficient. ( Method (2) Member
(4) None of the above (3) Variable (4) None of the above
Ans.(3) Ahead of time compiler is a replacement for JIT Ans.(1) Method
compiler totranslate all byte code to a
single 37.All methods and variables in Java
executable file or code to run the language are kept
program fast ana inside a?
efficient.
(1) File 2Class or Interface
Q.32.What is the Java command used to (3)
compile jav Ans.(2) static method (4)
a main
program from Command Line Class or
or Interface
Interface
or CMD?
or Command Promp"
(1) OWhat is the need to mention "static" before main
java hello.java
(3) javacomp hello,java 2javac hello.java
(4)>javacmd
method?
T o call main method without creating an objoct of
Ans. (2) javac hello.java hello.java
class
Programming and DynamiC Web Page Design
KPH MCQ for BCA Java

[B.8
class method common to
[B.9)
(2) To make main method as all (1) Passing arguments at compile time
instances 2 Passing arguments at run time
8Both A and B (3) Counting number of words
None of the above
(4) (4) Nothing
Ans. (3) Both A and B
Ans. (2) Passing arguments at run time
Q.39.In standalone Java applications, which method Explanation: C:>java Hello AFRICA GOLDMINE
mandatory? Hello Class name
main method (2) show method AFICA First argument
(3) display method (4) print method
GOLDMINE Second argument
-

main method
Ans. (1) 4 What is the default return type of a method
Explanation: main) is the starting point of execution. language? in Java
Q.40.What is the use of Access modifier "pubie" in Java (1) void (2) int
language? short
(3) 4None of the above
(1) To hide the main method from misuse Ans. (4) None of the above
(2To call the main method outside of Class or Package Explanation: You have to explieitly mention a returnn
by JVM type.
(3) To protect main method
(4) None of the above Q45.Name of a Class, Variable, Method or an Interface in
Java language is called?
Ans. (2) To call the main method outside of Class or Package
by JVM
(1) Argument (2) Value
Q.41.Choose a Single Line Comment in Java Language (3Identifier (4) None of the above
Ans. (3) Identifier
below?
( /Some comments 2) Some comments// Q.46.A valid identifier in Java language may contain
(3) *Some comments*/ (4) */Some comments/* which characters?
Ans. (1) /Some comments (1) 0-9 (2) A-Z, a-z
Q.42.Choose a multiline comment in Java
(3 S,Underscore) Althe above
language Ans. (4) All the above.
below?
(Y Pcomments are going Q.47.A valid Identifier or name in Java language can
cars are moving*/
(1) *Icomments are going
start with which character?
(1) a-z, A-Z (2)
cars are moving/* (3) 0-9 4 A and B
(2) Icomments are going Ans.(4) A and B underscore
cars are moving//
Explanation : Up to JDK 8, only a single
(3) None of the above symbol can be used as an identifier of a class,
method or a

Ans. (1) comments are going variable. JDK 9 does not allow.
cars are moving"/
available in Java
48.What are the valid White Spaces
Q.43.String args[] in main
public statie void
method are used for? language
(1) Space (2) Enter
main(String args|) 4 A l l the above
(3) Tab
Ans.(4) All the above
[B.10]
KPH MCQ for BCA Programming and Dynamic Web Page Design
Java

correct version of Java Documentation


Q.49.Choose
Comment?
a
o58.What is a
Q 5 3 . V

Primitive Data Type in Java?


Data type, which is
B.11)
(1)
(1)
comments comments
oriented way. implemented in an
Object
(2) Data Type which 1s
* */ implemented in machine-
* (4) ** dependent way a
(3) V Data Type which is
comments comments

** oriented way. implemented in non-object a


**|
(4) None of the above
Ans. (2) **
comments Ans. (3) Data Type which is
implemented in
* oriented way. a
non-object
Explanation: Doceumentation comment allows writing
notes about the progr:am. javadoc commmand on the source
o.54.Which among the
tollowing is not a Data Type in
Java?
java file generates a HTML Java documentation with the
(1) short (2) int
embedded comments. 3 l o n g double (4) double
Q.50.What does a Data Type in Java refers to? Ans. (3) long double
(1) The place where data is stored Explanation: "long double" is present only in C language.
(2) The technique how data is retreived
3The type or variety of data being handled for reading Q.55.Which among the following is not valid Data Type a
in Java?
and writing
(4) None of the above (1) long bool
Ans. (3) (3) double (4) float
The type or variety of data being handled for reading
and writing
Ans. (2) bool
Explanation: It is "boolean" not "bool".
Explanation Integers, Real numbers, Boolean,
Characters ete Q.56.Which is the data type used mostly to handle
Q.51.Choose the wrong statement streams and buffers in Java language?
about Java (1) short (2) int
programming?
Java supports unsigned integers (3byte (4) float
(2) Java supports signed integers Ans. (3) byte
(3) Java supports signed char Q.57.Which is the data type that is not recommended for
(4) None of the above
Ans. (1) Java supports unsigned numeric applications in Java?
integers
Explanation: Only C language supports unsigned byte (2) float
(3) int (4) long
integers. Java does not support. Ans.(1) byte
Q.52.Which data type among the following Explanation: Size of a byte is only 8 bits. Als0, any
is an in int, float or
implementation of Objects or OOPs? arithmetic operation produces output
(1) byte (2) int double. It cannot handle more data.
(3) char
4None of the above number range for byte data type in
Ans.(4) None of the above Ohoose the
Java?
Explanation
in
: All primitive data types (1) -127 to +128
( 2 - 1 2 8 to +127
a
Non-Object Oriented way. are
implementea (3) 0 to 256 (4) 0 to 255
Ans. (2) 128 to +127
ramming and Dyna Web Page Design
[8.12) KPH MCQ for BCA ava

Q.59.What is the size of a SHORT integer in Java?


Explanation A
boolean value can
:
B.13)
inform: ation. But the
size hold only
(1) 1 byte ( 2 2 bytes is not defined clearly of a boolean one bit of
(3) 4 bytes (4) 8 by tes
It may be 4 bytes or so.anywhere. It is
constant in
Ans. (2) 2 bytes machine memory
Explanation: Number range is -32768 and +32767. 66.What the IEEE
is dependent.
standard adopted
Q.60.What is the size of an INT integer in Java? Floating point
(1) IEEE 9000
numbers in Java? to
represent
(1) 2 bytes 2 4 bytes (2)
(3IEEE 754 IEEE 800
(3) 6 bytes (4) 8 bytes (4) IEEE 512
IEEE 754
Ans. (2) 4 bytes Ans. (3)
Explanation: Number range is -2147483648 and Explanation: IEEE stands for Institute of
2147483647. Electronics Engineers. Original specificationsElectrical and
in the year 1985. The were defined
Q.61.What is the size of a LONG integer in Java? version includes current
(1) 2 bytes (2) 4 bytes
improvements corrections done in the year
or
2008.
a 67.What is the
( 3 8 bytes
Ans. (3) 8 bytes
(4) 16 bytes character
Java language? encoding standard used in
Explanation: Range: -9223372036854775808 and (1) ASCII (2) Unicode
9223372036854775807. (8) Hexacode (4) Bytecode
Ans. (3) Hexacode
Q.62.What is the size of a FLOAT floating point number
Explanation: Unicode takes
in Java? 2 Bytes of memory to
(1) 2 bytes
represent all characters of all languages.
(2)4 bytes
(3) 6 bytes (4) 8 bytes Q68.What is the abbreviation of ASCIT?
Ans. (2) 4 bytes (1) American Standard Characters for
Information
Explanation: Number range is +3.40282347E+38F Interchange
(2) Australian Standard Code for Information
Q.63.What is the size of a DOUBLE floating point number
in Java? Interchange
(1) 4 bytes American Standard Code for Information Interzhange
(2) 6 bytes (4) None of the above
438 bytes (4) 16 bytes Ans. (3) American Standard Code for Information Interchange
Ans. (3) 8 bytes
Explanation : ASCII can represent only the English
Explanation Number range 1s Alphabets and a few special symbols.
+1.79769313486231570E+308.
Q.64.What is the size of a CHAR data type constant in
.69.Choose
(1)
the right statement about Java Data types.
Java? Integer data types are short, int and long
(1) 1 1 byte (2) Keal number data types are float and double
(3) 4 bytes bytes
(4) 6 bytes
(3) Phe character data type is char.
Ans. (2) 2 bytes All the above
Ans. (4) All the above
Q.65.What is
the size of a boolean
Java? data type constant in .70.What is Literal in Java assigned to a
(1) 1 bit Lateral is the value that is given or

(2) 4 bits variable.


(3) 8 bits
Ans. (4) Not documented Not
well documented well (2) Literal is a data type
KPH MCQ for BCA Java P r mming and Dynamic Web Page Design
B.14]

(3) Literal is similar to String


Q.76.Wha + is a higher data type in Java [B.15
4) None of the above (1) A data type which holds more language?
data
Literal is the value that
1s given or assigned to a types
datathan other
Ans. (1) Adata type whose size is
variable. (2) more than
45.67t, 'C", "abc", false (3) A data type which can other data
Explanation: Examples: 123, hold more types
other data types precision digits than
of Literals available in Ja.
Q.71.What a r e the types Java (4)All the above
language? Ans.(4) All the above
Character and String
(1) Integer and Float (2) Explanation: Float is bigger than short
Boolean 4 A l l the above
(3) double is
Ans. (4) All the above bigger than float
Explanation: Literals are Data assigned to Primitive data
Lata Q.77.An Arithmetic expression in Java involves which
type variables. Operators or Operations?
(1) Addition (+), Subtraction ()
Q.72.What a r e the types of Integer Literals in Java? (2) Multiplication (*), Division ()
(1) Decimal Literals (3) Modulo Division (%), Increment/Decrement
(2) Octal and Hexadecimal Literals Unary Minus (), Unary Plus (+)
(++/,
(3) Bin:a irals
4All the above
L4 All the abovee
Ans.(4) All the above
Ans. (4) All the above
Explanation: JDK 7 introduced binary literals to easily Q.78.Choose the Compound Assignment Arithmetic
set individual bits of a number. Operators in Java below.
Q.73.Choose correct examples of decimal literals in Java. (1) + (2) =
(1) int a =12345; (3) % YAll the above
(2) int the
a 12 3 5;
=

Ans. (4) All the above


(3) long a
Ans. (4) All the above
=
987654 3 _21L; 4)All above
Q.79.What is the output of the below Java code snippet?
Explanation : To represent big numbers, simply append int a = 2-- 7;
letter 'l or 'L' to the number to make it a long integer. This System.out.println(a);
avoids compiler errors saying "out of range" 10
(1) -5 (2)
48) 9 (4) Compiler Error
Q.74.An Octal number is Java is represented with a
leading? Ans. (3) 9
(1) 0 (Alphabet) Explanation: Minus of Minus is Plus. So 2 7 becomes
O (ZERO) 2+7.
(3) Ox (4) OX
Ans. (2) in
0 (ZERO)
80.What is the other name for Relational Operators
Explanation: Eg. int a=0765; Java? Conditional operators
Q.75.Choose correct ranges for Decimal, Octal and
(1) Comparison operators (2)
None of the above
Hexadecimal numbers in Java? A and B (4)
(1) Decimal: 0 to 9 Ans. (3) A and B
are
(2) Octal: 0 to 7 number of
operands
minimum
(3) many Java?
Hexadecimal: operators in
o w

0 to 9 and
44 All the above
Ato Fla to f equired to use
Comparison
4
Ans. (4) (3) 3 (4)
All the above (1)1 ,(2)2
Ans. (2) 2
KPH MCO for BCA
B.16) the left J a v a
Programming and Dynamic Web Page Design
one o n
//Two operators
Explanation:
lone on the right. Q.88. IF-ELSE statement is also B.17
if(a = b) (1) Branching statement called
(2) Control statement
Q.82.What are the types of
data that c a n be used al.
long (3) Block statements
Java?
operators in A4All1
with Relational
Ans.(4) All
(1) char, boolean, Object
byte, short, int, long Explanation: 3lock
(2)
nded by Bracesand statements are
those that are
(3) float, double
(4)All the abovee also called a Block
.
statement.
So, a usually
WHILE statement is
Ans. (4) All the above IF o r ELSE IF
of Java
Q.89.An statement accepts
Q,83.Choose the Conditional operators listed before branching. as input
below. (1boolean
(2) int
(1) (2) , (3) float (4) char
= 4 A l l the above
(3) Ans.(1) boolean
Ans. (4) All the above
Q.84.Which operator group has higher priority between 9.90.An IF statement in Java is also a
F}?
(1) Boolean
(2conditional statement.
> < , <) and ( (3) iterative (4) optional
(1) P>=, s h a s lower priority (=, != Ans. (2) conditional
(2(>, >5< < has higher priority ( S 9
(3) ,5,5, <has equal priority with ( !=) Q.91.A SWITCH case statement in Java is
(4) None of the above statement.
a
control
Ans. (2) (, =,<, <has higher priority ( , (1) Iteration ( Loop
Q.85.What are the two possible Logical Operator types? 3)Selection (4) Jumnp
Ans. (3) Selection
(1) Bitwise Logical (2) Boolean Logical
(3) Arithmetic Logical ( 4 A and B Q.92.Which is the alter:native to SWITCH in Javi
Ans. (4) A and B language?
Q.86.What is the other name for a Question Mark - Colon (1) break, continue (2) for, while
(2:) operator in Java? (3)if, else (4) goto, exit
(1) Special Relational operator Ans. (3) if, else
(2) Special Logical Operator Explanation: We can implement a SWITCH statement
(3)Ternary Operator using IF, ELSE IF and ELSE control statements.
(4) None
Q93.What are the keywords used
Ans. (3) Ternary Operator
to
implemen
SWITCH case in Java language?
Q.87.Java Ternary operator is sometimes called. (1) switch, case (2) default
(1) Relational Operator (3) break (4) All
(2 Conditional Operator Ans (4)All
(3) Logical Operator
(4) None .94.What are the parts of a SWITCH in java?
Ans. (2) Conditional Operator (1) switch input condition
(2) case constants
avaProgramming
ng and Dynamic web Page
KPH MCQ for BCA Design
[B.18) .101.In
Java language, an array index 8.19
(3) case s t a t e m e n t s (1)
1
0 (3) 1 4) starts with
Ans.( 2 )
0 Any integer
J4All
Ans. (4) All Which are the special symbols
programming language? array in Java? used to
Q.95.What is a Loop in Java declare an
( ALoop is a block of code that is executed atedly (1) Braces {} (2) Parentheses 0
condition is satisfied. (Square Brackets [] (4) Angled
ngled Brackets
as long as a

block of code that is executed only once if Ans. (3) Square Brackets []
ns.(3) Bracke <>
(2) A Loop is a
the condition is satisfied. Which the
A Loop is a block of code that is executed more than2 special symbols used to
are
he time of the
declaration itself?initialize an
at
(3) array
times if the condition is satisfied. (1) Parentheses ()
(2) Square Brackets []
(4) None (3Braces {} (4)
Ans. (1) A Loop is a block of code that is executed repeatedly Ans.(3)
Ans.(3)
Braces{} Angled Brackets <>
as long as a condition is satisfied. Explanation: int|| nums {1,3,6); =

Explanation: A Java loop is similar to a C style looop.


104.If an index ot an element is N, what is its actual
Q.96.Choose a valid loop name in Java below. position in the array?
(1) for (2) while (1) N-1 (2) N (3) N+1 (4) N+2
(3) do while 4 All Ans.(3 N+1
Ans. (4) All Explanation: Array index starts with 0. So, an index of 6
means 7th position. An index of N
Q.97.An Array in Java is a collection of elements of means, N+1 position.
data type. 9.105.The name of an array
variable or identifier
start with can
()Same (2) Different
Ans. (1) Same (1) A letter (2) Underscore (-)
(3) Dollar Symbol (S) (4)All
Q.98.The Java Virtual Machine (JVM) implements arrays Ans. (4) Al
as type.
(1) Primitive Q.106.What is the default value of an element of Object
Object type array?
Ans. (2) Object
(1) 0 (2) null (3) -1 (4)
Explanation: That is the reason why Java Array has Ans. (2) null Garbage value
predefined methods.
Explanation Objects can be String, ArrayList,
Q.99.Unlike C-Arrays, the Java-Arrays have, HashMap, HashSet etc.
(1) Names (2) Values Q.107.What is the default value of float or double data
43 Methods and Fields (4) None type elements of an array in Java?
Ans. (3) Methods and Fields (1) 0 (2)0.0 (3) 1 (4) 1.0
Ans. (2) 0.0
Q.100.An array declaration in Java without
memory. initializar Q.108.What ie the default
value of a
1Does not allocate (2) elements of an array in Java?
char data
yp
Ans.(1) Does not allocate Allocates memory
An (1) 'A' (3) null (4 null
Ans. (4) \0' or (2) 0
or

Explanation : Only initialization null


allocated. causes memory
Explanation: null is nothing bu 0.
[B.201
PH MCO na a n d
ava Programming and Dynamic Web Page
for BcA Design
arrays in Java is called
Q.109.An array of array. perties are implemente
(1) Bidirectional (2) Combo
116.Pr

(1)
Methods using B.21)
( 3 Multidimensional (4) Multi-value Interfaces Variables in Java.
(3) (4) All the above
Ans. (3) Multidimensional Ans.(2) Variables

of dimension N contains
Q.110.An array
subscripts or brackets?
numberr o g117.A ass in Java is like a
Prototype (2) Instruction Sheet
(1) N-1 ON (3) N+1 (4) 10*N
(3) Blueprint AAll the above
Ans. (2) N Ans.(4) All the above

Q.111.Row number and Column number aQ118.Whichis file


in extension used for
Multidimensional array start with
(1)-1 ( 2 0 (3) 1 (4) 2
class source code? public Java
a

(1)j (2) class (3) java


Ans. (2) 0
Ans
(8)java (4) None
Q.112.A 4-dimensional array is an array of
dimensional arrays. a119.Which is the file
extension uused for
(1) 4 3 (3) 2 (4) 1
Java class file? a
compiled
Ans. (2) (1) j (2) java 3.class
3
.class
(4) .cls
Ans. (3)
Explanation: An N-dimensional array 1s an array ot (N-1)
dimens1onal arrays. a120.After compilation, an Interface or Abstract-Class is
kept in a file in Java
Q.113.Choose the correct way of initializing (1) java
programming.
multidimensional array below.
a (2) cls
3.class (4) .interface
1intD0 code = {1,2),13,4,5}}; Ans. (3) class
(2) int[2]0 code {{1,2),{3,4,5}};
= Explanation: All compiled Java classes, interfaces and
abstract classes are kept in a .class file
(3) int00 code={1,2,3,4,5}; only. All source
files are kept in .java files.
(4) All
Ans. (1) int[|| code Q.121.In Java, the keyword used to declare a class is
{1,2},{3,4,5}};
=

Explanation : We should not mention the size of any row 1Class (2) Java (3) class (4) java
or column. Ans. (3) class
Q.114.Java is a, programming language. Q.122.A Java class can contain
(1) Functional 1) Variables
(3) Theoretical 20bject-Oriented
(4) All the (2) Methods, Constructors
Ans. (2) Object-Oriented above
(3) Inner Classes (A class inside another class)
Explanation: Everything in Java is 4All the above
Object-Oriented piinciples. implemented usiu Ans. (4) All the above
Q.115.In Java
programming language, the ced How many maximum numbers of objects can be
inside code is
plac Created from a single Class in Java?
(1) Classes, Inter+aces (1) 32 None
(3) Blocks (2) Methods An: (2) 64 (3) 256 4
4All the above Ans.(4) None
Ans.(4) All the above limit the number of objects
planation: There is no on

being created from a ciass.


Dynamic
Wa
eb Page Design
o r o g r a m m i n g
and
B.23)
a d d aa
to a constructor to convertit
[B.22] KPH MCO AlBI.ln
Java,

forrBR
CA a
f31.In i n t oa method.

Q.124.Creating an object from a class is also called if


statement
(2) static
(1) Initializing (2Instantiating
(4) None of the
(3return type (4) semicolon
(3) Interfacing above return type
Ans. (2) Instantiating (3)
s .(3)
Aas.
method signature is a combination of
A n s

Q.125.The keyword used to create a new


object in J
Java
. is
132.Java
Return type (2) Method name
(1) Argument List 4 A l the above
(1) class (2) ava (3) above
Al the
(3new (4) create Ans. (4)
method without
Ans. (3) new constructor is like a
a 133.A Java ( 2 return type
statements
Q.126.An object is created at time in Java. (1) argument list (4) None
(1) Compile-time (2)Run time (3)
Ans.(2) return type
(3) Assembling time (4) None of the above
inside a class
Ans. (2) Run time placement of a constructor
Q134.The
should be
Q.127.In Java Pass by reference is passed of class
even if yo MAlways at the beginning
are passing a reference to an object. the end of class
1Address value (2) Always at
(2) Variable value the class
(3)
Hash code (3) Anywhere in
(4) None of the above (4) None
Ans. (1) Address value
Ans. (3) Anywhere in the class
Explanation: Yes. The address is passed is
Java. So, Java purdits
argue that it is
automatically by 0 135.The
Q.135.The purpose or
purpose
constructor
of aa Java les with passed data
(Address). passing a
value of variables with passed da
Initialization
(1)
(2) Writing custom code
Q.128.A Java reference is Accepting other objects
as inputs
language.
comparable to in C (3)
(4All the above
(1) Enum (2) Structure All the above
Ans.(4) object once the
(3Pointer (4) None allocated to an object
ond

Ans. (3) Pointer .136.Memory is in Java


language.
is over
execution of.
Q.129. Jis the superclass to all Java classes either (1) main method
2constructor

(4) None
user-defined or built-in. (3) destructor
(1) Class Ans, (2) constructor the
(3) Superclass 20bject
(4) Null successfully
overload a
method in Java,

Ans. (2) Object Q.137.To


be.
return types must
Explanation: Yes. java.lang.Object is the (1) Same types also
Java classes. superclass to a (2) Different sunerclass
or
subclass

Same but
using
Q.130.A Java method is
comparable to
8)
a work also
language. in
None or
subclass types
(1) structure (2) (4) but using
superclass
union Same
(3 function Ans. (3)
(4) enum work
Ans. (3) function
[B.24] KPH MCa for BCA ning and
a v aP r o g r a m m i n g a n d

DynamicWeb Page Design


Q.138.Uses a r e Recursion in Java a r e (1) Single Inheritance 18.25)
(1) Traversing folders and files on a disk ulti-Level
(2) heritance,
(2) Traversing the nodes of a Binary Tree
Nth order equations and Factorials
(3) Multiple
4 A l l the above
Hierarchical Inheritance
Inheritance, Hybrid
Inheritance
(3) Evaluating
44All the above Ins.(4)
All the above
Ans. (4) All the above xplanation: Java
Q.139.What are the features of an Object
erclass. Multile tilevel supports
inheritanceextending
is
fromonly one
Oriented ava. Whereas
Multiple completely supported
Programming (0OPs)? based on and.Hybrid
Supported Multiple-Superlclasses
on Mult,
(1) (2) Encapsnlation
Inheritance by Java. scenarioinheritances
and hence
are
not
(3) Polymorphism4Allthe above
is method
Ans. (4) All the above Q145.Wha

Writing a
overriding in Java?
method in
Q.140.What are the features reused using Inheritance of superclass's method
a
subclass with the
in same name
Java? (9
(1) Methods Variables
Mentioning the same return type of the
(2) superclass method of the
(3) Constants 4 A l l the above (3) The argument ist in the method subclass
Ans. (4) All the above method of superclass should be theofsame and the
Explanation: Variables and Methods are reused through 4All the above
inheritance. Constants are nothing but variables only if Ans. (4) All the above
they hol& some value.
9.146.An abstract class in dava can be created
Q.141.The class that is being inherited or subclassed keyword using the
is
called (1) final (2) interface
(1) Subclass 2Supercless 8 - abstract (4) static
Ans. (2) Superclass Ans. (3) abstract
Explanation: Superclass or Super-Class Q.147.An interface in Java is like a 100%
Q.142.The class that inherits an already defined class is (1abstract class (2) public class
called (3) inner class (4) anonymous class
(1) Subclass Ans. (1) abstrect class
(2) Superclass
Ans Subclass Q.148.What is a package in Java?
Explanation : Subclass
1)AInterfaces,
Package is collection of files of type Java Class,
a

Q.143.Java language supports _type of inheritance.


or Abetract Class
(1) Mutiple Inheritance (2) A Package is simply a Directory or Folder with Java
(2Multi-Level Inlieritance Classes
Ans. (2) (6) A Package usually contains Java Classes wzitten for
Multi-Level Inheritance
Explanation a specifie purpose or problem
complicated.
Multi-Level Inheritance is somewhat 4Al the ebove
Ans.
(4) All the above
Q.144.What are the types of
Inheritances (Whether Java Java Package
49.Choose the correct syntax of a
suppcrts not) available
or
in
Object-Oriented below.
Programming Languages?
package PACKAGE_NAME;
PH MCO
[B.26] for BCA JavaP
mming and Dyna Neb Page Design
(2) package PACKAGE_NAME,*;

pkg
pkg PACKAGE_NAME;
(1) Javascript (2) CSS B.27)
4) pkg PACKAGE_NAME.*;
3HTML (4) SQL
Ans.(3)
HTML
Ans.(1) package PACKAGE_NAME;
declaration statement planation: Applets are
Explanation: A package
but not with *. uld within an HTML page. designed to be
embedded
end with a package name
to declare a Java packa. hof the following
Q.150.The keyword used Q . 1 5 6 . W h

is
required to
applet? view an
2package (1) JCM (2) JDM GY JVM (4) Java
(1) pkg
(3) pkge (4) None of the above Ans. (3) JVM class
Ans. (2) package AExplanation: A JVM is
required to view an
Explanation: package be ther
JVM can
plug-in
a
of the Web applet. The
separate runtime environment. browser or a
Q.151.What is the maximum number of Java Class
that can be kept inside a single Java Package? iles
(1) 8 (2) 64 (3) 128 4Unlimited
Q157.Which method is automaticallv
browser calls the init method? called after the
Ans.(4) Unlimited start (2) stop (3) destroy
Explanation: There is no limit. A Java package can Ans.(1) start (4) paint
accommodate as many files as the disk can hold.
Explanation: start: This method is automatically called
Q.152.The name of a package is the name of the after the browser calls the init method. It is also
called
Java. n whenever the user returns to the page
applet after having
the containing
(1) folder gone off to other pages.
(2) All parent folders separated by DOT symbols Q.158.Which method is only called when the browser
(3) All parent packages separated by DOT shuts down normally?
4All the above symbols
Ans.
(1) start (2) stop 3
'destroy (4) paint
(4) All the above
Ans.(3) destroy
Q.153.The keyword used to import a
package into Java| Explanation : destroy: This method is only called when
class or Interface is_ the browser shuts down normally. Because
applets are
(import
(3)
(2) download meant to live on an HTML page, you should not normally
use
(4) None of the above leave resources behind after a user leaves the page that
Ans(1 import contains the applet.
Explanation: import Q.159.Which of these operators can be used to get run
Q.154.An applet is a Java class that extends time information about an object?
(1) the?
java.Applet class (2) java class (1) getInfo (2) Info
(3) Applet class
4java.applet.Applet class
Ans.(4) java.applet.Applet class 8instanceof (4) getinfoof
Ans.(3) instanceof
Explanation: An applet is a Java class Xplanation : instanceof can be used to get run time
that extends i"
java.applet.Applet class information about an object
Q155.Applets are designed to be 160.Which method the audio clip to replay
embedded within a causes

continually?
(1) public void play0 public void loop0
[8.28] KPH MCQ for BCA Java
Programming
Dynamic Web Page
(3) public void stop0 (4) None of the above
+ion :
Design
Explanation
AWT stands for
Ans. (2) public void loop0
Explanation: public void loop) : Causes the audio clin +.
it is used by applets to Abstract Window B.29)
interact with
replay continually
to Which the container that th user.
Q.165.Wh: is Toolkit,
ave
Q.161.paint) is an abstract method defined in AWT.
can have
MenuBars.It
can have
ike button, textfield etc.?
contain
other
title bar
and
( TRUE (2) FALSE
(1) Panel components
(3) Can be true or false (4) Can not say
Ans. (1) TRUE (3) Window SFrame
(4)
Explanation: paint) is an abstract method defined in Ans. (2) Frame Container
AWT. ae
which is
Q.166.Which
component in AWT that can
a

Q.162. ethod is defined in another components like


is used to output a string in an Graphics
applet.
class, it etc.? buttons, textfields,contain
labels
(1) Window
(1) display0
(3drawString0
(2) Print)
(4) transient() (3) Panel Container
(4) Frame
Ans. (3) drawString0 Ans. (2) Container
Explanation: drawString) method is defined in Graphics 0.167.AWT is used for GUT programming in
class,
it is used to output a
java?
in an string applet. 1True (2) False
Q.163.What will be output for the following code? Ans. (1) True
import java.awt. 9.168.The following specifies the
import java.applet.*; It is lightweight. advantages of
public class myapplet extends Applet It supports pluggable look
and feel.
It follows MVC (Model
public void paint(Graphics g) View Controller)
architeçture.
(1Swing (2) AWT
g.drawString"A Simple Applet", 20, 20); (3)
Both A & B (4) None of the above
Ans. (1)Swing

A Simple Applet Q.169.Swing is not a part of JFC (Java Foundation


(2) A Simple
Applet 20 20 Classes) that is used to create GUI application?
(3) Compilation Error (1) True
(4) Runtime Error Ane. (2) False
2False
ns. (1) A Simple Applet Q170.Which class provide_
Explanation: A Simple Applet be output for many methods for graphics
ccde the following programming?
(1) java.awt (2java.Graphics
Q.164.What does AWT stands for? None of the above
Ans. (3)java.awt.Graphics
(4)
(1) All Window Tools java.awt.Graphics
(2) All Writing Tools
11.These two ways are usd Frame
L3Abstract Window Toolkit to create a

(4)
Ans. (3)
Abstract Writing Toolkit Dy creating the object of Frame class (association)
Abstract Window Tooikit By extending Frame class (inheritance)
( True (2) False
Ans. (1) True
KPH MCO for
[B.30 CA J a v a ming and Dynamic Web Page Design
P r o g r a m m i n g

are required
to perform
Q.172.The Following steps
9.172.The Following hat is an event in
(1) Implement the
Listeneretener
interface
intertace and overrideo
overrides
it. 1
Q 1 7

delegation event model usedB.311


its Java programr language?
methods
the Listener
A n event is an obje
hat by
Register the component with describes a state
(2) a sourcee

(1) Exception Handling (2)


String Handling
None of the above (2) An event is an
ject that describes
change in
E v e n t Handling (4) a
processing state change in
Ans. (3) Event Handling An event is
(3) object that
an

Q.173.In which places put the event handling coda the user and system describes any change
can
by
(1) Same class (2) Other class An event is a clasS used for
Anonymous class 44 All mentioned above events defining object, to create
(3)
Ans. (4) All mentioned above . (1) An event is an object that describes
a source
a state change
Q.174.Which package provides many event classes and
Listener interfaces for event handling? Explanation:
change n
An event is
a source.
an object that describes a state
(1) java.awt (2) java.awt. Graphics
(8 java.awt.event (4) None of the above 0 180.Which of
these methods are used to register
Ans. (3) java.awt.event
keyboard event listener? a

(1) KeyListener) (2) addKistener)


Q.175.To use the ActionListener interface it must be 3addKeyListener) (4) eventKeyboardListener0
implemented by a class there are severai ways to do Ans. (3) addKeyListener)
that find in the following?
(1) Creating a new class 0.181.Which of these methods are used to register a
mouse motion listener?
(2) using the class the graphical component
(8) an anonymous inner class (1) addMouse0
4All mentioned above (2) addMouseListener)
Ans. (4) All mentioned above , (3addMouseMotionListner0
(4) eventMouseMotionlistener0
Q.176.The ActionListener interface is not used forAns. (3) addMouseMotionListner)
handling action events?
Q.182.What is a listener in context to event handling?
(1) True False
Ans. (2) False (1) A listener is a variable that is notified when an event
occurs
Q.177.The ActionListener interface is used for handling 2 A listener is a object that is notified when an event
action events,For example,it's used occurs
by a
(1) JButton (2) JCheckbox ) A listener is a method that is notified when an event
(3) JMenultem (4 All of these Occurs
Ans. (4) All of these (4) None of the mentioned
(4) A listener is a object that is notified when an event
Q.178.Which of these
package contains classes an occurs
interfaces for networking? xplanation: A listener is that is notified when
a object
(1) java.io requirements first, it
(2) java.util event occurs. It has two major
aul

Y java.net (4) java.network with one or more


sources to

Ans. (c) n a v e been registered


java.net notification about specific event types,
and secondly
Eve receive and process
tnese

must implement methods to


notifications.
and Dynamic Web Pago Dosign
KPH MCOfor tova Programming.

832 BCA ect the packages


defined in which of these librario.. B.32)
2189,

Q.183.Event elass is
java.lang
es? Q.189.50
defined? which JDBC
(1) java.io (2)
4java.util
1) jdbc and javax.jdbe classes are
(3) java.net
rdb and javax.rdb
Ans. (4) java.util (2)
(3) jdbc and java.jdbc.sql
Q.184.Which of these methods
can be used to deter
the type of event? mine 4 s q l and javax.sql
and
IgetlDO (2) getSource0 Ans.(4) sql javax.sql
(3)getEvent0 (4) getEventObject) 90.Thin driver is also known as?
Q190,

Ans. (1) getIDO 1Type 3 Driver


be used to determine the (2) Type-2 Driver
Explanation: getlD0 can
type ( 3 Type-4 Driver
an event.
of (4) Type-1 Driver
Ans.(3) Type-4 Driver
Q.185.Which of these class is super class of all the evento
(2) EventClass 1.What is the orrect sequence to
EventObject create
(3) ActionEvent (4) ItemEvent
connection? a
database
Ans. (1) EventObject (i) Import JDBC packages.
Explanation: EventObject class is a super class of all tha
the
Open a connection to the database.
events and is defined in java.util package. (iii) Load and register the JDBC driver.
(iv) Execute the statement object and
Q.186.Whieh
is manipulated?
of these events will be notified if scroll bar
query resultset. return

(1) ActionEvent (2) ComponentEvent


(v) Create a statement object to
perform a query.
( 3 AdjustmentEvent (4) WindowEvent
(vi) Close the resultset and statement
(vii) Process the resultset. objects.
Ans. (3) AdjustmentEvent
(viii) Close the connection.
Explanation: AdjustmentEvent is generated when a
scroll bar is manipulated. (1) i, i, ii, v, iv, vii, "rii, vi
(2)i, ii, ii, v, iv, vii, vi, vii
Q.187.Which of these events will be generated if we close (3) ii, i, i, iv, vii, vii, v, vi
an applet's window?
(1) ActionEvent
(4) i, 1i, ii, iv, v, vi, vii, vii
(3)
(2) ComponentEvent Ans. (2) i, ii, i, v, iv, vii,
vi, vii
AdjustmentEvent .(4 WindowEvent
Ans. (4) WindowEvent Q.192.Which of the following method is used to
Explanation : WindowEvent is generated when perform
a window DML statements in JDBC?
is activated, closed,
opened or quit.
deactivated, deiconfied, iconfied, (1) executeResult) (2) executeQuery0
(3-executeUpdate0
Ans. (3) executeUpdate)
(4) execute)
Q.188.What are the major components of the JDBC?
DriverManager, Driver, Connection, Statement, ai 193.How many transaction isolation levels provide the
ResultSet JDBC through the Connection interface?
(2)
(2) DriverManager, Driver,
(3) Connection, and
Statement (1) 3 (24 (3) 7 (4) 2
(4)
DriverManager, Statement, and ResultSet Ans. (2) 4
DriverManager, Connection,
ResultSet Statement, and

Ans.(1) 194.Which of the following method is static and


DriverManager, Drivr. C'onnectio, Statement, Synchronized in JDBC API?
ResultSet a getConnection(0 (2 prepareCall)
KPH MCQ WaPrOgrammin
ramming and
Dynamic Web Page
34] for
BCA Design
(3) executeUpdate0 (4) executeQuery0
A 2 0 1 . V
he
hich of the
heading
following
in HTML?
tag is used
for B.35)
Ans. (1) getConnection)
required to load a dato
a database
l a r g e s t .

28.9M
inserting the
Q.195.Which methods are
652
driver in JDBC?
Exception Handling in Java
(1) getConnection) (2) registerDriver)
4Bothb and c
Excep
<h3>
(2hl> (3) <h5> Javatpoint
-

(3) forName0 () h5>


Ans. (4) Both b andHc Ans.(2) ch1> (4) sh6>
<h6>
Explanation: The <hl> tag
Q.196.Parameterized queries can be executed by? is used to
heading or the highest level insert the main
(1) ParameterizedStatement heading.
2PreparedStatement Q202.Wh
.ah of the following tag is used to
(3) CallableStatement and Parameterized Statement break in HTML? insert a line-
(4) All kinds of Statements
<br> (2) <a> (3) Spre>
Ans. (2) PreparedStatement
Ans.(1) <br> (4) <b>
Q.197.Which of the following is not a valid statement in Explanation: The <br> tag in the
HTML docun
JDBC?
1Sed to create a line break in a text. cument is
If we place the
(1) Statement (2) PreparedStatement ag in HTML code, then it works the same as <br>
QueryStatement (4) CallableStatement enter key in a word processor. pressing the
Ans.(3) QueryStatement
0203.How to create an unordered list
Q.198.HTML stands for (a list with the list
(1) items in bullets) in HTML?
HighText Machine Language
(2) HyperText and links Markup Language (<ul> (2) <ol> (3) <li> (4) <i
3HyperText Markup Language Ans.(1) <ul>
(4) None of these Explanation : The <ul> tag in HTML is used to
display
Ans.(3) HyperText Markup Language the list items in a bulleted format. There can be four
types
of an unordered list: disc, circle, square, and none.
Q.199.The correct sequence of
webpage is - HTML tags for startingg a
0204.Which
Q.204.Which character is used to
to represent
represent the
the closing
closing of
ot
(1) Head, Title, HTML, body a tag in HTML?
(2) HTML, Body, Title, Head
(1) (2) !(31 (4)
(3) HTML, Head, Title, Body Ans.(3)
4 HTML, Head, Title, Body
Ans. (4) HTML, Iead, Title, Body Explanation The forward-slash ( character is used to
Explanation: The correct sequence of HTML tags indicate the closing of a tag in HTML.
to start
a
webpage is html, head, title, and body. .205,How to create an ordered list (a list with the list
Q.200.Which of the items in numbers) in HTML?
making the text following element is responsible
bold in HTML? 10 (1) <ul> (2 <ol> (3) <i> (4) <
pre>(1) Spre> (2) <a> Ans. (2) <ol>
Ans. (3) <b> 8 <b> (4) <br> display
Xplanation : The <ol> tag in HTML is used todifferent
Explanation: The <b> (bold tag) tag 1st items in a numbered format. There can be
display the written text in bold in HTML is used C
wpes of numbered list: numeric number, capital alphaber,
format.
Simall alphabet, etc.
KPH MCQQ and Dynamic Web Page Design
B.36]
is responsik
for BCA gramming

Q.206.Which of the
making the text
following element
italic in HTML?
nsible fo (4)
<input type = "check"

<input type = "checkbox>


B.37)
i (2) (3) <it> italic> (4) pre> Ans.(1)
:To create a
6xP
Explanation

checkbox
and give the valuein HTML, we have
Ans. (1)
(italic tag) tag in HTML
input> tag
use the <input:
Explanation: The <i>
format.
L isis used t attribute. checkbox to its typeto
display the written text in italic
of the
Q.207.How to insert a n image
in HTML?
2.Which
following list?is used to define
in a drop-down selectiontag
(1) img href "jtp.png" > = options
>
(1) select>
(2) list>
(2) img url =
"jtp.png" (3) <dropdown>
(3) Simg link "jtp.png" />>
=

Ans.(4) Coption>
option>
M img src "jtp.png" />
=
Aas The
Ans. (4) imgsrc= "jtp.png" >
3xplanation:
options in
<option> tag in HTML is used
Explanation: The img tag and the src attribute is used . define a
opdown list within <select> to

display an image on the webpage. sed to datalist> element. A


dropdown list must have
or
<option element. at least one
Q.208.How to add a background color in HTML? 0.213.HTML tags are enclosed in
(1) Smarquee bg color: "red">
Smarquee bg-color = "red"> (1) # and # (2) {and}
(2) !and?
(3) Fmarquee bgcolor = "red"> (3) 4 and>
Ans. (4) <and>
(4) <marquee color = "red">

Ans.(3) Smarquee bgcolor = "red"> Explanation : All HTML tags must be enclosed within
angular<> brackets.
Explanation : The bgcolor attribute is used to set the
background color of an HTML element. 0.214.Which of the following tag is used to add rows in
the table?
Q.209.<input> is: (1) <td> and </td> (2) th> and </th>
(1) a format tag. (2an empty tag
(3) All of the above (3) <tr> and </tr> 4) None of the above
(4) None of the above Ans. (3) <tr> and </tr>
Ans. (2) an empty tag
Explanation The
Explanation: The <tr> tag in HTML is used to define the
:
<input> tag in HTML is used
to rows in the table. It can consist
represent form one or more <th> head
a
input control in HTML document. cells and <td> data cells to define a single row of HTML
Q.210.Which of the following tag is used to make the | table.
underlined text?
(1) i. 215.The <hr> tag in HTML is used for :
(2) <ul> (3 <u> (4) spre>
Ans. (3) <u> (1) new line (2) vertical ruler
Explanation : The <u> (underline tag) tag in (3) new paragraph 4horizontal ruler
used to HTML is Ans. (4) horizontal ruler
display the underlined
underlined text, but it can text.
be
It rendered as8 a
So Explanation: The <hr> tag is used to specify a

properties. changed using CSS paragraph-level thematic break in HTML document. It is


called a horizontal rule and draws a horizontal line.
Q.211.How to create checkbox in HTML? a
216.1
<input
(2)
type "checkbox"> = of the following attribute is used to provide
a unique name to an element?
<input type "button"> =

(3) <checkbox> (1) class 42id


(3 type (4) None of the above
Ans.(2) id
gramming and Dynamic Web Page Design
KPH MCO for BCA To
Esplanation
Explanatio
apply a
:

specify ackground
838) used
to specify a we, have to image on entire
Explanation:
element
The id attribute18
of the
HTML document. It alloo unique
allocates the
document,

he <body>
of the HTML
docume
the Dac
background attribute in
id for an
be used the JJavaScript
by the avaSeth
and are the
unique identifierwhichtasks.
can
921.What types of unordered or bulleted
CSS to perform
certain HTML? list in
in
tag is used to d:. (1) disc, square, triangle
Q.217.Which of the following
effect?
HTML
display (2) polygon, tnangle, circle
with scrolling disc, circle, square
the text (2) scroll>
(<marquee>
(4) None of the above (4) All of the above
(3) <div> Ans. (3) disc, circle, square
Ans. (1) <marquee>
<marquee> tag
is a
-standard
non-stana. Ansnlanation: The unordered
bulleted list in HTML is
or
Explanation: The used to display the elements in
used to scroll a text
or
image eitha bulleted format.
a
HTML element that is
there are three types of an Mainly,
unordered list: disc, circle,
In simple words, we can sav tthat and
horizontally or vertically. text in up, down. la
square.
scrolls the image or
it automatically
and right direction.
Which of the following is the
paragraph tag in
HTML?
following HTML tag is the special < pp> (2) <b> (3) <pre> (4) None of the above
Q.218.Which of the >

formatting tag? Ans.(1) sp>


(2) <b> Explanation: The p> (paragraph tag) tag in HTML is
(1) <p None of the above define
43 pre> (4) used to a paragraph in a webpage. The HTML <p>
tag indicates the starting of new paragraph.
Ans.(3) spre>
Explanation: The HTML <pre>
tag is used to specify pre.
tags in HTML are :
formatted texts. Texts
within tag isQ.223.The
pre>..</pre>
(1) case-sensitive (2) in upper case
font. Usually, it is displayed in
displayed in a fixed-width not case sensitive (4) in lowercase
courier font. It maintäins both
line break space. not case sensitive
Ans. (3)
is the container for <trm,
Explanation: HTML is a case-insensitive language,
Q.219.Which of the following which means we can use tags either in the upper-case or in
sth>, and <td> ? lower-case. It is recommended to write all tags in the
(1) <data> ( 2 <table>
lowercase for readability, consistency, etec.
(3) group> 4) All of the above
be used for a servlet?
Ans. (2) stable> .224.How constructor can

is generally
Explanation: The <table> tag in HTML, a
(1) Initialization
We can create
used to display data in tabular format. (2)Constructorfunction function
table to display the data in the tabular form using tne (3 Initialization and Constructor
<table> element, with the help of <tr>, <th>,
and <t0| (4) Setup) method
Ans. (3) Initialization and Constructor function
elements.
We cannot declare
constructors for
Explanation cannot enforce this
Q.220.Hoy to insert a background image in HTML? nterface in Java. This
m e a n s we
implements
Servlet
which
<body background= "img.png> equirement to any class
(2) img background = "img.png"> interface. ServletConfig
object tor

(3) <bg-image = "img.png>


Also, Servletrequires
container.
(4) None of the above nitialization which is created by
Ans. (1) <body background "img.png">>
=
[B.40
KPH MCQfor BCA a PrOg/amming and Dynamic Web
Page Design
servlet class declare constructor
with rOvO method is
Q.225.Can
ServletConfig object as an argument? executed doPilter method called after the
B.411
(1) True (2False 8) The destroy) method filter has
Ans. (2) False begining of the life cycle of a called only once at
Explanation : Servlet Config object is created after destroyer) metho is filter the
constructor is called and before init) is called. So, se the (4)
executed called after the
init parameters cannot be accessed in the
rvlet filter has
constructor The destroy) method is
called
Q.226.What is the difference between servlets and
ys.(,
the life cycle of a filter only once at the
applets?
planation: o
stroy)
is an end end of
is called at the end of life cycle, of life cycle
(i) Servlets execute on Server; Applets execute on method so it
browser
Which of the followi is true
(i) Servlets have no GUl; Applet has GUI
(1) Servlets execute within the about servlets?
(ii) Servlets creates static web pages; Applets server address space of web
creates dynamic web pages
Servlets are
(iv) Servlets can handle only
single request:
Applet can handle multiple requests
a
()
written in java plattorm-independent because they are
(3) Servlets can use the full
(1)
(3)
i, i, ii are correct(2i, i are correct
i, iii are correct (4) i, ii, ii, iv are correct
class libraries functionality of the Java
Ans. (2) i, i are correct Servlets execute within the address
Explanation: Servlets execute on Server and
server, platform independent andspace of web
have GUI. Applets execute on browser and has doesn't functionaiity of java class libraries
uses the
GUI Ans. (4) Servlets execute within the address
Q.227.Which of the following code is used to get an server, platform independent space of web
attribute in a HTTP Session object in servlets? and
functionality of java class libraries uses the

(9session.getAttribute(String name)
(2) session.alterAttribute(String name)
Explanation : Servlets execute within
of a web server. Since it is the address
space
(3) session.updateAttribute(String namne) written in java it is
(4) session.setAttribute(String name)
independent. The full functionality is available platform
libraries. through
Ans. (1)
session.getAttribute(String name)
Explanation: session has various methods for use. 9.231.Howis the
dynamic
responses to transform the interception
of requests and
Q.228.Which of the following code retrieves () servlet container
information done?
the request as the body of
(3) servlet context (2) servlet contig
binary data? 4servlet filter
(1) DatalnputStream data = Ans.(4) servlet filter
(2)
DatalnputStream data
new
InputStream) Bxplanation: Servlet has various
response.getInputStream)
=

(3DatalnputStream data = components


container, config, context, filter. Servlet filter provides like
the
(4)
Ans. (3) DatalnputStream data request.getInputStream) aynamic interception of requests and responses to
DatalnputStream data request.fetchInputStream)
=

transform the information.


Explanation: InputStreamrequest.getlnputStream)
=

getInputStream) retrieves is
the request in
abstract class. 9232.What is full form of JSP?
an

Q.229.When destroy0 method ofa filter is binary data. ()Java Service Provider
(2) Java Service Pages
(1The destroy() method is called called? 3)
Java Server Provider
the life cycle of a filter only once at the endo A Java Server
Ans.(4) Java Server Pages
Pages
B.42] KPH MCO
Q.231.Which of the following is true about JSP? for BcA
(i) JSP technology is used to
application.
create
create
(ii) The JSP pages are not easier to
weh
Servlet. maintain
(iiJSP page consists of HTML tags and JSP.
than
(1) 1&2 (2) 1& 3 tags.
(3) 2&3 (4) All of the above
Ans. (2) 1&3
Q.232.Which of the following are the life cycle method
jsp? .

(1) jspInit) (2) jspService0


(3) jspDestroy0 (4All of the above
Ans.(4) All of the above
Q.233.Request processing of JSP is done by calling
method? which
(1) jspInit) (2) jspService0
(3) jspDestroy0 (4) jspRequest)
Ans. (2) jspService0

Q.234.Which of the following method helps in


initialization? jsp page
jsplnit0 (2) jspService()
(3) jspDestroy0 (4) init0
Ans. (1) jsplnito

Q.235.Which of the following is correct about


(i) JSP page is JSP?
translated
(ii) JSP translator is a into Servlet.
is part the web server whieh
of
responsible
Servlet.
for
translating the JSP page into
(1) only 1
(3)Both 1& 2 (2) only 2
Ans. (3) Both 1& 2 (4) None
Q.236.Which of the
contains web.xml following
file? folder in JSP project
projer
(1) META-INF
(3) context-roott (2) WEB-INF
Ans. (2) WEB-INF (4) Any of A &B

You might also like