[go: up one dir, main page]

0% found this document useful (0 votes)
10 views7 pages

STD 12-CHAPTER-7

Uploaded by

Ilesh Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views7 pages

STD 12-CHAPTER-7

Uploaded by

Ilesh Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

CHAPTER-07: Java Basics

1. How many basic (primitive) data types are supported in Java?


a. 2
b. 4
c. 8
d. 16
2. What is the default data type of floating point literal?
a. int
b. long
c. float
d. double
3. Which character set is used for char data type in Java?
a. Unicode
b. ASCII
c. EBCIDIC
d. All of these
4. Which of the following is compiled error free?
a. for (;;) {int i=7}
b. while (1) {int i=7}
c. while (True) {int i = 7}
d. All of these
5. Which of the following is not allowed as first character in valid variable
name?
a. Underscore (_)
b. Digit
c. Letter
d. Dollar ($)
6. Which of the following is not a basic data type in Java?
a. char
b. long
c. byte
d. String
7. What is the default value of Boolean type data?
a. null
b. true
c. false
d. 0
8. What will be the result of arithmetic expression 7/2?
a. 3
b. 3.5
c. 1
d. 0
9. What will be the result of arithmetic expression –7%2 ?
a. –3
b. –1
c. 1
d. –3.5
10. What will be the result of arithmetic expression –7.5%2 ?
a. –3
b. –1.5
c. 1.5
d. Error
Exam Oriented MCQs
1. Java is an ………………….. language.
a) Object Oriented Programming b) Procedural programming
c) Basic programming d) All
2. Java was developed by which company in 1991?
a) Sun Microsystems b) Microsoft c) Apple d) ABM
3. In Java, who provides basic data types, system I/O capabilities and other utility
functions?
a) JDK b) class libraries c) JVM d) UML
4. Basic classes are part of the…………
a) JDK b) JVM c) UML d) OML
5. Who have classes to support networking, common Internet protocols and
interface toolkit functions?
a) JDK b) Java Source c) JVM d) UML
6. Java is platform – independent at …………………. level.
a)Source b) binary c) Datatype d) Both a and b
7. Program’s capability of being moved easily from one computer system to
another is known as
a) Interpreter b) Platform – independent c) Compiler d) Source code
8. At binary level, platform – independent is possible due to which feature?
a) Bytecode Independent b) Bytecode Interpreter c) Compiler d) Source code
9. Programs written in Java are compiled into ……………….. language.
a) machine b) Binary c) Source d) Bytecode
10. In Java virtual computer is known as………….
a) JVM b) JDK c) UML d) OML
11. What do we called the machine language which is used for JVM?
a) JavaScript b) Java bytecode c) Java Binary code d) Source code
12. What is the only disadvantage of using bytecode?
a) Slow in execution speed b) Machine independent
c) virtual language d) None
13. What is the disadvantage of native code?
a) Slow in execution speed b) Machine independent
c) Virtual language d) None
14. From the following what is not available in Java?
a) type casting b) typedef c) typecode d) Type
15. Java source files are given the …………. name as the class they define.
a) same b) different c) double d) linear
16. What is the extension of Java source file?
a) .class b) .java c) .javac d) .jvm
17. What happen when program gets compiled without error?
a) Creates a class file b) Show the output of program
c) create java file d) create binary file
18. What is the extension of class file?
a) .class b) .java c) .javac d) .jvm
19. When we run the program, the Java interpreter calls which method?
a) class ( ) b) main ( ) c) string( ) d) static( )
20. The ……. routine can call other subroutines that are defined in the same
class or
even in other classes.
a) class ( ) b) main ( ) c) string( ) d) static( )
21. Write down the right process of compiling and executing a Java application.
Ans. Java Source File – Java Compiler – Java Bytecode File – JVM
22.Which words means that this routine can be called from outside the program?
a) private b) public c) protected d) packages
23.The rules that determines what is allowed are called the ………….of the language.
a) Syntax b) Keyword c) Literals d) Variables
24. Text in angle bracket is used as a …………. that describes something actual
we
need to type while writing actual program.
a) Place holder b) keyword c) literals d) variables
25.Function header and the sequence of statements enclosed between which
braces? a) { } b) < > c) [ ] d) ( )
26.Which can’t exists by itself?
a) function b) method c) Main( ) d) variable
27.Method has to be a part of which section of Java?
a) class b) Literals c) Method d) main( )
28. Structure of Java program.
public class
{
public static void main (String [ ] args)
{
<statements>

}
<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)

You might also like