Top 50 Ruby Interview Questions with Answers

Ruby Interview Questions with Answers

1. What is Ruby?

a) A programming language
b) A web browser
c) A database management system
d) An operating system

Answer: a) A programming language

2. Which of the following is not a valid variable name in Ruby?

a) my_variable
b) my-variable
c) MyVariable
d) myVariable

Answer: b) my-variable

3. What is the difference between an instance variable and a class variable in Ruby?

a) An instance variable is shared by all instances of a class, while a class variable is unique to each instance.
b) An instance variable is unique to each instance of a class, while a class variable is shared by all instances of a class.
c) An instance variable is not used in Ruby programming, while a class variable is used to store class-level data.
d) There is no difference between an instance variable and a class variable in Ruby.

Answer: b) An instance variable is unique to each instance of a class, while a class variable is shared by all instances of a class.

4. What does the attr_accessor method do in Ruby?

a) Defines a new attribute for a class
b) Allows read and write access to an instance variable
c) Allows read-only access to an instance variable
d) Allows write-only access to an instance variable

Answer: b) Allows read and write access to an instance variable

5. In Ruby, what is the difference between ‘and’ and ‘&&’?

a) There is no difference
b) ‘and’ has higher precedence than ‘&&’
c) ‘&&’ has higher precedence than ‘and’
d) ‘and’ is used for logical OR operations, while ‘&&’ is used for logical AND operations

Answer: c) ‘&&’ has higher precedence than ‘and’

6. Which of the following is not a valid loop construct in Ruby?

a) for
b) while
c) until
d) if

Answer: d) if

7. What is the difference between puts and print in Ruby?

a) There is no difference
b) puts adds a line break after the output, while print does not
c) print adds a line break after the output, while puts does not
d) puts and print are not valid Ruby commands

Answer: b) puts adds a line break after the output, while print does not

8. Which of the following is not a valid method for an array in Ruby?

a) push
b) pop
c) remove
d) shift

Answer: c) remove

9. What is the result of 5.times { |i| puts i } in Ruby?

a) 0 1 2 3 4
b) 1 2 3 4 5
c) 0 2 4 6 8
d) Nothing is outputted

Answer: a) 0 1 2 3 4

11. What is the purpose of a block in Ruby?

a) To define a new class
b) To define a new method
c) To group statements and pass them to a method
d) To create a new object

Answer: c) To group statements and pass them to a method

12. What is the result of “hello”.reverse in Ruby?

a) “hello”
b) “loleh”
c) “olleh”
d) “e”

Answer: c) “olleh”

12. What does the following code do in Ruby?
array = [1,2,3]
array.map! { |x| x * 2 }

a) It creates a new array with each element multiplied by 2
b) It creates a new array with each element added by 2
c) It modifies the current array by multiplying each element by 2
d) It modifies the current array by adding 2 to each element

Answer: c) It modifies the current array by multiplying each element by 2

13. What does the ||= operator do in Ruby?

a) It assigns a value only if the current value is nil or false
b) It assigns a value regardless of the current value
c) It checks if two variables are equal
d) It performs a bit-wise OR operation

Answer: a) It assigns a value only if the current value is nil or false

14. What is the result of (1..5).to_a in Ruby?

a) [0, 1, 2, 3, 4, 5]
b) [1, 2, 3, 4, 5]
c) [1, 3, 5]
d) [0, 1, 2, 3, 4]

Answer: b) [1, 2, 3, 4, 5]

15. Which of the following is not a valid way to create a hash in Ruby?

a) { key1: value1, key2: value2 }
b) { “key1” => “value1”, “key2” => “value2” }
c) Hash.new(key: value)
d) { :key1 => “value1”, :key2 => “value2” }

Answer: c) Hash.new(key: value)

16. What is a module in Ruby?

a) A way to define a new class
b) A way to group related methods and constants
c) A way to define a new variable
d) A way to define a new block

Answer: b) A way to group related methods and constants

17. What is the result of [1,2,3].inject(:+) in Ruby?

a) 6
b) [1,2,3]
c) [1, 3, 6]
d) Nothing is outputted

Answer: a) 6

18. What is the purpose of the ‘self’ keyword in Ruby?

a) To define a new class
b) To define a new module
c) To refer to the current object
d) To refer to the parent object

Answer: c) To refer to the current object

19. What is the difference between ‘raise’ and ‘rescue’ in Ruby?

a) There is no difference
b) ‘raise’ is used to raise an exception, while ‘rescue’ is used to handle an exception
c) ‘rescue’ is used to raise an exception, while ‘raise’ is used to handle an exception
d) ‘raise’ and ‘rescue’ are not valid Ruby commands

Answer: b) ‘raise’ is used to raise an exception, while ‘rescue’ is used to handle an exception

20. What is a gem in Ruby?

a) A way to define a new class
b) A way to group related methods and constants
c) A way to define a new method
d) A way to package and distribute Ruby code

Answer: d) A way to package and distribute Ruby code

21. What is the result of 10.divmod(3) in Ruby?

a) 3
b) 1
c) [3, 1]
d) [1, 3]

Answer: c) [3, 1]

22. What is the difference between a lambda and a proc in Ruby?

a) There is no difference
b) A lambda checks the number of arguments passed, while a proc does not
c) A proc checks the number of arguments passed, while a lambda does not
d) A lambda can be called with or without arguments, while a proc must be called with arguments

Answer: b) A lambda checks the number of arguments passed, while a proc does not

23. What is the result of “hello”.gsub(‘l’, ‘b’) in Ruby?

a) “hello”
b) “hb”
c) “hebbo”
d) “helbo”

Answer: d) “helbo”

24. Which of the following is not a valid way to define a class in Ruby?

a) class MyClass; end
b) MyClass = class; end
c) class MyClass < ParentClass; end
d) class MyClass; def my_method; end; end

Answer: b) MyClass = class; end

25. What is the result of “hello world”.split in Ruby?

a) [“hello”, “world”]
b) “hello world”
c) “helloworld”
d) [“h”, “e”, “l”, “l”, “o”, ” “, “w”, “o”, “r”, “l”, “d”]

Answer: a) [“hello”, “world”]

26. What is the purpose of the return keyword in Ruby?

a) To define a new variable
b) To define a new method
c) To stop the execution of a method and return a value
d) To refer to the current object

Answer: c) To stop the execution of a method and return a value

27. What is the result of {‘a’ => 1, ‘b’ => 2}.invert in Ruby?

a) {‘1’ => ‘a’, ‘2’ => ‘b’}
b) {‘a’ => ‘1’, ‘b’ => ‘2’}
c) {1 => ‘a’, 2 => ‘b’}
d) {‘a’ => 2, ‘b’ => 1}

Answer: {1 => ‘a’, 2 => ‘b’}

28. What is the difference between ‘puts’ and ‘p’ in Ruby?

a) There is no difference
b) ‘p’ adds a line break after the output, while ‘puts’ does not
c) ‘puts’ adds a line break after the output, while ‘p’ does not
d) ‘puts’ prints the object and its type, while ‘p’ only prints the object

Answer: d) ‘puts’ prints the object and its type, while ‘p’ only prints the object

29. What is the result of [1,2,3].each { |x| puts x * 2 } in Ruby?

a) [2, 4, 6]
b) Nothing is outputted
c) 2 4 6
d) 1 2 3

Answer: b) Nothing is outputted

30. What is the result of ‘hello’.length in Ruby?

a) 4
b) 5
c) 6
d) 7

Answer: b) 5

31. Which of the following is not a valid way to create a range in Ruby?

a) 1..5
b) 1…5
c) (1, 5)
d) Range.new(1, 5)

Answer: c) (1, 5)

32. What is the purpose of the ‘unless’ keyword in Ruby?

a) To define a new variable
b) To define a new loop
c) To define a new method
d) To execute code only if a condition is false

Answer: d) To execute code only if a condition is false

33. What is the result of “hello”.upcase in Ruby?

a) “hello”
b) “HELLO”
c) “Hello”
d) “hello world”

Answer: b) “HELLO”

34. What is the difference between ‘include’ and ‘extend’ in Ruby?

a) There is no difference
b) ‘include’ adds methods as instance methods, while ‘extend’ adds methods as class methods
c) ‘extend’ adds methods as instance methods, while ‘include’ adds methods as class methods
d) ‘include’ and ‘extend’ are not valid Ruby commands

Answer: b) ‘include’ adds methods as instance methods, while ‘extend’ adds methods as class methods

35. What is the result of [1,2,3].reduce(:+) in Ruby?

a) 6
b) [1,2,3]
c) [1, 3, 6]
d) Nothing is outputted

Answer: a) 6

36. Which of the following is not a valid way to access a hash value in Ruby?

a) hash[key]
b) hash.fetch(key)
c) hash.get(key)
d) hash.values_at(key)

Answer: c) hash.get(key)

37. What is the result of “hello”.index(‘l’) in Ruby?

a) 0
b) 1
c) 2
d) 3

Answer: b) 1

38. What does the following code do in Ruby?

class MyClass
def initializer
puts “Hello, world!”
end
end

a) Defines a new method
b) Defines a new class
c) Prints “Hello, world!” to the console
d) There is a typo in the code and it will not run

Answer: b) Defines a new class

39. What is the purpose of the ‘nil’ keyword in Ruby?

a) To define a new variable
b) To indicate that a value is unknown or undefined
c) To stop the execution of a method and return a value
d) To refer to the current object

Answer: b) To indicate that a value is unknown or undefined

40. What is the result of ‘hello’.include?(‘lo’) in Ruby?

a) true
b) false
c) nil
d) There is a syntax error in the code

Answer: a) true

41. What is the difference between ‘next’ and ‘break’ in Ruby?

a) There is no difference
b) ‘next’ skips the current iteration of a loop, while ‘break’ stops the loop entirely
c) ‘break’ skips the current iteration of a loop, while ‘next’ stops the loop entirely
d) ‘next’ and ‘break’ are not valid Ruby commands

Answer: b) ‘next’ skips the current iteration of a loop, while ‘break’ stops the loop entirely

42. What is the result of “hello world”.capitalize in Ruby?

a) “hello world”
b) “Hello world”
c) “Hello World”
d) “hELLO WORLD”

Answer: b) “Hello world”

43. What is the purpose of the ‘super’ keyword in Ruby?

a) To refer to the current object
b) To call the parent method with the same name
c) To define a new class
d) To define a new module

Answer: b) To call the parent method with the same name

44. What is the result of “hello”.concat(” world”) in Ruby?

a) “hello world”
b) “helloworld”
c) “worldhello”
d) “hell worldo”

Answer: a) “hello world”

45. What is the difference between == and === in Ruby?

a) There is no difference
b) == is used for exact matches, while === is used for range comparisons
c) === is used for exact matches, while == is used for pattern matching
d) === is not a valid Ruby operator

Answer: c) === is used for exact matches, while == is used for pattern matching

46. What is the result of [1,2,3].select { |x| x % 2 == 0 } in Ruby?

a) [1]
b) [2]
c) [3]
d) [2,3]

Answer: b) [2]

47. What is the result of “hello”.delete(‘lo’) in Ruby?

a) “hello”
b) “heo”
c) “ho”
d) “el”

Answer: d) “el”

48. What is the result of (1..5).reduce(:*) in Ruby?

a) 120
b) [1,2,3,4,5]
c) [1,5,10,15,20,25]
d) Nothing is outputted

Answer: a) 120

49. What is the purpose of the ‘eval’ method in Ruby?

a) To define a new variable
b) To define a new method
c) To execute a string as Ruby code
d) To execute a file as Ruby code

Answer: c) To execute a string as Ruby code

50. What is the difference between ‘private’ and ‘protected’ in Ruby?

a) There is no difference
b) ‘private’ restricts access to a method to the current object, while ‘protected’ restricts access to a method to the current object and its subclasses
c) ‘protected’ restricts access to a method to the current object, while ‘private’ restricts access to a method to the current object and its subclasses
d) ‘private’ and ‘protected’ are not valid Ruby commands

Answer: b) ‘private’ restricts access to a method to the current object, while ‘protected’ restricts access to a method to the current object and its subclasses

Everything you need to know about Full Stack Developer

Introduction

The trade definition of a Full Stack Developer is an engineer who will work on totally different levels of an application stack. The term stack refers to the mixture of elements and tools that frame the appliance. the most objective of the full-stack engineer is to stay each part of the system running smoothly.

What is Full Stack Developer?

Full-stack web developers have the ability to design complete web applications and websites. They work on the frontend, backend, database, and debugging of web applications or websites.

Full Stack Developer is an engineer who works on each the client-side and server-side of the software system application. This kind of developer works on the complete Stack of a software system application meaning Front end development, Back end development, Database, Server, API, and version controlling systems. Hence, the name Full Stack Developer.

Why Do You Need a Full-Stack Developer?
Here are some reasons why you should need a full stack development professional:

  • A full-stack developer helps you to keep every part of the system running smoothly.
  • If one person plays different roles, it saves your company’s personnel, infrastructure, and operational cost.
  • Full-stack developers can provide help to everyone in the team and greatly reduce the time and technical costs of team communication.

A Full Stack Developer does:
As a full-stack developer, you may be involved in these activities:

Translate user requirements into the overall architecture and implementation of new systems. Manage Project and coordinate with the Client. Write backend code in Ruby, Python, Java, PHP languages, Writing optimized front-end code HTML and JavaScript, Understand, create and debug database-related queries. Create test code to validate the application against client requirements. Monitor the performance of web applications & infrastructure, Troubleshooting web applications with a fast and accurate resolution.

A Full Stack Developer must know at least a few of these languages for backend development:
PHP – One of the most popular choices for backend development, PHP is an open-source, cross-platform compatible language that can work seamlessly on Unix, macOS, and Windows.
Python – Python’s English-like syntax, smooth learning curve, and vast assortment of libraries and frameworks are what make it extremely popular among developers and coders around the world.
Ruby – Ruby is a robust programming language. An active community of developers backs it, but it also boasts of excellent documentation and dependencies, making it the ideal choice for backend development.
Java – Java is a multipurpose programming language. It can be used for web, desktop, and mobile application development. Plus, Java has a wide range of frameworks that further simplify the process of backend development.

Advantages of Full Stack Developer
The advantage of being a full stack web developer is:

  • You can master all the techniques involved in a development project.
  • You can make a prototype very rapidly.
  • You can provide help to all the team members.
  • You can reduce the cost of the project.
  • You can reduce the time used for team communication.
  • You can switch between front and back-end development based on requirements.
  • You can better understand all aspects of new and upcoming technologies.

What is the role of a full-stack developer?

Full-stack developers are computer programmers who are experts in front and back-end coding. Their primary role includes designing user interactions on websites, developing servers, and databases for website practicality, and coding for mobile platforms.

Full Stack Developer Skills You Need to Know:

HTML/CSS
Full Stack Developers need to work with HTML to define the structure of websites by using markup. they have to even be experts in CSS for effective presentation of the HTML components. Full Stack Developers should have intensive knowledge in each of those programming languages for making an interactive, intuitive, and interesting frontend for applications.

JavaScript
Full Stack Developers should have in-depth knowledge of JavaScript alongside its ideas and features like React and Angular. one in every of the most effective things concerning JavaScript is that it includes various useful features, as well as functions, prototypes, higher-order event delegation, and closure, that facilitate produce responsive websites.
It is also necessary for Full Stack Developers to upgrade their JavaScript knowledge as and once new frameworks, libraries, and tools are launched. excluding this, Full Stack Developers should know how to use DOM and JSON.

Git and GitHub
As for Full Stack Developers, git permits them to trace each minor modification done to the application codebase. They need to remember all the essential git commands and examples. Using git empowers Full Stack Developers to explore distinctive opportunities for security, productivity, and management knowledge of git permits Full Stack Developers to higher collaborate and collaborate with their fellow developers/programmers who are working on a similar project.

Backend languages
While we’ve covered the two most important frontend languages, HTML and CSS (along with JavaScript), the other crucial part of an application or software is that the backend. whereas backend development could be a whole totally different game, there are lots of programming languages to settle on from. Doing a full-stack internet development course can assist you to learn the specified languages necessary to become a full-stack developer.

Web architecture
Full Stack Developers need to recognize the core of the net design. Since their primary responsibility is to develop advanced software system applications from scratch, they need to know how to structure the code, categorize the files, structure the information in databases, and perform the required process tasks.

HTTP and REST
Both HTTP and REST serve two unique functions. HTTP is that the protocol used for facilitating communication with the consumer, whereas REST is an interface between systems using the HTTP protocol to assemble information or perform completely different operations (in varied formats) on the info. So, REST acts as sort of a translator between the frontend and also the backend.

Database storage
All web applications need a database where all the data will be stored. This is to ensure that developers can access the data later. Database storage calls for an experienced and skilled Full Stack Developer who knows relational databases and database storage inside-out. Full-stack developers must be adept in database management – they should be able to design, understand, and manipulate database queries. They must also know how to work with XML and JSON.

Basic design skills
As we’ve made it clear that a Full Stack Developer is concerned with frontend and backend, they must possess fundamental design skills. The knowledge of frontend design is crucial to make a website look attractive and appealing. A website with a neat and user-friendly design always wins the hearts of the users.
Thus, Full Stack Developers must know the basic design principles, including UI & UX design, prototypes, scalability, etc.

NPM
NPM is the package manager explicitly designed for Node.js. It aids in the installation of different packages. It also offers relevant solutions for various dependencies. NPM allows developers to place modules optimally to help the node to find them and manage the dependency conflicts accordingly. NPM is highly configurable, and thus, it can be used for many applications, including the development, publishing, discovery, and installation of node programs.

Soft skills
When you aspire to become a Full Stack Developer, technical skills solely won’t suffice. You must possess the perfect balance of technical knowledge and soft skills. Every Full Stack Developer must have the following soft skills:
1. An analytical bent of mind
2. Good time management skills
3. Curiosity for learning
4. Attention to detail
6. Creative vision
7. Patience

Full Stack Developer Responsibilities:

  • Developing front-end website architecture.
  • Designing user interactions on web pages.
  • Developing back-end website applications.
  • Creating servers and databases for functionality.
  • Ensuring cross-platform optimization for mobile phones.
  • Ensuring responsiveness of applications.
  • Working alongside graphic designers for web design features.
  • Seeing through a project from conception to finished product.
  • Designing and developing APIs.
  • Meeting both technical and consumer needs.
  • Staying abreast of developments in web applications and programming languages.

Trending Frameworks of Full Stack Developer:

ANGULAR
Angular is a front-end framework based on Javascript. It is developed and maintained by Google. Its objective is to simplify the development and testing of Single-page applications.

  • It provides a framework for MVC and MVVM architectures. It was developed to solve issues faced in single-page applications.
  • Angular is the front-end part of the MEAN stack. This framework adapts and extends HTML and its attributes. It follows the declarative programming paradigm. AngularJS has separate DOm manipulation and app logic.
  • Similarly, it has separate client-side and server-side codings. This improves the efficiency and reduces time. The development of the front-end and back-end can be done in parallel. Both sides can also be reused.
  • It is slow to render in since it checks all the variables under the scope for every cycle. It is also not very lightweight in terms of size compared to other frameworks.

METEOR
MeteorJS is a web framework written based on javascript. It is written using node.js. It is open-source and free. It can use its template engine Blaze or can be integrated with react and angular for client-end operations.

  • It automatically sends data to clients without expressly writing codes for it. This is possible using the publish-subscribe pattern. Initially released in 2011 as sky break, it was renamed Meteor.
  • Meteor has taken over multiple other technologies like FathomDB, Galaxy – a cloud-based hosting environment. They provide an integrated solution for these with Meteor. It can also be integrated with MongoDB, NPM, and other web development tools.
  • The integrated javascript stack ensures less coding and more features. It can be used for developing various platforms for the web, iOS, Android, and laptops. It is useful for building web chat platforms and interactive websites.

DJANGO
Django is an open-source web framework written in Python [Python programming is the most in-demand and a high-level coding language used in web development]. It has MTV architecture. It is developed and maintained by the Django software foundation. It simplifies the creation of complex websites which are data-driven.

  • It also consists of a lightweight web server, which can be used for development and testing.
  • It also has a template system, a caching framework, an internal dispatcher system, and an internalization and serialization system. It has a system to enhance the template engine as well. it also has an interface to the built-in unit test framework.
  • Django can be run with Apache, Nginx, Cherokee, etc. It also supports backends like Postgres, MySQL, SQLite, and Oracle.
  • Django is also bundled with other systems and frameworks that make it a complete package. These include an authentication system, a dynamic administrative system, tooling to generate Google sitemaps, and a framework to create GIS applications.

RAILS
Also known as Ruby on Rails, Rails is a back-end web app framework. It is based on the language Ruby. It has an MVC architecture. It additionally facilitates the usage of HTML, JS, and CSS to create a user interface. It emphasizes Convention over Configuration (CoC) and Doesn’t Repeat Yourself (DRY) patterns. It was initially released in 2005.

  • Rails brought about a defining change in features and innovation. It allowed easy migration and the creation of database tables. This led to fast application development. Rails support ‘less code and less repetition’.
  • Rails are not connected to the internet directly. It uses a front-end webserver to connect to the internet. It can be run with Nginx, Apache, and Cherokee, etc.
  • It has an in-built package manager RubyGems. It is mostly paired with a MySQL or Postgres database. It is good for building scalable web applications and websites. It has influenced many frameworks, some of which are also on this list.

NODE
Node.js is a powerful back-end framework based on javascript. It is built on the javascript V8 engine. It is open source and a very popular framework for server-side coding. It can be run in NodeJS runtime on Windows, Mac OS, and Linux. It is the back-end of the MEAN stack.

  • Node uses an event-driven, non-blocking I/O model. This makes the framework lightweight and efficient. It is highly scalable. It has an in-built default package manager called NPM. This reduces the time is taken and lines of code that need to be written.
  • It provides services to a much larger number of requests than traditional servers like Apache. These applications do not buffer any data and output data in chunks.
  • The knowledge of javascript is a prerequisite to learn and use NodeJS. Other technologies like HTML, CSS, AJAX are value-addition.

ANDROID SDK
Android SDK or the software development kit is a framework to develop an application for Android devices. It consists of libraries, application program interfaces, and sample codes along with a debugger.

  • SDK Android is compatible with other Operating Systems like Windows, Mac OS, and Linux. It is generally used to write programs by using an integrated development environment (IDE). Eclipse with an ADT plug-in is a popular choice.
  • It can also be coded in the command prompt. The IDEs graphical interface makes development easy and fast.
  • Java is the programming language used to write mobile applications. This requires Java Development Kit (JDK). The SDK also comes with an Android emulator. Android development is becoming easier gradually due to the continuous development of the SDK.

REACT
React is a front-end library used to create UI. It was developed by Facebook. It is based on Javascript and is used for handling the view layer for web applications. You need to be adept with Javascript, HTML, and CSS while working on React. React does not use HTML, but you still should learn it as it will help with JSX which is similar to it.

  • React is used to create reusable UI components, which are a great advantage. It reduces the time taken to code from scratch. It saves a lot of effort and resources.
  • The use of virtual DOM is the biggest advantage of React. Javascript virtual DOM is fast, and thus the performance is high. React can also be used on the server-side with node.
  • The components model of React ensures the readability of the code. This makes it easy for large apps to be built and modified.

SPRING
Spring is an application framework. It is written in Java. It is an inversion of the control container for the Java platform. It provides a consistent method of managing Java objects.

  • The framework does not impose any particular programming model. It is an open-source framework and is free. It is known as the framework of frameworks.
  • It has multiple frameworks like an MVC framework, remote access framework, data access frameworks, transaction management framework, etc. MVC or a model-view-controller framework is one of the most popular frameworks used for creating scalable projects.
  • Spring also has its own convention over configuration design paradigm solution for spring framework for rapid application development.
  • It is developed and maintained by Pivotal Software. You can also use spring to build applications on top of the Java enterprise edition platform.

SYMFONY
Symfony is a web development framework based on PHP. It is now developed and maintained by the Symfony community. It has a set of PHP libraries and reusable components.

  • It is free. It can operate cross-platform on Windows, Mac OS, and Linux. Symfony is used to build robust applications.
  • It gives full control of the configuration to developers. A lot of features can be customized. Symfony uses a bytecode cache, which improves its performance.
  • It replaces repetitive tasks. Symfony can be used to code efficiently and is fast to create and maintain a website. It has a set of in-built free components that can be used for other projects like templating engine, a parser, an event dispatcher, etc.
  • Additionally, it also uses PHP-based open-source projects like unit testing framework PHPUnit and templating engine twig and swift- the email library. It is heavily influenced by the spring framework.

Scope of Full Stack Developer:

These days, full-stack development is in huge demand. corporations wish full-stack developers as a result for a variety of reasons. Full-stack developers will work with a variety of technologies, and so, they’ll manage further aspects of a project than a median computer programmer.

They minimize prices for companies as a result of they’re going to do the work of the many specialists alone. A full-stack developer is familiar with several stacks, besides the MEAN stack and also the LAMP stack. Their huge knowledge of a variety of areas equips them to handle the distinctive requirements of their projects. Firms are prepared to pay good-looking salaries to full-stack developers as a result of their unique talent sets and abilities.

Conclusion

You will need to have seen however terrific the prospects are for full-stack developers. As companies are relying additional and additional on technology and therefore the internet, the demand for such specialists is rising. The entire stack developer’s future scope is doubtless sensible, and it’s an honest time for anybody to learn this ability.

To wanna know more about Full Stack Developer Please click.

Thank you!

Tagged : / / / /

How to verify of cobertura.jar file is loaded into jvm

scmuser created the topic: How to verify of cobertura.jar file is loaded into jvm

How to verify of cobertura.jar file is loaded into jvm? I have instrumented class but Automated test is not writing any thing in ser file? Any verification checklist?

rajeshkumar replied the topic: How to verify of cobertura.jar file is loaded into jvm

As far as i know, there is no password protection for OST file. Yes there is for .pst file.

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Could not find or load main class net.sourceforge.cobertura.instrument

scmuser replied the topic: Could not find or load main class net.sourceforge.cobertura.instrument

Still could not resolve the issues as below;

C:\Users\rkumar11>cd C:\cobertura
C:\cobertura>cobertura-check.bat
Error: Could not find or load main class net.sourceforge.cobertura.check.Main
C:\cobertura>cobertura-check.bat
Error: Could not find or load main class net.sourceforge.cobertura.check.Main
C:\cobertura>ls -1
11.txt
cobertura-2.0.3.jar
cobertura-report.sh
EnhancedFor.java
cobertura-check.bat
coberturaFlush.war
LICENSE.txt
cobertura-check.sh
datafile
PrimitiveParameters.java
cobertura-instrument.bat
examples
README. markdown
cobertura-instrument. sh
instrumented
basedir
cobertura-merge.bat
lib
cobertura-2.0.3-javadoc.jar
cobertura-merge.sh
cobertura-2.0.3-sources.jar
cobertura-report.bat

C:\cobertura>echo %JAVA_HOME%
C:\Tools\Java\jdk1.7.0_25
C:\cobertura>echo %JAVA_HOME%
C:\Tools\Java\jdk1.7.0_25
Tagged :

A simple Ruby method to send email

scmuser created the topic: A simple Ruby method to send email

A simple Ruby method to send email

require 'net/smtp'
 
def send_email(to,opts={})
  opts[:server]      ||= 'localhost'
  opts[:from]        ||= 'email@example.com'
  opts[:from_alias]  ||= 'Example Emailer'
  opts[:subject]     ||= "You need to see this"
  opts[:body]        ||= "Important stuff!"
 
  msg = <<END_OF_MESSAGE
From: #{opts[:from_alias]} <#{opts[:from]}>
To: <#{to}>
Subject: #{opts[:subject]}
 
#{opts[:body]}
END_OF_MESSAGE
 
  Net::SMTP.start(opts[:server]) do |smtp|
    smtp.send_message msg, opts[:from], to
  end
end

send_email “admnistrator@example.com”, :body => “This was easy to send”

Source – jerodsanto.net/2009/02/a-simple-ruby-method-to-send-email/

Tagged :

Add each array element to the lines of a file in ruby

scmuser created the topic: Add each array element to the lines of a file in ruby

Add each array element to the lines of a file in ruby

Either use Array#each to iterate over your array and call IO#puts to write each element to the file (puts adds a record separator, typically a newline character):

File.open("test.txt", "w+") do |f|
a.each { |element| f.puts(element) }
end

Or pass the whole array to puts:

File.open("test.txt", "w+") do |f|
f.puts(a)
end

Source –http://stackoverflow.com/questions/18900474/add-each-array-element-to-the-lines-of-a-file-in-ruby

Tagged :

What is the way to iterate through an array in Ruby?

scmuser created the topic: What is the way to iterate through an array in Ruby?

What is the way to iterate through an array in Ruby?

This will iterate through all the elements:

array = [1, 2, 3, 4, 5, 6]
array.each { |x| puts x }

Prints:
1
2
3
4
5
6

This will iterate through all the elements giving you the value and the index:

array = ["A", "B", "C"]
array.each_with_index {|val, index| puts "#{val} => #{index}" }

Prints:

A => 0
B => 1
C => 2

Source – stackoverflow.com/questions/310634/what-…ugh-an-array-in-ruby

Tagged :

Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

scmuser created the topic: Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

Create a Ruby Array

letters = Array.new
letters = []
letters = Array.new()
letters =
letters = Array.new(3) ( Define how many elements you array would be)
letters = Array.new(3, 'me rocks') (Define each element with default values)

Accessing Elements

letters[0] - accessing First element
letters[-1] - Accessing last element
letters[-2]

Inserting/Adding elements

letters = Array.new() OUTPUT = ["a", "b", "c"]
letters.insert(0, 1) OUTPUT [1, "a", "b", "c", "d"]
letters.insert(-1, 'd') OUTPUT [1, "a", "b", "c", "d"]
letters << 'e' OUTPUT [1, "a", "b", "c", "d", "e"]
letters.push('f') OUTPUT [1, "a", "b", "c", "d", "e", "f"]

Removing Elements

letters.pop - Remove the last elements
letters.delete_at(2) - Delete the element of particular index
Tagged :

Common ways to read a file in Ruby?

scmuser created the topic: Common ways to read a file in Ruby?

File.open("my/file/path", "r") do |f|
f.each_line do |line|
puts line
end
end
# File is closed automatically at end of block

It is also possible to explicitly close file after as above (pass a block to open closes it for you):

f = File.open("my/file/path", "r")
f.each_line do |line|
puts line
end
f.close

Source – stackoverflow.com/questions/5545068/what…-read-a-file-in-ruby

Tagged :

How to process every line in a text file with Ruby

scmuser created the topic: How to process every line in a text file with Ruby

Example 1

# ruby sample code.
# process every line in a text file with ruby (version 1).
file='GettysburgAddress.txt'
File.readlines(file).each do |line|
puts line
end

Example 2

# ruby sample code.
# process every line in a text file with ruby (version 2).
file='GettysburgAddress.txt'
f = File.open(file, "r")
f.each_line { |line|
puts line
}
f.close

Source –
alvinalexander.com/blog/post/ruby/how-pr…-line-text-file-ruby

Tagged :