Which of the following is the valid string method?
The .length method
The .upcase method
The .downcase method
The .irreverse method
Browse topic-based Ruby practice sets.
96 practice sets · Page 2 of 5
Which of the following is the valid string method?
The .length method
The .upcase method
The .downcase method
The .irreverse method
What will the following expression evaluate to !true && !false
True
False
Error
None of the mentioned
What will the following expression evaluate to (true && false) || (!true)
True
False
Error
None of the mentioned
What will the following expression evaluate to true || false
True
False
Error
None of the mentioned
What will the following expression evaluate to true && false
True
False
Error
None of the mentioned
The boolean operator && only result in true when both the values are true?
True
False
Which of the following is a valid boolean operator?
and(&&)
or(||)
not(!)
All of the mentioned
Boolean opeartors are also known as logical operators.
True
False
first_name,Last_name=gets.chomp,gets.chomp is the correct way to get the input from the user.
True
False
Why is gets not preferred instead of gets.chomp?
Gets add an extra new line while chomp removes it
Gets remove an extra new line
Chomp erases the value stored in the variable
All of the mentioned
Which sequence can be used to substitute the value of any ruby expression in a string?
#(expr)
#{expr}
#expr
None of the mentioned
For getting an input from the user which method is used?
get
gets.chomp
get-s
chomp
We use semicolon or parentheses after every print or puts statement.
True
False
Why is the library function 'puts'used for?
Prints whatever is given and print it to the screen
Prints whatever is given and insert a new(blank) line
Gets input from the user
None of the mentioned
Which of the following is not a valid library function?
Puts
Gets
Get
It's a good habit to give two spaces between if statement and condition.
True
False
If statement inside if statement is called Nested if statements.
True
False
What error does the if condition gives if not terminated with end statement?
Syntax error
Unexpected end
Expecting keyword end
All of the mentioned
If expression. The expression can be of which type?
True
Any number
Any string
All of the mentioned
The elsif statement can add many alternatives to if/else statements.
True
False