STD 12-CHAPTER-7
STD 12-CHAPTER-7
}
<optional – variable – declarations – and – methods>
}
29.One compulsory class has which public method?
a) static b) main c) Syntax d) Literals
30. Which determines the required memory size, type of values, range of
values and type of operations that can be performed.
a) Data type b) Variable c) Literals d) Keyword
31. How many primitive data types are there in Java?
a) 3 b) 4 c) 8 d) 6
32.Name the primitive data types.
a)byte, short int, long b) float, double c) char, boolean. d) All of these
33. Name the data type which hold the integers.
a)byte, short b) int c) long d) All of these
34. Name the data type which hold the real numbers.
a)float b) double c) Int d) Both a and b
35.Which data type hold a single character from Unicode character set?
a) char b) Boolean c) Long d) Double
36. Which data type holds one of the two logical values true or false?
a) char b) Boolean c) Long d) Double
37.Which data types are machine – independent?
a) Primitive b) Non Primitive c) Static d) Public
38. What can store data in memory?
a) Data type b) Variable c) Keywords d) Operators
39.Which of the following refers to the same memory location?
a) Variable b) Data type c) Literals d) Values
40. Which can take different data values at different times during the
executing of the program?
a) Variable b) Data type c) Literals d) Values
41. Which of the following is the correct syntax to declare variable in Java.
a) <type – name>{variable – names}; b) {type – name} ;
c) [type – name ] {variable – name}; c) (type-name) ;
42. What is denoted by <> in ” {variable – names};” syntax?
a) item to be specified by user b) List of items c) Value d) Message
43. What is denoted by { } in ” {variable – names};” syntax?
a) item to be specified by user b) List of items c) Value d) Message
44. What is denoted by {variable-names} in ” {variable – names};” syntax?
a) list of variables b) data type of variables c) value d) Message
45. What is denoted by in ” {variable – names};” syntax?
a) list of variables b) data type of variables c) value d) Message
46. By which a variable name must be begin with?
a) Alphabet b) underscore c) dollar sign ($) d) All of these
47.What do we call the words who have special use in Java and cannot be used by
the programmer for the other purposes?
a) Expression b) Reserved Word c) Variable d) Boolean
48. Which of the following is the valid variable name in Java.
1) birth_date
2) CallCost
3) 4me
4) a1mp3
5) $price 6) %date$
6) 34Call
7) date of_joining
8) Name#
a) 1,2,3,5,7,8
b) 1,2,4,5,8
c) 1,2,4,6,7
d) 1,3,4,5,6
49.What is used for a constant value?
a) Literal b) Variable c) Class d) Objects
50. Which type of literal are used to represent integer or real numbers?
a) Boolean b) Numeric c) String d) character
51. We can force a smaller number to be a long by appending which letter?
a) L or l b) B or b c) A or a d) O or o
52.What is the range of Octal numbers?
a) 0 to F (0-9 and A-F) base 16
b) 0 to 7 (base 8)
c) 1 to 8
d) 1 to 8 (base 10)
Chapter-7 Java Basics
STD-12 Page 5
53.What is the range of Hexadecimal number?
a) 0 to F (0-9 and A-F) base 16 b) 0 to 7 (base 8) c) 1 to 16 d) 1 to 15
54. literals consists of \u followed by 4 hexadecimal digits for ex. the
character literal „\u00E9‟ represents the Unicode character that is an “e”.
a) Unicode b) character c) String d) Integer
55.What is the default type of floating point literals?
a) double b) float c) int d) Long
56. To make a literal of type ……………. we have to append an F or f as a suffix to
the
number.
a) float b) Double c) Long d) int
57.Which type of literals are not associated with any numeric value?
a) double b) Boolean c) int d) double
58. Boolean type literals has how many literals?
a)True b) False c) Yes d) both a and b
59.Which type of literals are expressed by a single character surrounded by single
quotes?
a) character b) Boolean c) String d) int
60. A ………… is a sequence of characters.
a) character b) Boolean c) String d) int
61. Which type of literals is a sequence of characters enclosed in double quotes?
a) character b) string c) Boolean d) int
62.Within string, special characters can be represented using the ……………….
a) backslash(\) b) forward slash(/) c) * d) $
63. Which statement is ignored by the computer?
a) Expression b) Comment c) Literals d) Variables
64. Which type of comment is begin with double slashes (//) and extends till
the end of a line?
a) Single-line b) Multi-line c) document d) None of above
65. What do we use to apply multi-line comment?
a) /* …… /* b) /* ……. */ c) */……/ d) //…../
66. Which type of comment used to creating API documentation form the
code in Java?
a) Documentation Comment b) Multi-line c) Single-Line d) None
67.What do we use to apply documentation comment in Java?
a) /* …… / b) /** …….. / c) //…..*// d) //
68. The basic building blocks of expressions are………………..
a) literals b) variables c) function d) All of these
69.are special symbols used to build an expression.
a) Operators b) Variables c) Literals d) Function
70.Which type of operators can be applied on any type of numeric data?
a) Arithmetic b) Assignment c) Logical d) Conditional
71. In which data type the result of “9*2” is stored?
a) Float b) Integer c) Long d) Double
72.In which data type the result of “9f/2f” is stored?
a) Float b) Integer c) Long d) Double
73.What do we call the conversion where lower range data type is implicitly
converted to higher data type?
a) Type cast b) Promotion c) Literals d) Variable
74.Which operator can also be used to concatenate a string?
a) + b) * c) – d) #
75.With modulus operator %, if first operand is negative, the result is …………
a) negative b) positive c) True d) False
76.Which operators are called increment and decrement operators?
a) ++ and — b) +/ and -/ c) +, – d) +,-,-
77. What is the output of “x=4; y=3+x++;” code?
a) x=3, y=6 b) x=4, y=7 c) x=7,y=4 d) x=4,y=4
78.What is the output of “x=4; y=3+–x;” code?
a) x=3, y=6 b) x=4, y=7 c) x=4,y=-1 d) x=4,y=1
79.After applying comparison operator, the result of expression is come in which
data type?
a) Integer b) Boolean c) Integer d) Float
80. In which part of programming relational operators are used?
a) If statements & loops b) Body part c) head part d) End part
81. In statement “A && B” if both A and B both are true then what is the result?
a) True b) False c) True d) False
82. In statement “(x==0) || (y==0)” if one is true then what is the result?
a) True b) False c) True d) False
83. Using which operator, we will find opposite result?
a) XOR b) NOT c) OR d) AND
84. Without the ………….. , there would have been a “division by zero” error at
runtime.
a) short – circuiting b) Type cast c) Expression d) All of these
85. Which operator is used as assignment operator?
a) = b) = = c) >= d) <=
86. Which operator is used as conditional operator?
a) ? and : b) % and ? c) : and ? d) ? and ?
87.What is the output of “(N%2 ==0) ? (N/2) : (3*N+1)” code where N=8? a) 25 b) 4 c)
26 d) 2
88. What is the shorthand assignment of “a=a+b” code?
a) a+=b b) a=+b c) a++=b d) a==b
89.What is the full form code of “q &&=p” shorthand assignment?
a) p=q && p b) q=q && p c) p=p & q d) p==q
90. Which facilities of Java we may use when we want to force a conversion
that wouldn’t be done automatically?
a) Type cast b) Promotion c) Literals d) Data type
91. What do we call the statement that enable to control the flow of execution?
a) Loops b) Control Structures c) Inheritance d) Aggrigation
92.Which statement is a group of statements enclosed between a pair of braces {}?
a) block b) Loops c) If d) Switch
93.Which statement is used when there are many alternative actions to be taken
depending upon the value of a variable or expression?
a) If b) switch c) While d) For
94.In ……….. case , if a match is found, the respective case statement are executed.
a) switch b) If c) For d) While
95.In switch case , if no match is found, when which statement is executed?
a) default b) loop c) control d) While
96.Java support 3 types of looping constructs:
a) for b) while c) do…. while d) All of these
97.In which loops, test expression is evaluated first and the statements in the loop
are executed if condition is true.
a) for & do … while b) for & while c) If d) Switch case
98.Which loops are called entry – controlled or pre – test loop constructs?
a) for & while b) while & do … while c) If d) Switch case
105 ………………. loop is exit – controlled or post – test loop constructs.
a) do …. while b) While c) For d) If
99.The …………… statement is used to transfer the control outside switch or loop
structure.
a) break b) Continue c) case d) For
100. In a loop, …………. statement is used to exit the loop.
a) break b) Continue c) case d) For
101. Which class defines a whole set of mathematical operations?
a) Math b) Mathematical c) ams math d) mathc
102. If we want to control which loop to break and which loop to reiterate, we
can use
…………..
a) Labeled loops b) Labeled break c) break d) Continue
103. To use a labeled loop, add the label followed by …………. before the loop.
a) colon (:) b) semi colon(;) c) comma (,) d) dash ( – )
104. Use of ………….. statement is used to skip the following statements in a loop
and
continue with the next iteration.
a) break b) Continue c) case d) For
105. Which of the following is an example of If statement?
a) Branching b) decision c) selective d) All of these
106. In Java, how many levels of visibility modifiers are available for access
control? a) 2 b) 4 c) 8 d) 6
107. Which of the following editor is used to create Java file in Ubuntu?
a) Scite b) Calc c) Writer d) Wordpad
108. Which of the following is right when Java file is created?
a) Name must start with Number „2 Only
b) Java source file & class name must be different.
c) Java source file & class name must be same.
d) Name must have symbol „$‟ at the end.
109. Which of the following is comment statement in Java?
a) /* ….*/ b) /#….#/ c) *….\ d) /…../
110. Which of the following command is given in JDK using Java interpreter?
a) java CallCost b) run CallCost c) javarc CallCost d) javac CallCost
111. Which of the following is missing from compilation process to execute
Java application?
a) Java Bookcode file (.cla) b) Java Bitecode file(.csc)
c) JavaBytecode file (*.class) d) Java Compilercode (.Javacr)