Download Proglan Finals Set B 2nd Term SY 2013

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Join-pattern wikipedia , lookup

Logic programming wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Go (programming language) wikipedia , lookup

One-pass compiler wikipedia , lookup

Interpreter (computing) wikipedia , lookup

Compiler wikipedia , lookup

Programming language wikipedia , lookup

History of compiler construction wikipedia , lookup

Reactive programming wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Object-oriented programming wikipedia , lookup

Control flow wikipedia , lookup

Structured programming wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Functional programming wikipedia , lookup

Ruby (programming language) wikipedia , lookup

Transcript
Proglan Finals Set B
2nd Term SY 2013-14
Ronald L. Ramos
Name: Ana Michelle C. Pedro
Student Number: 11191805
Course: BS-IS
Answer the following questions as best as you can. Save the file as “Proglan Finals
2nd Term SY2013-14 – yourfullname.doc”
When done upload the document to your wikifolder and update your wiki page.
The following will merit an automatic zero in the exam:
1. Plagiarizing answers
2. Copying from a classmate/seatmate
3. Opening facebook or any form of social media
4. Talking to a classmate/seatmate during the exam
Open notes. Open Internet. Closed Social Media sites.
Goodluck and Godspeed!
HASKELL
Answer in 3 sentences or less (3 points each):
1. Define functional programming in your own words.
Functional programming is a style of programming which models computations
as the evaluation of expressions.
2.
What are the benefits of functional programming?
The biggest benefit of Functional programming is brevity, because code can
be more concise. A functional program doesn't create an iterator variable to be the
center of a loop, so this and other kinds of overhead are eliminated from your code.
The other major benefit is concurrency, which is easier to do with functional
programming because the compiler is taking care of most of the operations which
used to require manually setting up state variables (like the iterator in a loop).
(Source: http://stackoverflow.com/questions/128057/what-are-the-benefits-of-functionalprogramming)
3.
What is a monad in your own words?
4.
What are the differences between functional and imperative languages in
your own words?
5.
Define imperative programming in your own words.
Given this list:
list = [2,4,6,8,10]
Using an online Haskell compiler give the commands needed to do the following.
Take a screen shot of your running code and paste it as an answer to each question.
(5 points each):
1. Extract the first element of a list
2. Display the entire list
3. Display HOW MANY elements the list has
4. Reverse the order of elements
5. Display the minimum item in the list
Ruby
Using an online Ruby compiler write the code asked for in each situation. Take a
screen shot of your code and paste it as the answer (5 points each):
1.
2.
3.
4.
5.
6.
7.
8.
9.
Simple for loop using a range from 1 to 10
Display each item in the following list: [ 5, 12, 'cronuts', 18.45, ‘Voltron’,
‘Lego’ ] .
Go through the valid values of an array called listahan.
Define a Ruby function/method called cube that gives the cube value of a
number
Reverse the string “Lego” to “ogeL”
Print out the length of the string “Mississippi”
Concatenate two strings together
Print each letter from z to a
Print each number from 1 to 25
Answer in 2 sentences or less (3 points each):
1. What is Ruby on Rails?
Ruby on Rails, often simply Rails, is an open source web application framework
which runs on the Ruby programming language. It is a full-stack framework: it allows
creating pages and applications that gather information from the web server, talk to or
query the database, and render templates out of the box.
(Source: http://en.wikipedia.org/wiki/Ruby_on_Rails)
2.
Cite one characteristic of Ruby and explain that feature.
Ruby has exception handling feature. This feature can be used by the users to
easily handle errors in the codes that they encoded.
3.
Why did Matz create Ruby?
Matz blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and
Lisp) to form a new language that balanced functional programming with imperative
programming. He has often said that he is “trying to make Ruby natural, not simple,” in
a way that mirrors life.
(Source: https://www.ruby-lang.org/en/about/)
4.
Who is Matz (answers with “He created Ruby” will not be accepted)?
He was a self-taught programmer until the end of high school. He graduated
with an information science degree from University of Tsukuba, where he was a
member of Ikuo Nakata's research lab on programming languages and compilers.
(Source: http://en.wikipedia.org/wiki/Yukihiro_Matsumoto)
5.
Is Ruby and Ruby on Rails the same? Why or why not?
No, because Ruby is a Language while Ruby on Rails is a Framework that
utilizes Ruby.
Bonus (Optional – each answer must have a minimum of one paragraph with
at least 3 sentences per paragraph)
1. (5 points) Cite two characteristics of a good programming language and
explain each characteristic in your own words.

Portability
It is when the language allows the source code you’ve created
to be moved from one platform to another platforms without
making major changes. It is also when the language allows the
program you’re created run in different languages without
requiring major reworks.

Reusability
It is when the language allows the codes you’ve created be
used in other programming languages. Like in Java and C#,
most of the codes are alike so the codes that you’ve created in
C# might be reused in Java to create the same program with
just slight changes meaning the program could still be
improved or it could allow you to develop a new version of the
program.
2. (5 points) What 3 learnings will you take away from ProgLan.
I’ve learned about 3 new programming languages namely [1]Python,
[2]Haskell, and [3]Ruby which I can surely use in the future when I’ve
entered the corporate world. I could use it as an advantage from other
programmers.
/rlr12162013 AMDG.
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Winston Churchill