0% found this document useful (0 votes)
22 views6 pages

Multiple Choice Questions Computer Applications

The document contains a series of multiple choice questions (MCQs) related to computer applications, specifically focusing on Java programming concepts and principles of object-oriented programming (OOP). It covers topics such as data types, operators, error handling, and Java syntax. Each question provides multiple answer options, testing knowledge on various aspects of Java programming.

Uploaded by

kongk7395
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)
22 views6 pages

Multiple Choice Questions Computer Applications

The document contains a series of multiple choice questions (MCQs) related to computer applications, specifically focusing on Java programming concepts and principles of object-oriented programming (OOP). It covers topics such as data types, operators, error handling, and Java syntax. Each question provides multiple answer options, testing knowledge on various aspects of Java programming.

Uploaded by

kongk7395
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
You are on page 1/ 6

MCQs Multiple Choice Questions

Computer Applications

1. Which of the following principle of OOP is based on the concept of reusability?


a) Abstraction b) Encapsulation c) Inheritance d) Polymorphism
2. Which of the following token is an operator in Java?
a) ?: b) if c) “java” d) [ ]
3. The evaluation order of the following operators : &&, +++, ?:, == according to the precedence of
operator is __________
a) && > ++ > ?: > == b) ++ > == > && > ?:
c) ++ > && > ?: > == d) && > == > ++ > ?:
4. The value stored in ch after the following program segment is executed is _____
Char ch = (char)32;
a) ‘*’ b) ‘7’ c) ‘E’ d) ‘ ’
5. Arrange the following data types in descending order of their size: float , byte, boolean, char
a) float > char > byte > boolean b) float > byte > char > Boolean
c) boolean > byte > char > float d) boolean > char > byte > float
6. Which of the following is not a primitive data type?
a) long b) class c) boolean d) char
7. The escape character “/t” is used for:
a) next line b) space c) audible bell d) none of these
8. ________ is a unary operator?
a) += b) - c) -- d) =
9. Which of the following function of Scanner class used to input a word?
a) nextLine( ) b) next( ) c) next().charAt(0) d) nextString()
10. State the type of error caused by execution of the following program segment:
if(a%2 == 0)
System.out.println(“Even”);
else (a%2 !=0)
System.out.println(“Odd”);
a) Runtime error b) Logical error c) Sysntax error
11. Which of the following package is included by default in Java?
a) java.util b) java.lang c) java.io d) java.math
12. The java statement System.out.println(Math.max(Math.ceil(-14.55), -15.55)); will give the
output as :
a) -15.0 b) -14.0 c) -16.0 d) – 15.55
13. Predict the output in each case (i) Math.sqrt(-36) and (ii) Math.pow(4, -2)
a) -6.0 and -64 b) -6.0 and 0.0625 c) Nan and 0.0625 d) 6.0 and 0.625
14. Give the output of the following method:
public static void main( )
{
int a = 5;
a++ ;
System.out.print(a + “ ”);
a -= (a--) – (--a);
System.out.print(a);
}
a) -6 4 b) 6 4 c) 6 -4 d) -6 -4
15. Which of the following is the return type of Math.round( ) function?
a) int / float b) int / double c) int / long d) float / double
16. What is the value of y after the execution of the following statement?
Y -= ++y + y-- + --y; when y = 8
a) -17 b) 17 c) -18 d) 18
17. Pick the odd one out:
a) { } b) , c) ; d. ( )
18. _________ is the ability of an object to take many forms:
a) Inheritance b) Polymorphism c) Abstraction d) Encapsulation
19. Given the java statement : System.out.println(a > b && b != c). What will be the output if
a = 6, b = 4, c = 4?
a) True b) 2 c) False d) 14
20. Which of the following is a correct java statement to create an object of class abc?
a) abc obj = new abc( ); b) abc obj = new( );
c) obj abc = new abc( ); d) abc obj = new abc;
21. Which of the following mathematical functions return truncated value of the number?
a) floor( ) b) ceil( ) c) random( ) d) rint( )
22. Which of the following statement is incorrect?
a) a *= 1 b) a = a * 1 c) a =* 1 d) a = 1 * a
23. Which of the following keyword is used to create memory dynamically?
a) new b) import c) void d) none of these
24. The output of the following code is:
char a = ‘D’;
char b = ‘d’;
int c = a + b;
System.out.println(c);
a) 168 b) 186 c) Dd d) 681
25. How many return statements are valid in a method?
(a) 1 b) 2 c) 3 d) all of these
26. String x = “Computer Art Graphics”;
String y = “Artistic effects”;
State the output of the following statements:
System.out.println(x.substring(9, 12) + y.substring(9).toUpperCase( ));
a) Art Effects b) ARTEFFECTS c) ArtEFFECTS d) ART Effects
27. The library function isDigit( ) belongs to which Wrapper class?
a) String b)Char c) Character d) none of these
28. State the output of the following statement:
System.out.println(“CLOak”.compareTo(CLOCK));
a) 30 b) 32 c) -30 d) -32
29. Wich correct statement is used to convert the following value of y to decimal form?
String y = “24”;
a) float z = Float.ParseFloat(y); b) Double z = Double.ParseDouble(y);
c) float z = Float.valueOf(y); d) double z = String.valueOf(y);

30. The state or characteristics of an object is stored in _________’


a) data variables b) message c) methods d) functions
31. The source code in Java has ________ extension.
a) .exe b) .java c) .class d) .byte
32. ___________ are small programs that are embedded in web pages and are run on the viewer’s machine
by Java supported browsers.
a) Applications b) Applets c) Illustrations d) none of these
33. Scanner class is present in _________package.
a) java.lang b) java.io c) java.util d) none of these
34. Expressions that have all operands of same type are called __________ expressions.
a) impure b) mixed c) pure d)compound
35. The parameters passed on the method call are called _________parameters.
a) actual b) formal c) global d) local
36. The method header having keyword static is known as _________
a) static method b) class method c) both (a) and (b) d) none of these
37. A return statement can return _______ to the calling function.
a) a constant b) a variable c) an expression d) all of these
38. A package of Java can be used and accessed by including ________ command.
a) export b) include c) import d) extract
39. Which of the followings statement is correct?
a) System.out.println(Math.max(x)); b) System.out.println(Math.random(90, 30));
c) System.out.println(Math.round(“30”)); d) System.out.println(Math.sqrt(100));
40. The case label must be a_________.
a) variable b) constant c) keyword d) none of these
41. switch statement cannot handle _____________ point test.
a) floating b) integer c) character d) String
42. The minimum number of times the body of the do-while loop will execute is at least ______ times.
a) one b) two c) zero d) none of these
43. __________ is not a jump statement.
a) System.exit(0) b) continue c) break d) return
44. Which of the following is not a token?
a) operator b) statement c) identifier d) keyword
45. A new line escape character is represented by:
a) ‘\n’ b) ‘\a’ c) ‘\t’ d) none of these
46. In a nested loop construct, if an outer loop runs 10 times and inner loop runs 4 times. How many times
the inner loop run?
a)10 b) 14 c) 40 d) 30
47. The statement ot declare an array of 15 characters is:
a) char n[] = new n[15]; b) char n[] = new char[15];
c) char n[15] = new char[]; d) none of these
48. The statement to initialize and array of five integers is :
a) int a[] = {10, 20, 30, 40, 50}; b) int a[5] = {10, 20, 30, 40, 50};
c) int a[5] = { 10, 20, 30}; d) all of these
49. If an array has N elements, its valid subscript are _________.
a) 1to N b) 0 to N c) 0 to N – 1 d) 1 to N - 1
50. Constants are declared using the modifier_________.
a) static b) final c) fixed d) constant
51. After the Java source code is compiled, it produces a file with _______ extension.
a) .exe b) .class c) ,java d) .byte
52. Public private, protected and default are types of ________
a) excess modifiers b) data type c) access modifier d) none of these
53. Instance variables and methods can be accessed outside the class using the object reference and the
____ operator.
a) new b) instance c) dot d) type
54. Objects interact and communicate with each other using ____________.
a) commands b) methods c) data d) tokens
55. ____________ operators evaluate comparisons between two operands or expressions.
a) Bitwise b) Arithmetic c) Assignment d) Relational
56. The values from actual to formal parameters are copies sequentially from ______.
a) left to right b) right to left c) randomly d) none of these

57. Which of the following statements is true?


a) System.out.println(Math.max(30)); b) System.out.println(Math.random(90,30));
c) System.out.println(Math,round(“30.4”)); d) Syste,.out.println(Math.sqrt(100));
58. ________ is not a jump statement.
a) System.exit(0) b) continue c) break d) return
59. Which of the following is a valid variable declaration and initialization.
a) s = 12; int s; b) s = 12; c) s == 12; d) int s; s = 12;
60. The forced change in data type is:
a) typecasting b) implicit typecasting
c) explicit type casting d) all are correct
61. The expression 11%3 returns:
a) 2 b) 3 c) 3.66 d) 2.0
62. Which of the following will produce 9.0 if x = 9.9?
a) Math.ceil(x) b) Math.floor(x) c) Math.round(x) d) Math.rint(x)
63. The statement to initialize an integer array with 5 elements is _____:
a) int a[] = {10, 20, 30, 40, 50}; b) int a[5] = {10, 20, 30, 40, 50};
c) int a[] = new int(10, 20, 30, 40, 50); d) int a[] = [10, 20, 30, 40, 50];
64. In an array int a[20], total memory consumed is ____:
a) 40bytes b) 20bytes c) 80bytes d) 160bytes
65. The ______ objects are read only hence are immutable and cannot be changed.
a) StringBuffer b) String c) StringTokenizer d) none of these
66. Two strings can be checked to see if they are equal by using _______.
a) equals() b) equalsIgnoreCase() c) compareTo() d) all of these
67. Wrapper classes are part of the package______.
a) java.util b) java.lang c) java.math c) java.awt
68. Wrapper classes provide a different way to use the primitive data types as ______.
a) class b) objects c) interfaces d) packages
69. The process of converting the wrapper class into its corresponding primitive data type is known as:
a) unboxing b) boxing c) autoboxing d) binding
70. The value placed in x is:
int a = 10, b = 15, c = 20;
x = a>b && a>c? a : (b>c ? b : c);

***********

You might also like