50% found this document useful (2 votes)
9K views3 pages

Tcs Ilp Pat Test On Java

This document contains 15 multiple choice questions about Java programming concepts such as classes, objects, methods, data types, and variable declaration and assignment. The key points covered are: 1. Objects can access instance data and methods but not static data/methods. The Object class is the superclass of all other classes. 2. Private attributes of a class can only be accessed by methods within the same class. 3. An aggregate object is an instance that contains other object instances. 4. A class defines common variables and methods for all its objects and is considered a blueprint. The document also provides an answer key for the 15 questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
9K views3 pages

Tcs Ilp Pat Test On Java

This document contains 15 multiple choice questions about Java programming concepts such as classes, objects, methods, data types, and variable declaration and assignment. The key points covered are: 1. Objects can access instance data and methods but not static data/methods. The Object class is the superclass of all other classes. 2. Private attributes of a class can only be accessed by methods within the same class. 3. An aggregate object is an instance that contains other object instances. 4. A class defines common variables and methods for all its objects and is considered a blueprint. The document also provides an answer key for the 15 questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

TCS ILP PAT TEST on Java

1.Which of the following statements is false about objects


a.An instance of a class is an object
b.Objects can access both static and instance data
c.Object is the super class of all other classes
d.Objects do not permit encapsulation
!.Which metho"s can access to #$ivate att$ibutes of a class
a.Only Static methods of the same class
b.Only instances of the same class
c.Only methods those defned in the same class
d.Only classes available in the same package.
%.What is an agg$egate object
a.An object with only primitive attributes
b.An instance of a class which has only static methods
c.An instance which has other objects
d.None of the above
&.Assume that 'ile is an abst$act class an" has to'ile() metho". Image'ile an"
*ina$+'ile a$e conc$ete classes of the abst$act class 'ile. Also, assume that the
metho" to'ile() is im#lemente" in both *ina$+ 'ile an" Image 'ile. A 'ile
$efe$ences an Image'ile object in memo$+ an" the to'ile metho" is calle", which
im#lementation metho" will be calle"
a.Binary ile
b.!mage ile
c.Both ile and Binary iles
d.None of the above
-.A class can have man+ metho"s with the same name as long as the numbe$ of
#a$amete$s o$ t+#e of #a$amete$s is "i.e$ent. This //P conce#t is 0nown as
a."ethod
b.!nvocating
c."ethod
d.Overriding
e."ethod #abeling
f."ethod
g.Overloading
1.Which of the following is consi"e$e" as a blue #$int that "e2nes the va$iables
an" metho"s common to all of its objects of a s#eci2c 0in"
a.Object
b.$lass
c."ethod
d.%eal data
e.types
3.What a$e the two #a$ts of a value of t+#e "ouble
a.Signifcant &igits'
b.()ponent
c.#ength' &enominator
d."ode' Numerator
4.Afte$ the following co"e f$agment, what is the value in fname
Code:
String str;
int fname;
str = "Foolish boy.";
fname = str.indexOf("fool");
a.*
b.+,
c.-
5.What is the value of 6numbe$7 afte$ the following co"e f$agment e8ecution
Code:
int number = 0;
int number2 = 12
hile (number ! number2)
"number = number # 1;
$
a..
b.,*
c.*,
d.,/
19.:iven the following co"e sni##et;
Code:
int salaries%&;
int index = 0;
salaries = ne int salaries%'&;
hile (index ! ')
"
salaries%index& = 10000;
index##;
$
What is the value of sala$ies <%=
a.-000
b..000
c.,.00
d.,000
1!.Which of the following is not a $etu$n t+#e
a.boolean
b.void
c.public
d.Button
1%.If $esult > ! ? % @ -, what is the value an" t+#e of 6$esult7 va$iable
a.,1'byte
b.*.' byte
c.,1' int
d.*.' int
1&.What is the "ata t+#e fo$ the numbe$ 5.1%-!
a.2oat
b.double
c.loat
d.&ouble
1-.Assume that the value %5!5.5! is of t+#e 6Aoat7. Bow to assign this value afte$
"ecla$ing the va$iable 6inte$est7 of t+#e Aoat
a.interest 3 /4*4.4*
b.interest 3 5loat6/4*4.4*
c.interest 3 /4*4.4*52oat6
d.interest 3 /4*4.4*f
1. Answers:
1.d
2.c
3.c
4.d
5.g
6.b
7.b
8.b
9.b
10. I think qestion is wrong.
12.c
13.!"c
14.!
15.d
I# !n$thing is wrong% &'e!se 'et (e know.
2. )ther *ossib'e !nswers:
o
1.d%2.c%3.c%4.b%5.(ethod o+er'o!ding%6.b%7.!%8.b%9.b%10.d%12.d%13.c%14.!"c% 15.d..
I think..
&'e!se te'' (e i# !n$thing is wrong

You might also like