0 ratings0% found this document useful (0 votes) 12 views8 pagesFundamental of Java Programming - MCQ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Fundamentals of Java Class 12 MCQ
1.JVM Stands for
Java Virtual Machine
b.Java Verify Machine
¢.Java Vector Machine
d. None of the above
Hide Answer —
a. Java Virtual Machine
2.Java programs are
a. Platform Independent
b. Highly Portable
¢. Both a) and b)
d. None of the above
Hide Answer —
. Both a) and b)
3. Java support
a. Compiler
b. Interpreter
d. Assembler
e. None of the above
Hide Answer —
bb. Interpreter,
4. Java converts the program in
a.Byte
b. Megabyte
c. Bytecode
d. None of the above
Hide Answer —
c. Bytecode
5. IDE Stands for -
a. Integrated Developer Environments
b, Integrated Development Environments,
¢ Internal Developer Environments
Internal Development Environments
Hide Answer —
b. Integrated Development Environments
6. Java NetBeans IDE is softwar
a. Close source
b. Middle source
. Open Source
d. None of the above
Hide Answer —
¢. Open Source
7. How we can write comments in Java programs.
a. Two forward slashes (//)
b./* and */
Both a) and b)
d. None of the above
Hide Answer <—
€. Both a) and b)8. In Java a group of related classes is known as
a. Group
b. Package
Method,
d. None of the above
Hide Answer —
b. Package
9. In Java most common pre-built Java output methods are _
a. System.outprintln();
b. Public class
c. Public static void main (String{] args)
d. None of the above
Hide Answer —
a. System.outprintin():
10. A Variable
a. Constant.
b. Variable
c. Data type
d. Nene of the above
a placeholder for data that can change its value during program execution.
Hide Answer —
b, Variable
11. In Java, How many types of primitive Data Type.
a6
b.7
38
a9
Hide Answer <—
.8
12. In Java, Which type of datatype is used to store Integer values.
a. Byte
bint
c. Long
d. All of the above
Hide Answer —
d. All of the above
it of data,
13. Int Data Type can store
a. 8-bit
b. 16-bit
32-bit
64-bit
Hide Answer <—
©. 32-bit
bit of data.
14, Float Data Type can store _.
a. B-bit
Hide Answer —
©. 32-bit15. Double Data Type can store _.
a. 16-bit
b. 32-bit
©. 64-bit
d. 8-bit
Hide Answer —
6 64-bit
16. Char Datatype can store
a. 16-bit
b. 32-bit
©. 64-bit
d. 8-bit
Hide Answer —
a. 16-bit
17. Bootean Data Type can store
a. 16-bit
b. 32-bit
©. Lbit
d. B-bit
Hide Answer —
c Lbit
18. What are the naming rules we have to follow to declare a variable.
a. Variable names can begin with either an alphabetic character. Underscore or a dollar sign.
b. Space are not allowed in variable names
c. Reserved words cannot be used as a variable name.
d. All of the above
Hide Answer —
All of the above
19. To store more than one character, we use the
a. Integer
b. Character
String
d. None of the above
Hide Answer —
¢.String
20.
operations.
2 Operator:
b. Variable
©. Datatype
. None of the above
/¢ special symbols in a progremming language and perform certain specific
Hide Answer —
2. Operators
21. ++ is known as which operator.
& Increment Operator
b. Decrements Operator
. Assignment Operator
d. Modulus:
a. Increment Operator
22. Which of the following betonas to Lo:
ae
ba
AU of the above
4. All of the above23. Which of the following is an example of selection structures.
a. IFelse statement
b. Switch statement
Else if statement
4. All of the above
* Hide Answer —
All of the above
24. The Java lets us execute a block of code depending upon whether an expression
evaluates to true or false.
a. If statements,
b. For statements,
Array Statements
4. None of the above
* Hide Answer —
a. If statements,
25. To combine two relational expressions in a program.
a Logical OR
b. Logical AND
Logical NOT
4. None of the above
* Hide Answer —
b. Logical AND
26. If inside the if is known as
2, Outer If
b Inner if
cc. Nested If
<.ALL of the above
Hide Answer —
Nested If
used to execute a block of code matching one value out of many possible
1a If statement,
b. Switch Statement
. For Statement
4. None of the above
Hide Answer —
b. Switch Statement
28. The ability of a computer to perform the same set of actions again and again is called looping.
‘a. Looping
b. Actioning
Performing
4d. None of the above
“Hide Answer —
a. Looping
29. What are the different looping statements availabl
a. For loop,
b. While Loop
Do-while loop
All of the above
Hide Answer <—
d. All of the above30. The
2.Goto
b, While Loop,
. Do-while oop.
d. All of the above
statement evaluates the test before executing the body of a loop.
Hide Answer —
b. While loop
31. The
2.Goto
1b. While loop,
. Do-while loop.
d. All of the above
_ statement evaluates the test after executing the body of a loop.
le Answer
¢. Do-while loop
32. _ is known as the entry control loop.
2. While loop
1b. Do-while loop
€. Goto loop
d. All of the above
b. Do-while loop
€. Goto loop,
d. AlLof the above
Hide Answer —
b. De-while loop
34. Which condition required for executing the loop —
Initial value
b. Condition
. Counter
. All of the above
* Hidde Answer <—
d. AU of the above
are variables that can hold more than one value, they can hold a list of values of
Variable
d. None of the above
* Hide Answer —
Variable
36.
aX
bie
e.\tb
d.\tab
helps to create a tab between the numbers in the print statement.
Hide Answer —
bat
37. Array addresses always start from _
2.0
bd.
<2
42
Hide Answer —
ao38. OOP Stands for —
a. Object Oriented Programming
b. Outer Oriented Programming
©. Outer Object Programming
d. Oriented Object Procramming
Hide Answer
a. Object Oriented Programming
39. Java's most fundamental features are _
a. Class,
b. Objects
¢. Both a) and b)
d. None of the above
Hide Answer —
¢. Both a) and b)
40. Function deciared inside the class is known as
a, Member function
b, Inner function
¢. Outer function
d. None of the above
Hide Answer —
a. Member function
41. The body of class is enclosed within .
a. Small braces
b. Curly braces
¢. Big braces
d. None of the above
Hide Answer —
b. Curly braces
42. The variable declared outside the class is known as
a. Local variable
b, Global variable
Inner variable
d. ALL of the above
Hide Answer —
b. Global variable
43. The variable declared inside the class is known as
a Local variable
Global variable
. Inner variable
All of the above
Hide Answer
a. Local variable
4a. is a data member that is declared but not initialized before us
defautt value by the compiler, usually either zero or null.
a. Class
b. Object
. Constructors
d. None of the above
19, and is assigned 2
le Answer —
¢. Constructorsa. Class
b. Object
. Constructors
d. None of the above
* Hide Answer —
<. Constructors,
4G. Data members and method members of an object are accessed using the operator.
a. Comma (,)
b. Dot ()
&. Macular (%)
Dollar (§)
Hide Anewer
b.Dot ()
47. Data members of a class can be accessed from outside the class by default. Identity the access
modifiers from the below list
a. Private
b Public
c. Protected
All of the above
* Hide Answer —
All of the above
48. Private data members of a class cannot be accessed outside the class however, you can give.
controlled access to data members outside the class through
a. Getter
b Setter
Both a) and b)
None of the above
Hide Answer —
& Both a) and b)
49. To import the class from the package, you have to use _.
a.insert
b Import
<.Add
. None of the above
keyword.
Hide Answer —
b. Import
50. We can take input from the user using, object.
a. Scanner
b. Systemoutprintin()
© Both a) and b)
d. None of the above
Hide Answer —
a. Scanner,
51.
@. parselntO:
b. parseDouble()
©. parseString():
d. None of the above
function helps to convert string value to the integer vatue in Java,
Hide Answer —
a. parseint():
52. To sort the array of integers in ascending order —
a. Arranae()
b Filter()
©. Sert()
d. None of the above
_ function required.
> Hide Answer —
Sort)s2. function helps to convert all of the characters in Lower caze.
3. toLawereacat)
b teSmaltcasa()
cto Balowease()
d. None of the above
Hide Answer —
3 toLowereane(),
sa. function helps to convert all the characters in Upper case.
@. toUppercase))
bb toCaptatcascd
©. touppercase()
d. None of the above
Hide Answer —
a. toUppercaset)
55.
a replace()
b Changed)
¢. Convert()
4d. None of the above
_ function helps to return 2 new string after replacing all occurrences of old string.
Hide Answer —
a. replace”)
se.
a replace()
b isEmpty)
c.indexor,
d. None of the above
function helps to return the Length of the string.
Hide Answer —
a. replace”)
57, _— function helps to return the index of the first occurrence of a given substring.
a. tengtn()
b isEmpty)
c.indexOf)
. None of the above
Hide Answer —
cindexOf,
58. When unexpected errors come in the program it is handled by
8. Error handling
b. Exception handling
- Both a) and b)
d. None of the above
> Hide Answer —
b. Exception handing
60. Which keywords handle an exception in Java programming.
ety
b. Catch
©. Both a) and b)
4d. None of the above
Hide Answer —
Both a) and b)
o2. _ helps te access the network services that are running on the Local computer.
2. Locathost
b. Local Network
<. network
4d. None of the above
a. Locathost
62. What are the differant ways to create threads in Java?
2. By extending the Thread class
b. By Implementing the Runnable interface
Both a) and b)
4d. None of the above
Hide Answer —
Both a) and b)