wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Ruby Programming Quiz - 1

Total questions: 64

Worksheet time: 47mins

Name
Class
Date
1.

Ruby was created by _________________ in Japan.

4 lines
2.

Ruby is a pure (a)   programming language.

3.

The command used to run a Ruby program file is _________________

4 lines
4.

In Rails, MVC stands for ____________________

4 lines
5.

The default database supported by Rails is (a)  

6.

The Ruby package manager is called (a)  

7.

A gemspec file defines a gem's (a)  

8.

In Ruby CGI programming, the library (a)   is used.

9.

A cookie in CGI is created using (a)  

10.

Popular Ruby web servers include ______

a)

Puma

b)

WEBrick

c)

Passenger

11.

SOAP stands for __________________________________

4 lines
12.

RubyTk provides GUI features by wrapping Tk toolkit.

(a)  

13.

In Tk, GUI elements such as buttons and labels are called (a)  

14.

To respond to user actions in Tk, events are handled using (a)  

15.

A Tk canvas is used for drawing shapes and _____________

4 lines
16.

Scrolling in Tk is implemented using _____________ widgets.

4 lines
17.

Ruby is primarily known as a:

a)

Functional language

b)

Object-oriented scripting language

c)

Procedural-only language

d)

Assembly language

18.

Who is the creator of Ruby?

a)

Guido van Rossum

b)

Yukihiro Matsumoto

c)

James Gosling

d)

Dennis Ritchie

19.

Ruby files have the extension:

a)

.ru

b)

.rb

c)

.r

d)

.ruby

20.

Which of the following is NOT part of Rails MVC?

a)

Model

b)

View

c)

Controller

d)

Router

21.

By default, Rails uses which database in development?

a)

MySQL

b)

PostgreSQL

c)

SQLite

d)

Oracle

22.

RubyGems is used for:

a)

Compiling Ruby code

b)

Installing and managing Ruby packages

c)

Debugging Ruby scripts

d)

Encrypting Ruby files

23.

Which command lists all installed gems?

a)

gem show

b)

gem list

c)

gem display

d)

gem info

24.

A .gemspec file contains:

a)

Gem source code

b)

Metadata about the gem

c)

Compiled gem binaries

d)

User settings

25.

In Ruby CGI, which module must be required?

a)

require 'cgi'

b)

require 'web'

c)

require 'cookies'

d)

require 'http'

26.

Cookies in Ruby CGI are handled with:

a)

CGI::Cookie

b)

Web::Cookie

c)

Rails::Cookie

d)

Http::Cookie

27.

Which of the following is a Ruby web server?

a)

Apache

b)

Puma

c)

Nginx

d)

IIS

28.

SOAP is used for:

a)

GUI programming

b)

Defining MVC models

c)

Web services communication

d)

File compression

29.

REST and SOAP are:

a)

Ruby keywords

b)

GUI elements

c)

Web service protocols

d)

Database systems

30.

RubyTk is a wrapper around:

a)

Qt toolkit

b)

GTK+ toolkit

c)

Tk toolkit

d)

Swing toolkit

31.

In Tk, a button, label, or entry is called a:

a)

Module

b)

Widget

c)

Block

d)

Handler

32.

Which method is used to bind an event to a Tk widget?

a)

on_event

b)

bind

c)

event_add

d)

connect

33.

The Tk canvas widget is mainly used for:

a)

Database queries

b)

Web requests

c)

Drawing graphics

d)

Running Ruby scripts

34.

To enable scrolling in Tk, which widget is required?

a)

Label

b)

Scrollbar

c)

Frame

d)

Panel

35.

Which Ruby command runs an interactive shell?

a)

irb

b)

rb

c)

rubysh

d)

rubyshell

36.

Which framework is most commonly associated with Ruby for web development?

a)

Django

b)

Flask

c)

Rails

d)

Spring

37.

In a C extension, which function would you use to add a new method to a Ruby class?

a)

rb_add_method

b)

rb_define_method

c)

rb_insert_method

d)

rb_class_method

38.

Which macro is used to allocate memory in a Ruby-safe way?

a)

malloc

b)

free

c)

ALLOC

d)

xmalloc_only

39.

The Jukebox extension is an example of:

a)

Extending Ruby with graphics

b)

Embedding Ruby in a web browser

c)

Writing Ruby objects in C

d)

Memory debugging tools

40.

Which of the following functions executes a Ruby expression given as a string in C?

a)

rb_exec_string

b)

rb_eval_string

c)

ruby_execute

d)

rb_run_script

41.

To wrap a custom C struct into a Ruby object, you use:

a)

rb_object_wrap

b)

rb_struct_wrap

c)

Data_Wrap_Struct

d)

rb_define_struct

42.

When embedding Ruby into another application, which function initializes the interpreter?

a)

ruby_exec

b)

ruby_init

c)

rb_start

d)

rb_init_interpreter

43.

The function rb_gc_mark is used to:

a)

Allocate memory

b)

Trigger garbage collection

c)

Mark Ruby objects for GC

d)

Free unused memory directly

44.

Which Ruby type is represented by T_HASH?

a)

Ruby array

b)

Ruby hash

c)

Ruby class

d)

Ruby integer

45.

What does ruby_run_node do?

a)

Compiles Ruby code

b)

Starts the Ruby interactive shell

c)

Runs the main Ruby interpreter loop

d)

Converts Ruby nodes to bytecode

46.

Which of the following is true about VALUE?

a)

It is always a pointer

b)

It can represent any Ruby object

c)

It is used only for integers

d)

It bypasses garbage collection

47.

To embed Ruby inside C, command-line arguments are passed using:

a)

ruby_args

b)

ruby_options

c)

rb_arguments

d)

rb_pass_argv

48.

Who is the creator of PERL?

a)

Dennis Ritchie

b)

Larry Wall

c)

Guido van Rossum

d)

James Gosling

49.

PERL was developed in:

a)

1975

b)

1987

c)

1991

d)

2000

50.

The full form of PERL is:

a)

Program Execution and Report Language

b)

Practical Extraction and Report Language

c)

Processing and Extraction Runtime Language

d)

Parallel Execution and Runtime Language

51.

Which is true about scripts vs programs?

a)

Scripts are compiled, programs are interpreted

b)

Scripts are interpreted, programs are compiled

c)

Both are compiled

d)

Both are interpreted

52.

The origin of scripting languages can be traced to:

a)

Database systems

b)

Shell scripts and batch files

c)

Object-oriented languages

d)

Machine code

53.

Which of the following is a scripting language?

a)

C

b)

Java

c)

Perl

d)

C++

54.

A main feature of scripting languages is:

a)

Strong typing

b)

Platform dependency

c)

Rapid development

d)

Compilation overhead

55.

Which language is most known for client-side web scripting?

a)

Python

b)

Perl

c)

JavaScript

d)

Ruby

56.

Which of these is not a server-side scripting language?

a)

PHP

b)

Python

c)

JavaScript

d)

Perl

57.

Which is a major use of scripting languages?

a)

Writing operating systems

b)

Automation of repetitive tasks

c)

Designing hardware

d)

Compiling code

58.

Perl gained popularity for its:

a)

GUI development

b)

Database design

c)

Text processing

d)

Networking hardware

59.

Which scripting language is widely used in data science today?

a)

Perl

b)

Python

c)

C

d)

Assembly

60.

Web scripting is mainly used to:

a)

Draw graphics

b)

Create dynamic websites

c)

Write device drivers

d)

Build kernels

61.

Which of the following best describes scripting languages?

a)

High-level, compiled, strongly typed

b)

Low-level, machine-oriented

c)

High-level, interpreted, loosely typed

d)

Assembly-level, compiled

62.

Which operator is used for string interpolation in Ruby?

a)

+

b)

%{}

c)

#{ }

d)

$()

63.

What is the output of the following Ruby code? puts "Hello" + "World"

a)

Hello World

b)

Hello+World

c)

HelloWorld

d)

Error

64.

Which method removes duplicate elements from an array?

a)

remove!

b)

uniq

c)

delete_duplicates

d)

clear