Ruby

Ruby

1st Grade

80 Qs

quiz-placeholder

Similar activities

112. Al-Ikhlas

112. Al-Ikhlas

1st - 5th Grade

75 Qs

Topic 21 — Digital Twin Technology (MCQs)

Topic 21 — Digital Twin Technology (MCQs)

1st Grade

79 Qs

Test học thức

Test học thức

1st Grade

78 Qs

2C słownictwo

2C słownictwo

1st - 6th Grade

83 Qs

Ruby

Ruby

Assessment

Quiz

Education

1st Grade

Practice Problem

Hard

Created by

Quang Văn

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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?