0% found this document useful (0 votes)
21 views4 pages

9th MCQ Answers Term-1

The document contains a series of multiple-choice questions (MCQs) related to Java programming concepts, including topics such as data types, operators, keywords, and syntax. Each question presents several options, testing knowledge on Java's features, coding practices, and programming fundamentals. It serves as a study guide for individuals preparing for exams or assessments in Java programming.

Uploaded by

aaravagrawalc712
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)
21 views4 pages

9th MCQ Answers Term-1

The document contains a series of multiple-choice questions (MCQs) related to Java programming concepts, including topics such as data types, operators, keywords, and syntax. Each question presents several options, testing knowledge on Java's features, coding practices, and programming fundamentals. It serves as a study guide for individuals preparing for exams or assessments in Java programming.

Uploaded by

aaravagrawalc712
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/ 4

IMPORTANT MCQ’s

1. The machine language for the JVM is called _________.


(a)Byte code (b)Object code (c)Execution code (d)Virtual code
2. Which of the following is not a valid comment?
(a)/** comment*/ (b)/*comment*/ (c)/*comment (d)//comment
3. Java uses _______ character set.
(a)ASCII code (b)Unicode (c)JIT code (d)native code
4. Smallest individual unit in a program is called?
(a)Literals (b)Datatype (c)Token (d)class
5. Identify the illegal identifier from th following:
(a)_CHK (b)abyt (c)20_50 (d)A_to_Z
6. Which of the following a primitive data type in Java?
(a)array (b)class (c)byte (d)character
7. Which keyword turns a variable declaration into constant declaration?
(a)const (b)constant (c)final (d)fixed
8. ch+=10 is equivalent to
(a)ch=ch+10 (b)ch+10 (c)ch=+10 (d)ch=ch*10
9. s= j++ + 5 results into (value of j is 10)
(a)15 (b)16 (c)14 (d)17
10. (1>0) && (0>1) is
(a)1 (b)0 (c)false(d)true
11. User defined conversion is also known as
(a)coercion (b)type promotion (c)type casting (d)implicit conversion
12. The default value of char type variable is
(a)\u0020’ (b)\u00ff’ (c)“ “ (d)\u0000’
13. The range of values for long type data is
(a)-231 to 331 – 1 (b)-264 to 264 (c)-263 to 263 -1 (d)-232 to 232 -1
14. Simple if…else statement can be alternatively represented through _____ operator.
(a)&& (b)? : (c)> (d) !
15. An if statement within another if is known as _______
(a)Grouped-if (b)paired-if (c)nested-if (d)clustered-if
16. Which package would you import for the Scanner class?
(a)java.util.* (b)java.awt.* (c)java.io.* (d)java.lang.*
17. A method that accepts a character through scanner object.
(a)nextLine() (b)nextDouble() (c)charAt() (d)nextInt()
18. In Java, the constants are also called _________
(a)seperators (b)Literals (c)Inteface (d)Identifier
19. What is the result of evaluating the following expression? (1 + 2 * 3) / 2 + 2
(a)4 (b)6 (c)8 (d)5
20. class, array and interface are examples of _________.
(a)Primitive data types (c)Numeric data types
(b)Non-Primitive data types (d)Non-numeric data types
21. Which of these keywords is used to make a class?
(a)class (b)struct (c)int (d)Class
22. How many types of primitive data types exist in Java?
(a)5 (b)8 (c)7 (d)10
23. The string "COMPUTER" needs how many bytes of space?
(a) 16 (b) 6 (c) 13 (d) None of these
24. What is the size of the double data type?
(a) 80 bytes (b) 8 bytes (c) 10 bytes (d) 64 bytes
25. The statement x *= 4 is equivalent to:
(a) x = 4*; (b) x = 4; (c) x = x * 4; (d) x = x + 4;
26. What is the || operator called?
(a) Unary operator (b) Logical AND operator
(c) Relational operator (d) Logical OR operator
27. A program can compile even if there is a:
(a) Syntax error (b) Logical error
(c) Both (a) and (b) (d) None of these
28. Which method is used for inputting two different words?
(a) nextInt() (b) next() (c) nextLine() (d) nextSentence()
29. A condition statement cannot be formed using which operator?
(a) Arithmetic (b) Relational (c) Logical (d) Ternary
30. Which of the following represents a new line character?
(a) \n (b) \a (c) \r (d) \t
31. A character constant is enclosed within:
(a) Double quotes (b) Single quotes (c) Parentheses (d) #
32. Which package is automatically imported into a Java program?
(a) java.io (b) java.lang (c) java.applet (d) java.swing
33. Conditions in Java are formed using:
(a) Ternary operators (b) Relational operators
(c) Logical operators (d) All of these
34. If (a > b) && (a > c), which statement is true?
(a) b is the smallest (b) b is the greatest number
(c) a is the greatest number (d) All of the above
35. If a, b, c are the sides of a triangle and a != b && a != c && b != c, what type of triangle is
it?
(a) Equilateral (b) Scalene (c) Isosceles (d) All of the above
36. A set of characters is assigned to a:
(a) String variable (b) Boolean variable
(c) Both (a) and (b) (d) None of these
37. What does JDK stand for?
(a) Java Development Kit (b) Java Data Kit
(c) Java Document Kit (d) Java Disc Kit
38. Which of the following is not a primitive data type in Java?
(a) int (b) byte (c) interface (d) short
39. Which of these is not an OOP concept?
(a) Encapsulation (b) Polymorphism (c) Exception (d) Abstraction
40. What is the size of a char variable in Java?
(a) 1 byte (b) 2 bytes (c) 3 bytes (d) 4 bytes
41. Which of the following is not a tool of JDK?
(a) Java (b) Javap (c) Jdb (d) Robust
42. Which of the following is a feature of Java?
(a) Portable (b) Source code (c) Byte code (d) JVM
43. Which of the following is not a type of token?
(a) Identifiers (b) Compiler (c) Operators (d) Keywords
44. How many bytes of memory is occupied by the double datatype?
(a) 8 (b) 1 (c) 4 (d) 2
45. What is the full form of ASCII?
(a) American Standard Code for Information Interchange.
(b) American Standard Code for Interchange Information.
(c) American Standard Computer for Information Interchange.
(d) American Secret Code for Information Interchange.
46. byte, short, int are examples of _______.
(a) User-defined data types. (b) Complex data types.
(c) Built-in data types. (d) Composite data types.
47. The result of the expression 22 % 5 is:
(a) 0 (b) 1 (c) 2 (d) 4
48. The number of primitive data types in Java is _________.
(a) Five (b) Six (c) Seven (d) Eight
49. Correct declaration of double variables salary and tax:
(a) Salary, tax double; (b) Double salary, tax,
(c) Double salary; tax; (d) double salary, tax;
50. <, >, <=, >= are examples of ________.
(a) Increment, decrement operators. (b) Arithmetic operators.
(c) Relational operators. (d) Conditional operators.
51. The smallest individual unit in a program is called ________.
(a) Token (b) Character (c) String (d) Unicode
52. Which of the following is an invalid identifier?
(a) _rules (b) Age16 (c) 35students (d) Rules
53. Keywords are also called _____.
(a) Literals (b) Reserved words (c) Separators (d) Punctuators
54. A named memory location that holds a data value of a particular data type is a/an
______.
(a) Variable (b) Reference (c) String (d) Object
55. How many logical operators are there in Java?
(a) 1 (b) 2 (c) 3 (d) 4
56. A character constant is enclosed in _____.
(a) Double quotes (b) Single quotes (c) Brackets (d) Parameters
57. If (a > b && a > c), then which of the following statements is true?
(a) b is the smallest number (b) b is the greatest number
(c) a is the greatest number (d) All of the above
58. Which of the following is the default package in a Java program?
(a) Java.io (b) Java.lang (c) Java.out (d) Java.net
59. Which of the following is not a type of error?
(a) Syntax error (b) Logical error (c) Datatype error (d) Run time error
60. How many bytes of memory is occupied by the boolean datatype?
(a) True (b) 1 (c) False (d) 2

You might also like