Font size
WorksheetsRuby Programming Quiz - 1
Total questions: 64
Worksheet time: 47mins
Ruby was created by _________________ in Japan.
Ruby is a pure (a) programming language.
The command used to run a Ruby program file is _________________
In Rails, MVC stands for ____________________
The default database supported by Rails is (a)
The Ruby package manager is called (a)
A gemspec file defines a gem's (a)
In Ruby CGI programming, the library (a) is used.
A cookie in CGI is created using (a)
Popular Ruby web servers include ______
Puma
WEBrick
Passenger
SOAP stands for __________________________________
RubyTk provides GUI features by wrapping Tk toolkit.
(a)
In Tk, GUI elements such as buttons and labels are called (a)
To respond to user actions in Tk, events are handled using (a)
A Tk canvas is used for drawing shapes and _____________
Scrolling in Tk is implemented using _____________ widgets.
Ruby is primarily known as a:
Functional language
Object-oriented scripting language
Procedural-only language
Assembly language
Who is the creator of Ruby?
Guido van Rossum
Yukihiro Matsumoto
James Gosling
Dennis Ritchie
Ruby files have the extension:
.ru
.rb
.r
.ruby
Which of the following is NOT part of Rails MVC?
Model
View
Controller
Router
By default, Rails uses which database in development?
MySQL
PostgreSQL
SQLite
Oracle
RubyGems is used for:
Compiling Ruby code
Installing and managing Ruby packages
Debugging Ruby scripts
Encrypting Ruby files
Which command lists all installed gems?
gem show
gem list
gem display
gem info
A .gemspec file contains:
Gem source code
Metadata about the gem
Compiled gem binaries
User settings
In Ruby CGI, which module must be required?
require 'cgi'
require 'web'
require 'cookies'
require 'http'
Cookies in Ruby CGI are handled with:
CGI::Cookie
Web::Cookie
Rails::Cookie
Http::Cookie
Which of the following is a Ruby web server?
Apache
Puma
Nginx
IIS
SOAP is used for:
GUI programming
Defining MVC models
Web services communication
File compression
REST and SOAP are:
Ruby keywords
GUI elements
Web service protocols
Database systems
RubyTk is a wrapper around:
Qt toolkit
GTK+ toolkit
Tk toolkit
Swing toolkit
In Tk, a button, label, or entry is called a:
Module
Widget
Block
Handler
Which method is used to bind an event to a Tk widget?
on_event
bind
event_add
connect
The Tk canvas widget is mainly used for:
Database queries
Web requests
Drawing graphics
Running Ruby scripts
To enable scrolling in Tk, which widget is required?
Label
Scrollbar
Frame
Panel
Which Ruby command runs an interactive shell?
irb
rb
rubysh
rubyshell
Which framework is most commonly associated with Ruby for web development?
Django
Flask
Rails
Spring
In a C extension, which function would you use to add a new method to a Ruby class?
rb_add_method
rb_define_method
rb_insert_method
rb_class_method
Which macro is used to allocate memory in a Ruby-safe way?
malloc
free
ALLOC
xmalloc_only
The Jukebox extension is an example of:
Extending Ruby with graphics
Embedding Ruby in a web browser
Writing Ruby objects in C
Memory debugging tools
Which of the following functions executes a Ruby expression given as a string in C?
rb_exec_string
rb_eval_string
ruby_execute
rb_run_script
To wrap a custom C struct into a Ruby object, you use:
rb_object_wrap
rb_struct_wrap
Data_Wrap_Struct
rb_define_struct
When embedding Ruby into another application, which function initializes the interpreter?
ruby_exec
ruby_init
rb_start
rb_init_interpreter
The function rb_gc_mark is used to:
Allocate memory
Trigger garbage collection
Mark Ruby objects for GC
Free unused memory directly
Which Ruby type is represented by T_HASH?
Ruby array
Ruby hash
Ruby class
Ruby integer
What does ruby_run_node do?
Compiles Ruby code
Starts the Ruby interactive shell
Runs the main Ruby interpreter loop
Converts Ruby nodes to bytecode
Which of the following is true about VALUE?
It is always a pointer
It can represent any Ruby object
It is used only for integers
It bypasses garbage collection
To embed Ruby inside C, command-line arguments are passed using:
ruby_args
ruby_options
rb_arguments
rb_pass_argv
Who is the creator of PERL?
Dennis Ritchie
Larry Wall
Guido van Rossum
James Gosling
PERL was developed in:
1975
1987
1991
2000
The full form of PERL is:
Program Execution and Report Language
Practical Extraction and Report Language
Processing and Extraction Runtime Language
Parallel Execution and Runtime Language
Which is true about scripts vs programs?
Scripts are compiled, programs are interpreted
Scripts are interpreted, programs are compiled
Both are compiled
Both are interpreted
The origin of scripting languages can be traced to:
Database systems
Shell scripts and batch files
Object-oriented languages
Machine code
Which of the following is a scripting language?
C
Java
Perl
C++
A main feature of scripting languages is:
Strong typing
Platform dependency
Rapid development
Compilation overhead
Which language is most known for client-side web scripting?
Python
Perl
JavaScript
Ruby
Which of these is not a server-side scripting language?
PHP
Python
JavaScript
Perl
Which is a major use of scripting languages?
Writing operating systems
Automation of repetitive tasks
Designing hardware
Compiling code
Perl gained popularity for its:
GUI development
Database design
Text processing
Networking hardware
Which scripting language is widely used in data science today?
Perl
Python
C
Assembly
Web scripting is mainly used to:
Draw graphics
Create dynamic websites
Write device drivers
Build kernels
Which of the following best describes scripting languages?
High-level, compiled, strongly typed
Low-level, machine-oriented
High-level, interpreted, loosely typed
Assembly-level, compiled
Which operator is used for string interpolation in Ruby?
+
%{}
#{ }
$()
What is the output of the following Ruby code? puts "Hello" + "World"
Hello World
Hello+World
HelloWorld
Error
Which method removes duplicate elements from an array?
remove!
uniq
delete_duplicates
clear
