Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Testing in Ruby

Total questions: 15

Worksheet time: 10mins

Name
Class
Date
1.

What is the process of evaluating a piece of software to determine whether it meets specified requirements and to identify any defects?

4 lines
2.

What does TDD stand for?

a)

Test-Driven Development

b)

Test-Defined Development

c)

Test-Driven Design

3.

What is the purpose of unit testing?

a)

Identify bugs early

b)

Ensure code reliability

c)

Facilitate code changes

4.

What are the benefits of using unit testing?

a)

Catches issues early in development

b)

Simplifies debugging

c)

Provides documentation for code

d)

Enhances code maintainability

5.

What command is used to run the test in RSpec?

a)

rspec greeter_spec.rb

b)

run greeter_spec.rb

c)

test greeter_spec.rb

6.

What does benchmarking measure?

a)

How fast your code runs

b)

How much memory your code uses

c)

How many bugs are in your code

7.

What is the purpose of profiling?

a)

Identify parts of your code that need optimization

b)

Measure how fast your code runs

c)

Check for bugs in your code

8.

What Ruby feature allows jumping out of loops conditionally?

a)

Return

b)

Raise

c)

Catch and Throw

d)

Exit

9.

What is the purpose of a breakpoint in the Ruby debugger?

a)

To speed up code

b)

To end execution

c)

To pause code and inspect state

d)

To handle exceptions

10.

What is the first step in Test-Driven Development (TDD)?

a)

Write the code

b)

Deploy the app

c)

Write the test

d)

Run the test

11.

Which command is used to run tests written in RSpec?

a)

ruby spec_test.rb

b)

run greeter_test

c)

rspec greeter_spec.rb

d)

run rspec_test.rb

12.

Which Ruby library helps find memory/time bottlenecks?

a)

MiniTest

b)

RubyProf

c)

Faker

d)

ActiveRecord

13.

What is the purpose of RDoc in Ruby?

a)

Running unit tests

b)

Profiling code performance

c)

Generating HTML documentation from Ruby source code

d)

Debugging syntax errors

14.

What command is used to generate documentation using RDoc?

a)

ruby doc.rb

b)

rdoc

c)

generate doc

d)

rspec

15.

How do you write a comment in RDoc for a class?

a)

// This is a class

b)

/* Class comment */

c)

# This is a class

d)

## Class: ClassName