JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B. Tech III SCRIPTING LANGUAGES Previous Question Paper (August/September - 2021 - R18)
Answer any five questions
All questions carry equal marks
Main
Describe about lexical and syntactic structure of Ruby language.
Answer
Ruby is a case-sensitive, object-oriented language with a flexible lexical and syntactic structure. Lexically, Ruby source code is interpreted as UTF-8 by default. It uses whitespace for readability, but unlike Python, it does not use indentation to define blocks; instead, it uses keywords like do...end or begin...end. Identifiers follow specific conventions: local variables start with a lowercase letter or underscore, instance variables with @, class variables with @@, and global variables with $.
Syntactically, Ruby is highly expressive and emphasizes programmer productivity. It supports optional parentheses for method calls, allowing for a natural language style. Statements are typically terminated by newlines or semicolons. Blocks of code are first-class citizens, often passed to methods using yield or as Proc objects. The language supports various literals for strings, arrays, and hashes, and utilizes symbols (:symbol) for efficient identification.
How do we write CGI scripts using Ruby? Explain with simple CGI script?
Answer
Ruby provides the cgi library to facilitate the creation of Common Gateway Interface (CGI) scripts. To write a CGI script, one must include the cgi module, instantiate a CGI object, and output the necessary HTTP headers followed by the HTML content. The script must be executable and reside in the server's cgi-bin directory.
Example of a basic Ruby CGI script:
#!/usr/bin/ruby
require 'cgi'
cgi = CGI.new("html4")
puts cgi.header
cgi.out do
cgi.html do
cgi.head { cgi.title { "CGI Script" } } +
cgi.body { cgi.h1 { "Hello from Ruby CGI!" } }
end
endIn this script, cgi.header generates the required Content-Type header, and the cgi.out method simplifies the generation of HTML tags by providing a block-based syntax for nesting elements.
How do we do package management in Ruby using RubyGems?
Answer
Sign in to view the complete answer paper.
Describe the usage of erb and eruby packages in Ruby.
Answer
Sign in to view the complete answer paper.
Write the steps for building our own extensions in Ruby.
Answer
Sign in to view the complete answer paper.
Explain about different Ruby objects in C.
Answer
Sign in to view the complete answer paper.
Write a Ruby programming for wrapping of C structures in Jukebox extension.
Answer
Sign in to view the complete answer paper.
Explain about object creation and cloning of objects in Ruby.
Answer
Sign in to view the complete answer paper.
Enumerate various characteristics of Scripting languages.
Answer
Sign in to view the complete answer paper.
How do we create packages and modules in Perl?
Answer
Sign in to view the complete answer paper.
Explain about different uses of web scripting languages.
Answer
Sign in to view the complete answer paper.
Compare Lists with Hashes in Perl language.
Answer
Sign in to view the complete answer paper.
Illustrate file status check codes available in Perl using a program.
Answer
Sign in to view the complete answer paper.
Summarize the steps for creating Internet-aware applications in Perl.
Answer
Sign in to view the complete answer paper.
Explain how global, upvar and uplevel behaves in TCL with examples?
Answer
Sign in to view the complete answer paper.
Explain the list of available selection widgets in TK with examples.
Answer
Sign in to view the complete answer paper.