JNTU

JNTU B.Tech III SCRIPTING LANGUAGES Previous Question Paper (August - 2022 - R18)

B.Tech | III | II | R18 | August - 2022

Answer PaperPaper Code: 156CUMaximum Marks: 75Time: 3 Hours

Answer any five questions

All questions carry equal marks

Main

115 marks
a

Compare ruby language with Perl with respect to various features and list the advantages of Ruby language.

8 marks

Answer

Ruby and Perl are both powerful scripting languages, but they differ significantly in design philosophy and syntax. Perl was designed as a "glue" language for text processing and system administration, emphasizing "There is more than one way to do it" (TMTOWTDI). Ruby, conversely, is a pure object-oriented language designed for programmer productivity and code readability, emphasizing the "Principle of Least Astonishment."

Key comparisons:

  • Object-Orientation: Ruby is purely object-oriented; every piece of data is an object. Perl supports object-oriented programming but is primarily procedural.
  • Syntax: Ruby features a clean, English-like syntax. Perl syntax is often considered cryptic due to its heavy use of sigils ($, @, %) and complex regular expression integration.
  • Consistency: Ruby provides a consistent API across its standard library, whereas Perl's library can be inconsistent due to its long history and evolution.

Advantages of Ruby include:

  • Pure Object-Orientation: Simplifies code maintenance and promotes modularity.
  • Readable Syntax: Reduces the learning curve and makes code easier to debug.
  • Metaprogramming: Ruby allows developers to write code that writes code, offering extreme flexibility.
  • Rich Ecosystem: The RubyGems package manager and the Rails framework provide extensive support for rapid web application development.
  • Block and Iterator Support: Ruby's elegant handling of blocks and iterators makes collection processing highly efficient and expressive.
b

What is a cookie? Write the code in Ruby to demonstrate handling of cookies.

7 marks

Answer

A cookie is a small piece of data stored by the web browser on the client's machine. It is used by web servers to maintain state information, such as user sessions, preferences, or tracking data, across multiple HTTP requests. Because HTTP is a stateless protocol, cookies provide a mechanism to "remember" information about the user.

In Ruby, particularly when using the CGI library, cookies can be handled as follows:

require 'cgi'

cgi = CGI.new

# Setting a cookie
cookie = CGI::Cookie.new('name' => 'user_session', 'value' => '12345', 'expires' => Time.now + 3600)
cgi.out('cookie' => cookie) { "Cookie has been set!" }

# Retrieving cookies
cookies = cgi.cookies
if cookies['user_session']
  puts "Session ID: " + cookies['user_session'].value.to_s
end
215 marks
a

What are web services and how do we use SOAP to implement web services in Ruby?

8 marks

Answer

Sign in to view the complete answer paper.

b

Describe different canvases available in Ruby-Tk.

7 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

How do we embed a ruby language interpreter in C program?

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain about Ruby type system.

8 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Write the syntax and explain the usage of different memory allocation functions available in Ruby.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain about global variables concept in Ruby with an example.

7 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

How do we create a list and tuple in Perl? Demonstrate with a suitable coding example.

8 marks

Answer

Sign in to view the complete answer paper.

b

Discuss about defining regular expressions in Perl with examples.

7 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Enumerate various usages of Scripting languages.

7 marks

Answer

Sign in to view the complete answer paper.

b

Discuss about different conditional and iterative statements available in Perl with their syntaxes.

8 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Explain about pack and unpack commands in Perl with examples.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write the steps for interfacing with operating system in Perl.

7 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Describe the control flow structures available in TCL.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain about event binding in Tk applications.

7 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of SCRIPTING LANGUAGES from JNTU for B.Tech CSE III II, August - 2022, R18.

For the solved question paper with answers, switch to the Answer Paper tab.

Other papers in SCRIPTING LANGUAGES

Loading Question Papers

Fetching data from database...