0% found this document useful (0 votes)
25 views3 pages

Java Programming Revision Test Questions

The document is a revision test for a computer course at Onkar Coaching Institute, containing various questions related to Java programming concepts, data types, operators, and error types. It includes questions on method return types, memory sizes, expressions, and control structures. Additionally, it addresses concepts such as encapsulation, data abstraction, and ASCII codes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Java Programming Revision Test Questions

The document is a revision test for a computer course at Onkar Coaching Institute, containing various questions related to Java programming concepts, data types, operators, and error types. It includes questions on method return types, memory sizes, expressions, and control structures. Additionally, it addresses concepts such as encapsulation, data abstraction, and ASCII codes.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ONKAR COACHING INSTITUTE

COMPUTER
REVISION TEST
Question [Link] the keyword which:
1. indicates that a method has no return type.
2. makes the variable as a class variable
Question 2. Write the memory capacity (storage size) of short and float data type in bytes.
Question 3. Identify and name the following tokens:
1. public
2. 'a'
3. ==
4. { }
Question 4. Write a Java expression for the following:
|x2 + 2xy|
Question 5. If the value of basic=1500, what will be the value of tax after the following
statement is
executed?
tax = basic > 1200 ? 200 :100;

[Link]([Link](9,16))
ar
Question 6. Give the output of the following:

Question 7. Evaluate the following expression if the value of x=2, y=3 and z=1.
v=x + --z + y++ + y
k
Question 8. Arrange the following primitive data types in an ascending order of their size:
(i) char (ii) byte (iii) double (iv) int
Question 9. State the package that contains the class:
1. BufferedReader
on
2. Scanner
Question 10. What is the difference between / and % operators?
Question 11. What will be the output of the following code?
(i)
int k = 5, j = 9;
k += k++ - ++j + k;
[Link]("k = " + k);
[Link]("j = " + j);
(ii)
double b = -15.6;
double a = [Link]([Link](b));
[Link]("a = " + a);
Question 12. Give the prototype of a function search which receives a sentence 'sent' and word
'w' and
returns 1 or 0.
Question 13 . What will be the output of the following code?
char x = 'A';
int m;
m = (x == 'a')? 'A' : 'a';
[Link]("m = " + m)
Question 14. Read the following text, and choose the correct answer:
A class encapsulate Data Members that contains the information necessary to represent the class
and Member
methods that perform operations on the data member.
What does a class encapsulate?
1. Information and operation
2. Data members and Member methods
3. Data members and information
4. Member methods and operation

are treated as the


same.
ar
Question 15. Assertion (A): In Java, statements written in lower case letter or upper case letter

Reason (R): Java is a case sensitive language.


1. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of
Assertion (A)
2. Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of
k
Assertion (A)
3. Assertion (A) is true and Reason (R) is false
4. Assertion (A) is false and Reason (R) is true.
Question 16.
on
The following code segment should print "You can go out" if you have done your homework
(dh) and cleaned your
room (cr). However, the code has errors. Fix the code so that it compiles and runs correctly.
boolean dh = True;
boolean cr= true;
if (dh && cr)
[Link]("You cannot go out");
else
[Link]("You can go out");
Question 16 b-A student executes the following program segment and gets an error. Identify the
statement which has an error, correct the same to get the output as WIN.

boolean x = true;
switch(x)
{
case 1: [Link]("WIN"); break;
case 2: [Link]("LOOSE");
}
Question [Link] are the types of casting shown by the following examples:
char c = (char) 120;
int x = ‘t’;
Question [Link] difference among the following with example :-
Syntax error ,logical error and runtime error
Question [Link] is the .ain difference between Encapsulation and Data Abstraction.
Question 20. What is ASCII [Link] the ASCII code of A-Z , a-z and 0-9

r
ka
on

You might also like