Questions · Page 1 of 15

MCQ

🎯

Test yourself on this topic

50 questions · timed · auto-graded

MCQ 11 Mark
…………. subroutine statements are used to display information of Java program to the user.
  • A
    Function
  • B
    Method
  • both (A) and (B)
  • D
    None of these
Answer
Correct option: C.
both (A) and (B)
(C) (A) or (B)
View full question & answer
MCQ 21 Mark
Which of the following has its scope in the block where it is defined?
  • A
    Literal
  • B
    Function
  • Variable
  • D
    None of these
Answer
Correct option: C.
Variable
Variable
View full question & answer
MCQ 41 Mark
By default, numeric literal is assumed to be of the following type.
  • Double
  • B
    Float
  • C
    Long
  • D
    Byte
Answer
Correct option: A.
Double
Double
View full question & answer
MCQ 61 Mark
What is added after the keyword break or continue to transfer control elsewhere?
  • Label name
  • B
    Label name,
  • C
    Label name;
  • D
    Label name:
Answer
Correct option: A.
Label name
Label name
View full question & answer
MCQ 71 Mark
What is added before the loop to use a labelled loop?
  • A
    Label followed by colon (:)
  • Label followed by semicolon (;)
  • C
    Colon followed by label
  • D
    Semicolon followed by label
Answer
Correct option: B.
Label followed by semicolon (;)
Label followed by semicolon (;)
View full question & answer
MCQ 81 Mark
Which of the following is a use of labelled loop?
  • A
    To control the exit of certain loop
  • B
    To control the reiteration of certain loop
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 91 Mark
What is used if we want to control a loop to break and a loop to reiterate?
  • Labelled loop
  • B
    Hided loop
  • C
    Highlighted loop
  • D
    Advanced loop
Answer
Correct option: A.
Labelled loop
Labelled loop
View full question & answer
MCQ 101 Mark
Which of the following loop restarts the enclosing loop?
  • Continue
  • B
    Break
  • C
    Default
  • D
    Go
Answer
Correct option: A.
Continue
Continue
View full question & answer
MCQ 111 Mark
Which statement breaks the nearest enclosing loop and transfers the control outside the loop, when we use nested loop?
  • Break
  • B
    Continue
  • C
    Default
  • D
    Go
Answer
Correct option: A.
Break
Break
View full question & answer
MCQ 121 Mark
Which statement is used to find square root of variable n?
  • Math.sqrt(n)
  • B
    Math.sqrt(m)
  • C
    sqrt[n]
  • D
    sqrt_n_
Answer
Correct option: A.
Math.sqrt(n)
Math.sqrt(n)
View full question & answer
MCQ 131 Mark
How can we invoke sort function in Java?
  • A
    sqrt.Math
  • B
    Math0.sqrt
  • Math.sqrt0
  • D
    Math.sprt1
Answer
Correct option: C.
Math.sqrt0
Math.sqrt0
View full question & answer
MCQ 141 Mark
Function sqrt0 is one of the static method members of the following class.
  • A
    MathJ
  • Math
  • C
    JMath
  • D
    MathC
Answer
Correct option: B.
Math
Math
View full question & answer
MCQ 151 Mark
Which class defines a whole set of math operations in Java?
  • A
    JMath
  • B
    MathJ
  • Math
  • D
    MathC
Answer
Correct option: C.
Math
Math
View full question & answer
MCQ 161 Mark
Which Java library includes a class called Math?
  • Class
  • B
    Input/Output
  • C
    Arithmetic
  • D
    Console
Answer
Correct option: A.
Class
Class
View full question & answer
MCQ 171 Mark
Which type of loops can be nested in Java?
  • A
    Same
  • B
    Different
  • Both a and b
  • D
    None of these
Answer
Correct option: C.
Both a and b
Both a and b
View full question & answer
MCQ 181 Mark
Break and continue statements are used in the same way in Java and C language.” _
  • Explain this statement.
  • B
    This statement is true.
  • C
    This statement is false.
  • D
    Only continue statement is similar.
Answer
Correct option: A.
Explain this statement.
Explain this statement.
View full question & answer
MCQ 191 Mark
Which statement is used to skip the following statements in a loop and continue with the next iteration?
  • A
    Default
  • B
    Break
  • Continue
  • D
    Go
Answer
Correct option: C.
Continue
Continue
View full question & answer
MCQ 201 Mark
On which statement does the ‘break’ statement jump when it is executed in a loop?
  • Outside the nearest loop
  • B
    Inside loop
  • C
    a or b
  • D
    None of these
Answer
Correct option: A.
Outside the nearest loop
Outside the nearest loop
View full question & answer
MCQ 211 Mark
At which statements does the control of the program transfer when giving a ‘break’ in the loop statement?
  • After the end of the loop
  • B
    Before the end of the loop
  • C
    After the declaring variable
  • D
    None of these
Answer
Correct option: A.
After the end of the loop
After the end of the loop
View full question & answer
MCQ 221 Mark
To exit from what, is the break statement in loop to be used?
  • A
    Program
  • Editor
  • C
    Loop
  • D
    All of these
Answer
Correct option: B.
Editor
Editor
View full question & answer
MCQ 231 Mark
Which statement is used in ‘switch’ structure so that it skips all the following statements and control is transferred at the first statement after the end of ‘switch’ statement?
  • A
    Continue
  • B
    Default
  • Break
  • D
    Go
Answer
Correct option: C.
Break
Break
View full question & answer
MCQ 241 Mark
Which of the following statement is used to transfer the control outside ‘switch’ or loop construct?
  • Break
  • B
    Continue
  • C
    Default
  • D
    Go
Answer
Correct option: A.
Break
Break
View full question & answer
MCQ 251 Mark
Which of the following loop does print integer values from 0 to 9?
  • A
    for (int i=0;i<1O;i++) { System.out.println(i); }
  • B
    int i0; while(i<1O) { System.out.println(i++); }
  • C
    int i0; do { System.out.println(i++); }while(i<1O);
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 261 Mark
In which loop, the test expression is evaluated after executing the statements in a loop?
  • A
    While
  • Do…while
  • C
    For
  • D
    All of these
Answer
Correct option: B.
Do…while
Do…while
View full question & answer
MCQ 271 Mark
In which of the following loop, the statements are executed at least once?
  • Do…while
  • B
    While
  • C
    For
  • D
    All of these
Answer
Correct option: A.
Do…while
Do…while
View full question & answer
MCQ 281 Mark
Which type of loop is the ‘do…while’ loop?
  • A
    Exit-controlled
  • B
    Post-test
  • C
    Entry-controlled
  • Both a and c
Answer
Correct option: D.
Both a and c
Both a and c
View full question & answer
MCQ 291 Mark
Which statement if not executed will result in infinite loop in ‘for’ loop?
  • Break
  • B
    Default
  • C
    Continue
  • D
    a or c
Answer
Correct option: A.
Break
Break
View full question & answer
MCQ 301 Mark
Which of the following is the valid ‘for’ statement, but requires some control statements to break the loop?
  • for (;;)
  • B
    for {;;}
  • C
    for (..)
  • D
    for (,,)
Answer
Correct option: A.
for (;;)
for (;;)
View full question & answer
MCQ 311 Mark
Which of the following is the valid ‘for’ statement?
  • For (;;)
  • B
    For (..)
  • C
    For {;;}
  • D
    For (,,)
Answer
Correct option: A.
For (;;)
For (;;)
View full question & answer
MCQ 321 Mark
Which is the third expression in ‘for’ loop?
  • Iterator
  • B
    Condition
  • C
    Initializer
  • D
    Last value
Answer
Correct option: A.
Iterator
Iterator
View full question & answer
MCQ 331 Mark
‘which is the second expression in ‘for’ loop?
  • Condition
  • B
    Initializer
  • C
    Iterator
  • D
    Last value
Answer
Correct option: A.
Condition
Condition
View full question & answer
MCQ 341 Mark
Which is the first expression in ‘for’ loop?
  • Initialize
  • B
    Condition
  • C
    Iterate
  • D
    Last value
Answer
Correct option: A.
Initialize
Initialize
View full question & answer
MCQ 351 Mark
How are all the three expressions of ‘for’ loop?
  • Optional
  • B
    Compulsory
  • C
    First two compulsory
  • D
    First two optional
Answer
Correct option: A.
Optional
Optional
View full question & answer
MCQ 361 Mark
How many expressions are there in ‘for’ loop?
  • Three
  • B
    Two
  • C
    Four
  • D
    Five
Answer
Correct option: A.
Three
Three
View full question & answer
MCQ 371 Mark
Which loop is used usually when number of iterations is predetermined?
  • A
    While
  • B
    Do…while
  • For
  • D
    All of these
Answer
Correct option: C.
For
For
View full question & answer
MCQ 381 Mark
Which type of loop is ‘for’ and ‘while’ loop in Java?
  • A
    Entry controlled
  • B
    Pre-test
  • Both a and b
  • D
    Exit controlled
Answer
Correct option: C.
Both a and b
Both a and b
View full question & answer
MCQ 391 Mark
In which loop, it is possible that statements in a loop are not executed at all?
  • For and while
  • B
    Do…while
  • C
    If and switch
  • D
    All of these
Answer
Correct option: A.
For and while
For and while
View full question & answer
MCQ 401 Mark
Which of the following are entry-controlled or pre-test loop constructs?
  • For and while
  • B
    If and switch
  • C
    Do…while
  • D
    All of these
Answer
Correct option: A.
For and while
For and while
View full question & answer
MCQ 411 Mark
in which loop, test expression is evaluated first and the statements in the loop are executed if condition is true?
  • For and while
  • B
    Do…while
  • C
    If and switch
  • D
    All of these
Answer
Correct option: A.
For and while
For and while
View full question & answer
MCQ 421 Mark
Which types of looping constructs does Java support?
  • A
    For
  • B
    While
  • C
    Do…while
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 431 Mark
Which statements are optional in ‘switch’ statement?
  • A
    Default
  • B
    Break
  • Both a and c
  • D
    Case
Answer
Correct option: C.
Both a and c
Both a and c
View full question & answer
MCQ 441 Mark
On which statement does the pointer come when executing break statement in ‘switch’?
  • The first statement after the end of switch
  • B
    The first statement before the end of switch
  • C
    End of the program
  • D
    None of these
Answer
Correct option: A.
The first statement after the end of switch
The first statement after the end of switch
View full question & answer
MCQ 451 Mark
Which statement is used to break the ‘switch’ statement?
  • A
    Default
  • Break
  • C
    End
  • D
    Last
Answer
Correct option: B.
Break
Break
View full question & answer
MCQ 461 Mark
Which statement does not exist and if there is no match in any of the cases, the ‘switch’ statement completes without doing anything?
  • Default
  • B
    None
  • C
    Last
  • D
    End
Answer
Correct option: A.
Default
Default
View full question & answer
MCQ 471 Mark
Which statement is optional in a switch statement?
  • Default
  • B
    None
  • C
    Last
  • D
    End
Answer
Correct option: A.
Default
Default
View full question & answer
MCQ 481 Mark
Which statement is executed if no match is found when executing a switch statement?
  • Default
  • B
    None
  • C
    Last
  • D
    End
Answer
Correct option: A.
Default
Default
View full question & answer
MCQ 491 Mark
Which of the following should be a type of the test expression in ‘switch’ statement?
  • A
    Byte, char
  • B
    Short, int
  • C
    Enema
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 501 Mark
In which statement, the value of the test expression is compared with each of the case values in turn from case 1 onwards?
  • Switch
  • B
    For
  • C
    If
  • D
    While
Answer
Correct option: A.
Switch
Switch
View full question & answer