Questions · Page 2 of 15

MCQ

MCQ 511 Mark
In which of the following statement, the result of the test expression must be of the type taking discrete values?
  • Switch
  • B
    For
  • C
    If
  • D
    While
Answer
Correct option: A.
Switch
Switch
View full question & answer
MCQ 521 Mark
Which statement is used when there are many alternative actions to be taken depending upon the value of a variable or expression?
  • Switch
  • B
    For
  • C
    If
  • D
    While
Answer
Correct option: A.
Switch
Switch
View full question & answer
MCQ 531 Mark
Write Java statement to assign value ‘A’ to variable ‘grade’.
  • A
    Grade = A
  • Grade = 'A'
  • C
    Grade = ‘A’
  • D
    Grade = “A”
Answer
Correct option: B.
Grade = 'A'
Grade = 'A'
View full question & answer
MCQ 541 Mark
Write Java statement to check whether the value of variable ‘marks’ is greater than or equal to 70.
  • If (marks > 70)
  • B
    If [marks < 70]
  • C
    If (m > 70)
  • D
    If (m>=70)
Answer
Correct option: A.
If (marks > 70)
If (marks > 70)
View full question & answer
MCQ 551 Mark
What is it called when an ‘if’ statement is used in another ‘if’ statement?
  • Casted — if
  • B
    Nested — if
  • C
    Inner — if
  • D
    Shorted — if
Answer
Correct option: A.
Casted — if
Casted — if
View full question & answer
MCQ 561 Mark
Write Java statement to check whether the remainder is zero or not when the value of variable x is divided by 2.
  • If (x%2==0)
  • B
    If (x%2=0)
  • C
    If (x/2==0)
  • D
    If ((x/2) =0)
Answer
Correct option: A.
If (x%2==0)
If (x%2==0)
View full question & answer
MCQ 571 Mark
What will be used to make it easy to insert other statement?
  • Block
  • B
    Typecasting
  • C
    Nesting
  • D
    None of these
Answer
Correct option: A.
Block
Block
View full question & answer
MCQ 581 Mark
What is advisable to use in ‘if’ statement?
  • Block
  • B
    Typecasting
  • C
    Nesting
  • D
    None of these
Answer
Correct option: A.
Block
Block
View full question & answer
MCQ 591 Mark
How many statements are there as statement in ‘if’ statement?
  • A
    One
  • B
    Block (More than one)
  • a or b
  • D
    None of these
Answer
Correct option: C.
a or b
a or b
View full question & answer
MCQ 601 Mark
When does it execute a block of statements written after ‘else’ in ‘if’ statement?
  • A
    When value of Boolean expression is true
  • When value of Boolean expression is false
  • C
    When there is no Boolean expression.
  • D
    None of these of these
Answer
Correct option: B.
When value of Boolean expression is false
When value of Boolean expression is false
View full question & answer
MCQ 611 Mark
Which statement is executed if the value of Boolean expression is true?
  • Statement 1
  • B
    Statement2
  • C
    Else
  • D
    None of these
Answer
Correct option: A.
Statement 1
Statement 1
View full question & answer
MCQ 621 Mark
What is evaluated first when ‘if’ statement is executed?
  • Boolean expression
  • B
    Statement1
  • C
    Statement2
  • D
    None of these
Answer
Correct option: A.
Boolean expression
Boolean expression
View full question & answer
MCQ 631 Mark
As which of the following control structure is the ‘if’ statement known?
  • A
    Branching
  • B
    Decision
  • C
    Selective
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 641 Mark
Which of the following statement enables to take one of two alternative courses of action, depending on whether the value of a given Boolean valued expression is true or false?
  • A
    For
  • B
    While
  • C
    Else
  • if
Answer
Correct option: D.
if
if
View full question & answer
MCQ 651 Mark
A variable declared in one block has nothing to do with a variable with same name as declared in other block.” What can we say about this statement?
  • This statement is true.
  • B
    This statement is false.
  • C
    Depends upon data type
  • D
    Depends upon Java version
Answer
Correct option: A.
This statement is true.
This statement is true.
View full question & answer
MCQ 661 Mark
What happens when we declare a variable inside other block of program as same name as declared inside in main () method?
  • There will be conflict with both variables and error will be displayed.
  • B
    Textbox for changing name will be displayed.
  • C
    Variable will be created.
  • D
    None of these
Answer
Correct option: A.
There will be conflict with both variables and error will be displayed.
There will be conflict with both variables and error will be displayed.
View full question & answer
MCQ 671 Mark
What happens when we declare a variable with the same name as of the variable in scope?
  • There will be an error.
  • B
    Another variable will be created with the same name.
  • C
    Another variable will be created with the different name.
  • D
    None of these
Answer
Correct option: A.
There will be an error.
There will be an error.
View full question & answer
MCQ 681 Mark
The scope of a variable defined inside a block is limited to that block only.” Explain this statement.
  • This statement is true.
  • B
    This statement is false.
  • C
    Depends upon Java version
  • D
    Depends upon program
Answer
Correct option: A.
This statement is true.
This statement is true.
View full question & answer
MCQ 691 Mark
What can a variable to the block be called?
  • A
    Non-local
  • B
    Local
  • Global
  • D
    None of these
Answer
Correct option: C.
Global
Global
View full question & answer
MCQ 701 Mark
What kind of variable is to be when we declare a variable inside a block?
  • A
    Inaccessible to outside that block
  • B
    Invisible
  • 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 711 Mark
Where does the variable inside a block?
  • Outside the block
  • B
    Inside the block
  • C
    Everywhere
  • D
    None of these
Answer
Correct option: A.
Outside the block
Outside the block
View full question & answer
MCQ 721 Mark
What kind of variable is to be when we declare a variable inside a block?
  • Local to block
  • B
    Local to program
  • C
    Global
  • D
    None of these
Answer
Correct option: A.
Local to block
Local to block
View full question & answer
MCQ 731 Mark
Within which of the following, variables are created with local scope for statements?
  • Block
  • B
    Type-casting
  • C
    Nesting
  • D
    None of these
Answer
Correct option: A.
Block
Block
View full question & answer
MCQ 741 Mark
What is used to group related statements logically?
  • Block
  • B
    Type-casting
  • C
    Nesting
  • D
    None of these
Answer
Correct option: A.
Block
Block
View full question & answer
MCQ 751 Mark
A block statement is a group of statements enclosed between the following type of brackets.
  • { }
  • B
    ( )
  • C
    [ ]
  • D
    < >
Answer
Correct option: A.
{ }
{ }
View full question & answer
MCQ 761 Mark
Which of the following control structures are used to determine the normal flow of control in a program?
  • A
    If statement, switch statement
  • B
    Do…while loop
  • C
    For loop, while loop
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 771 Mark
Which of the following is also called selective structure?
  • Branches
  • B
    Loops
  • C
    Function
  • D
    Block
Answer
Correct option: A.
Branches
Branches
View full question & answer
MCQ 781 Mark
Which of the following is used to choose among two or more possible courses of action?
  • Branches
  • B
    Loops
  • C
    Function
  • D
    Block
Answer
Correct option: A.
Branches
Branches
View full question & answer
MCQ 791 Mark
Which of the following is used to repeat a sequence of statements over and over until some condition occurs?
  • Loops
  • B
    Branches
  • C
    Function
  • D
    Block
Answer
Correct option: A.
Loops
Loops
View full question & answer
MCQ 801 Mark
Which are the types of control structure?
  • A
    Loops
  • B
    Branches
  • 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 811 Mark
What are those statements known as that enable to control the flow of execution?
  • A
    Loop structures
  • B
    Nested structures
  • Control structures
  • D
    None of these
Answer
Correct option: C.
Control structures
Control structures
View full question & answer
MCQ 821 Mark
In general, how are the statements executed?
  • A
    Randomly
  • Ordered
  • C
    Disordered
  • D
    In descending order
Answer
Correct option: B.
Ordered
Ordered
View full question & answer
MCQ 841 Mark
How is the expression 72/2/3 treated?
  • (72/2)/3
  • B
    72 / (2/3)
  • C
    (72/3) /2
  • D
    72 / (3/2)
Answer
Correct option: A.
(72/2)/3
(72/2)/3
View full question & answer
MCQ 851 Mark
Which expression is made after evaluating z = 7 in x = y = z
  • x=y=7
  • B
    y=7
  • C
    x=y=z
  • D
    y=z
Answer
Correct option: A.
x=y=7
x=y=7
View full question & answer
MCQ 871 Mark
Choose the right associativity of assignment operator.
  • From right to left
  • B
    From left to right
  • C
    Whatever side
  • D
    None of these
Answer
Correct option: A.
From right to left
From right to left
View full question & answer
MCQ 881 Mark
From x=y=z=7, what to understand of the following, it will give 7 to value of three variables?
  • x = (y = (z = 7))
  • B
    (x=y) = (z=7)
  • C
    (x=y=z)=7
  • D
    (x=y=) z=7
Answer
Correct option: A.
x = (y = (z = 7))
x = (y = (z = 7))
View full question & answer
MCQ 891 Mark
Which are the operators’ that have highest precedence?
  • A
    ++, --, !
  • B
    Unary — and +
  • C
    Type-cast
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 901 Mark
Which operator has the lowest precedence?
  • Assignment operator
  • B
    Conditional operator
  • C
    Unary operation
  • D
    Relational operator
Answer
Correct option: A.
Assignment operator
Assignment operator
View full question & answer
MCQ 911 Mark
Which operator has the highest precedence?
  • Unary operation
  • B
    Assignment operator
  • C
    Conditional operator
  • D
    Relational operator
Answer
Correct option: A.
Unary operation
Unary operation
View full question & answer
MCQ 921 Mark
Which of the following operators have the highest precedence?
  • ++, _ _, ! , type-cast
  • B
    , ?, %
  • C
    =, +=, — =
  • D
    &&, II
Answer
Correct option: A.
++, _ _, ! , type-cast
++, _ _, ! , type-cast
View full question & answer
MCQ 931 Mark
in which of the following option, associativity is from right-to-left?
  • A
    Unary operations
  • B
    Assignment
  • 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 941 Mark
Which is the direction of associativity in most of the cases?
  • From left to right
  • B
    From right to left
  • C
    From right side to the second operator of left side
  • D
    From left side to the second operator of right side
Answer
Correct option: A.
From left to right
From left to right
View full question & answer
MCQ 951 Mark
What does associativity determine?
  • The direction in which operations are performed (Left to Right or Right to Left)
  • B
    The order in which operations are performed
  • C
    Both a and b
  • D
    None of these
Answer
Correct option: A.
The direction in which operations are performed (Left to Right or Right to Left)
The direction in which operations are performed (Left to Right or Right to Left)
View full question & answer
MCQ 961 Mark
Which of the following operators have the highest precedence?
  • When two operators having same precedence
  • B
    When two operators having different precedence
  • C
    When Boolean operators are used
  • D
    None of these
Answer
Correct option: A.
When two operators having same precedence
When two operators having same precedence
View full question & answer
MCQ 971 Mark
in which of the following option, associativity is from right-to-left?
  • A
    Unary operations
  • B
    Assignment
  • 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 981 Mark
What does associativity determine?
  • The direction in which operations are performed (Left to Right or Right to Left)
  • B
    The order in which operations are performed
  • C
    Both a and b
  • D
    None of these
Answer
Correct option: A.
The direction in which operations are performed (Left to Right or Right to Left)
The direction in which operations are performed (Left to Right or Right to Left)
View full question & answer
MCQ 991 Mark
When is the expression to be evaluated according to its associativity?
  • When two operators having same precedence
  • B
    When two operators having different precedence
  • C
    When Boolean operators are used
  • D
    None of these
Answer
Correct option: A.
When two operators having same precedence
When two operators having same precedence
View full question & answer
MCQ 1001 Mark
Which of following is used to avoid confusion during calculation?
  • ( )
  • B
    { }
  • C
    < >
  • D
    [ ]
Answer
Correct option: A.
( )
( )
View full question & answer
MCQ - Page 2 - COMPUTER STD 12 Science Questions - Vidyadip