Search Header Logo

Ruby

Authored by Quang Văn

Education

1st Grade

Used 1+ times

Ruby
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

80 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which variable name is valid in Ruby? (Choose one.)

3y
=FALSE()
_9class
xyz$
Pluto

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Given the following:

MSG = "hello"

MSG.upcase!

p MSG

What is the correct result? (Choose one.)

An error occurs because MSG is a constant.

HELLO is displayed without warning.

A warning apears because MSG is a constant but HELLO is displayed

hello is displayed since MSG is a constant.

3.

MULTIPLE SELECT QUESTION

20 sec • 1 pt

Which of the following statements are true? (Choose two.):

Local variables start with a lower case letter, and are two or more characters in length.
Global variables start with $.
Instance variables start with *.Constants start with an upper case letter.

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Choose one suitable name for the class variable.

@name
@@name
$name
$$name

5.

MULTIPLE SELECT QUESTION

20 sec • 1 pt

Select all correct variable names in Ruby

@s
@@s
@@@s
$$s

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Given the following:

MSG = "hello"

MSG = MSG.upcase

p MSG

What is the correct result? (Choose one.)

An error occurs because MSG is a constant.

HELLO is displayed without warning.

A warning apears because MSG is a constant but HELLO is displayed

hello is displayed since MSG is a constant.

7.

MULTIPLE SELECT QUESTION

20 sec • 1 pt

Which of the following can be inserted into __(1)__ in order to generate the output below? (Choose two.)

$code = "CODE"

__(1)__

puts "i like writing #{$code}"

puts "i like writing #$code"

puts 'i like writing #{$code}'

puts 'i like writing #$code'

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?