Loading...
QUIZ

Certification Test

 
Que No. 1 ) What is the Ruby syntax for a single-line comment?

A.) /* This is a comment */
B.) ' This is a comment
C.) // This is a comment
D.) # This is a comment


Que No. 2 ) What is the purpose of the break statement in a loop in Ruby?

A.) To continue to the next iteration of the loop
B.) exit the loop and continue with the next statement after the loop
C.) To restart the loop
D.) To create a new loop


Que No. 3 ) Which of the following is not a valid access modifier in Ruby?

A.) public
B.) protected
C.) private
D.) package


Que No. 4 ) What is the purpose of the rescue clause in Ruby's exception handling?

A.) To raise an exception
B.) To define a loop
C.) To handle exceptions and errors
D.) To declare a variable


Que No. 5 ) How do you define an array in Ruby?

A.) array[] arr
B.) arr[] = new array[]
C.) int[] arr
D.) arr = []


Que No. 6 ) Which operator is used for logical AND in Ruby?

A.) &&&
B.) ||
C.) &
D.) &&


Que No. 7 ) What is the purpose of the yield keyword in Ruby?

A.) To exit a loop
B.) To declare a variable
C.) To create an object
D.) To transfer control to a block passed to a method


Que No. 8 ) How do you define a class method in Ruby?

A.) def self.my_method
B.) my_method.def
C.) class my_method
D.) method.my_method


Que No. 9 ) What is the purpose of the until loop in Ruby?

A.) To execute code a fixed number of times
B.) To execute code based on a condition
C.) To define a function
D.) To declare a variable


Que No. 10 ) What is the Ruby syntax for declaring a constant variable?

A.) constant x = 10
B.) x = 10 (constant)
C.) CONST x = 10
D.) X = 10