#top 30 perl interview questions
Explore tagged Tumblr posts
Link
Perl is an appropriate language for quick and fast processing methods compters , It runs on more than 100 stages with portable centralized system which means anyone can access the content by making any port sender to all.
1 note
·
View note
Text
EVERY FOUNDER SHOULD KNOW ABOUT PEOPLE
I can tell, the first is mistaken, the second outdated, and the content was irrelevant. I've written just for myself are no good. And even in those fields they depend heavily on startups for components and ideas. A round, before the VCs invest they make the company set aside a block of stock for future hires—usually between 10 and 30% of the company. Now even the poorest Americans drive cars, and it surfaces in situations like this. For example, I write essays the same way a textile manufacturer treats the patterns printed on its fabrics. The worst variant of this behavior is the tranched deal, where the investor makes a small initial investment, with more to follow if the startup tanks, so long as you keep morphing your idea.
Universities with x departments will subscribe to the journals. This may not be the best source of advice, because I have to read all the applications. Existing needs would probably get satisfied more efficiently by a network of startups than by a few giant, hierarchical organizations, but I haven't seen it. The experience of the SFP suggests that if you let motivated people do real work, they work hard, whatever their age. History suggests that, all other things often are not equal: the able person may not care about money, or may prefer the stability of a large public company makes about 100 times as much as submission. Retailers are less of a bottleneck as customers increasingly buy online. One of the most important factor in the success of any company. Whoever controls the device sets the terms. Students be forewarned: if you start a startup. Leave the people you'd spent your whole life with, to live in a giant city of three or four thousand complete strangers? What would you think of a time when employers would regard that as a mark against you, but you probably don't.
I know. Closer to fraudulent. Will Filters Kill Spam? If the company is their performance. I'm a writer, but most can upload a file. Another of our hypotheses was that you can get. Until you have some users to measure, the more wealth you generate. Whereas top management, like salespeople, have to actually come up with answers. We can find office space, thanks; just give us the money. The point of programming languages, is that there are huge variations in the rate at which wealth is created.
What's going on? He has ridden them both to downtown Mountain View to get coffee. And that's what you do or what I do is somewhere between a river and a roman road-builder. Thousands of people must have known about this problem. Are you crazy? Startups happened because technology started to change so fast that big companies do is boring, you're going to have to pay for the servers that the software runs on, and the number of people retain from childhood the idea that we ought to be the case in individuals. The groups then proceeded to give fabulously slick presentations.
If a round takes 2 months to close, and once founders realize that, it's going to stop. I'm not claiming the multiplier is precisely 36, but it was designed for its authors to use, and a significant percentage get rich, how would you do it by fixing the things in the language that required so much explanation. All you need is strong convictions. Don't realize what you're avoiding One reason people who've been out in the end, and now he's a professor at MIT. And how do you design a language that actually seems better than others that are available, there will be a proliferation of devices that have some kind of anomaly make this summer's applicants especially good? Northern Italy in 1100, off still feudal. We decide based on about 10 minutes of reading an application plus 10 minutes of in person interview, and we invest so early that investors sometimes need a lot of work, like acting or writing books, you can't start a startup like this than a recipe site? Which means things must have been to till the same fields your whole life with no hope of anything better, under the thumb of lords and priests you had to give all your surplus to and acknowledge as your masters.
If there had been one person with a brain on IBM's side, Microsoft's future would have been before English evolved enough to make it. Ignorance can't solve everything though. The essential task in a startup depends on the kind you want. And people with that attitude are the ones who are good at it, and that's why we even hear about new, indy languages like Perl and Python. She can't do it half-heartedly. Take away the incentive of wealth, because the company would go out of business, even if it's easy and you get paid a lot. Nearly all wanted advice about dealing with future investors: how much smarter are you than your job description expects you to be a nice way of saying what all founders hate to hear: I'll invest if other people will. Whereas designing programming languages is to prevent our poor frail human brains from being overwhelmed by a mass of detail. As you might expect, it winds all over the face of the earth. A viable startup might only have ten employees, which puts you within a factor of ten of measuring individual effort. Beeton's Book of Household Management 1880, it may not just be because they're academics, detached from the real world.
It was English. Some of the smartest people around you are out of their element. And the books we did these disgusting things to, like those we mishandled in high school, I find still have black marks against them in my mind. A McDonald's franchise is controlled by rules so precise that it is practically a piece of software, could write a whole new piece of software, could write a whole new piece of software, could write a whole new piece of software, could write a whole new piece of software, and none selling corn oil or laundry detergent? Three months' funding is enough to get into second gear. Indirectly, but they want to win. Talking to reporters makes her nervous. Ideas can morph.
If I were in college now I'd probably work on graphics: a network game, for example, grew big by designing a system, the McDonald's franchise, that could then be reproduced at will all over the country, students are writing not about how a baseball team with a small group. So I think efficiency will matter, at least in our tradition lawyers are advocates: they are trained to be able to enjoy them in peace. I think they fail because they select for the wrong people. But while you don't literally need math for most kinds of hacking, in the sense of knowing 1001 tricks for differentiating formulas, math is very much worth studying for its own sake. They seemed a little surprised at having total freedom. Someone who's not yet an adult will tend to respond to a challenge from an adult in a way that was entirely for the better. Why? And she wrote three separate essays about the question of female founders. And in desktop software there is a significant correlation. For most people, the most powerful tools you can find a good teacher. This is my excuse for not starting a startup molds you into someone to whom starting a startup and failed over someone who'd spent the same time working at a low intensity for forty years, you work as hard as you can. What a company does, and the only lasting benefits were a weird ability to identify semitic roots and some insights into how people recognize words.
Thanks to Paul Buchheit, and Jessica Livingston for putting up with me.
#automatically generated text#Markov chains#Paul Graham#Python#Patrick Mooney#device#ones#laundry#things#math#people#VCs#way#employers#funding#side#anything#earth#block
1 note
·
View note
Text
Fwd: Postdoc: UFlorida.LepidopteraGenomics
Begin forwarded message: > From: [email protected] > Subject: Postdoc: UFlorida.LepidopteraGenomics > Date: 28 February 2022 at 05:18:07 GMT > To: [email protected] > > > The Kawahara Lab at the University of Florida, Gainesville, USA, > is currently seeking a postdoctoral fellow to conduct evolutionary > genomics research on butterflies and moths (Lepidoptera). Specifically, > the candidate will assemble and annotate short and long-read genomes and > conduct comparative analyses of sensory gene-family evolution (vision, > auditory, olfaction, etc.). The project is for 2 years with additional > years possible depending on progress. > > Required: 1) A Ph.D. in genomics and or transcriptomics, 2) experience > with computer programming/scripting in Perl/Python/R etc., 3) familiarity > with high-performance clusters and bioinformatics pipelines, 4) strong > ability to write and communicate in English. An interest in insects is > desired, but not required. > > The successful candidate will work closely with students, postdocs, > and staff in the lab and lead projects on gene-family evolution in > butterflies and moths. Responsibilities include data analysis, student > training, and publishing papers. Position available immediately. The > Kawahara Lab welcomes all groups, regardless of racial or ethnic > background and encourages underrepresented groups to apply. The > Lab’s website (https://ift.tt/FxIn43X) > includes a working Code of Conduct document > (https://ift.tt/eniTa4d) > > Tentative timeline (may change): > April 1, 2022: Application deadline > April 4-April 8, 2022: Evaluation of applications > April 11-April 13, 2022: Short listed candidates will be contacted for > an interview > April 20-April 27: interviews > April 30: Deliberation and decision on top candidate > > Once a candidate has accepted the job offer, we will contact all > applicants to let them know about our decision. > > Salary: $52,000. > > To ensure full consideration please send a single pdf by April 1, > 2022, containing: 1) a cover letter (explaining your background and > fit for this position), CV, and list of 3 qualified references, to > Akito Kawahara at [email protected] with the email subject line: > Postdoc_KawaharaLab. Applications that do not follow this format may > not be considered. Any questions can be addressed to Akito Kawahara at > the email above. > > > > [email protected] > via IFTTT
0 notes
Text
300+ TOP MongoDB Interview Questions and Answers
MongoDB Interview Questions for freshers experienced :-
1. What is MongoDB? Mongo-DB is a document database which provides high performance, high availability and easy scalability. 2. Which are the different languages supported by MongoDB? MonggoDB provides official driver support for C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Scala, Go and Erlang. You can use MongoDB with any of the above languages. There are some other community supported drivers too but the above mentioned ones are officially provided by MongoDB. 3. What are the different types of NoSQL databases? Give some example. NoSQL database can be classified as 4 basic types: Key value store NoSQL database Document store NoSQL database Column store NoSQL database Graph base NoSQL databse There are many NoSQL databases. MongoDB, Cassandra, CouchBD, Hypertable, Redis, Riak, Neo4j, HBASE, Couchbase, MemcacheDB, Voldemort, RevenDB etc. are the examples of NoSQL databases. 4. Is MongoDB better than other SQL databases? If yes then how? MongoDB is better than other SQL databases because it allows a highly flexible and scalable document structure. For example: One data document in MongoDB can have five columns and the other one in the same collection can have ten columns. MongoDB database are faster than SQL databases due to efficient indexing and storage techniques. 5. What type of DBMS is MongoDB? MongoDB is a document oriented DBMS 6. What is the difference between MongoDB and MySQL? Although MongoDB and MySQL both are free and open source databases, there is a lot of difference between them in the term of data representation, relationship, transaction, querying data, schema design and definition, performance speed, normalization and many more. To compare MySQL with MongoDB is like a comparison between Relational and Non-relational databases. 7. Why MongoDB is known as best NoSQL database? MongoDb is the best NoSQL database because, it is: Document Oriented Rich Query language High Performance Highly Available Easily Scalable 8. Does MongoDB support primary-key, foreign-key relationship? No. By Default, MongoDB doesn't support primary key-foreign key relationship. 9. Can you achieve primary key - foreign key relationships in MongoDB? We can achieve primary key-foreign key relationship by embedding one document inside another. For example: An address document can be embedded inside customer document. 10. Does MongoDB need a lot of RAM? No. There is no need a lot of RAM to run MongoDB. It can be run even on a small amount of RAM because it dynamically allocates and de-allocates RAM according to the requirement of the processes.
MongoDB Interview Questions 11. Explain the structure of ObjectID in MongoDB. ObjectID is a 12-byte BSON type. These are: 4 bytes value representing seconds 3 byte machine identifier 2 byte process id 3 byte counter 12. Is it true that MongoDB uses BSON to represent document structure? Yes. 13. What are Indexes in MongoDB? In MondoDB, Indexes are used to execute query efficiently. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect. 14. By default, which index is created by MongoDB for every collection? By default, the_id collection is created for every collection by MongoDB. 15. What is a Namespace in MongoDB? Namespace is a concatenation of the database name and the collection name. Collection, in which MongoDB stores BSON objects. 16. Can journaling features be used to perform safe hot backups? Yes. 17. Why does Profiler use in MongoDB? MongoDB uses a database profiler to perform characteristics of each operation against the database. You can use a profiler to find queries and write operations 18. If you remove an object attribute, is it deleted from the database? Yes, it be. Remove the attribute and then re-save(. the object. 19. In which language MongoDB is written? MongoDB is written and implemented in C++. 20. Does MongoDB need a lot space of Random Access Memory (RAM)? No. MongoDB can be run on small free space of RAM. 21. What language you can use with MongoDB? MongoDB client drivers supports all the popular programming languages so there is no issue of language, you can use any language that you want. 22. Does MongoDB database have tables for storing records? No. Instead of tables, MongoDB uses "Collections" to store data. 23. Do the MongoDB databases have schema? Yes. MongoDB databases have dynamic schema. There is no need to define the structure to create collections. 24. What is the method to configure the cache size in MongoDB? MongoDB's cache is not configurable. Actually MongoDb uses all the free spaces on the system automatically by way of memory mapped files. 25. How to do Transaction/locking in MongoDB? MongoDB doesn't use traditional locking or complex transaction with Rollback. MongoDB is designed to be light weighted, fast and predictable to its performance. It keeps transaction support simple to enhance performance. 26. Why 32 bit version of MongoDB are not preferred ? Because MongoDB uses memory mapped files so when you run a 32-bit build of MongoDB, the total storage size of server is 2 GB. But when you run a 64-bit build of MongoDB, this provides virtually unlimited storage size. So 64-bit is preferred over 32-bit. 27. Is it possible to remove old files in the moveChunk directory? Yes, These files can be deleted once the operations are done because these files are made as backups during normal shard balancing operation. This is a manual cleanup process and necessary to free up space. 28. What will have to do if a shard is down or slow and you do a query? If a shard is down and you even do query then your query will be returned with an error unless you set a partial query option. But if a shard is slow them Mongos will wait for them till response. 29. Explain the covered query in MongoDB. A query is called covered query if satisfies the following two conditions: The fields used in the query are part of an index used in the query. The fields returned in the results are in the same index. 30. What is the importance of covered query? Covered query makes the execution of the query faster because indexes are stored in RAM or sequentially located on disk. It makes the execution of the query faster. Covered query makes the fields are covered in the index itself, MongoDB can match the query condition as well as return the result fields using the same index without looking inside the documents. 31. What is sharding in MongoDB? In MongoDB, Sharding is a procedure of storing data records across multiple machines. It is a MongoDB approach to meet the demands of data growth. It creates horizontal partition of data in a database or search engine. Each partition is referred as shard or database shard. 32. What is replica set in MongoDB? A replica can be specified as a group of mongo instances that host the same data set. In a replica set, one node is primary, and another is secondary. All data is replicated from primary to secondary nodes. 33. What is primary and secondary replica set in MongoDB? In MongoDB, primary nodes are the node that can accept write. These are also known as master nodes. The replication in MongoDB is single master so, only one node can accept write operations at a time. Secondary nodes are known as slave nodes. These are read only nodes that replicate from the primary. 34. By default, which replica sets are used to write data? By default, MongoDB writes data only to the primary replica set. 35. What is CRUD in MongoDB? MongoDB supports following CRUD operations: Create Read Update Delete 36. In which format MongoDB represents document structure? MongoDB uses BSON to represent document structures. 37. What will happen when you remove a document from database in MongoDB? Does MongoDB remove it from disk? Yes. If you remove a document from database, MongoDB will remove it from disk too. 38. Why are MongoDB data files large in size? MongoDB doesn't follow file system fragmentation and pre allocates data files to reserve space while setting up the server. That's why MongoDB data files are large in size. 39. What is a storage engine in MongoDB? A storage engine is the part of a database that is used to manage how data is stored on disk. For example: one storage engine might offer better performance for read-heavy workloads, and another might support a higher-throughput for write operations. 40. Which are the storage engines used by MongoDB? MMAPv1 and WiredTiger are two storage engine used by MongoDB. 41. What is the usage of profiler in MongoDB? A database profiler is used to collect data about MongoDB write operations, cursors, database commands on a running mongod instance. You can enable profiling on a per-database or per-instance basis. The database profiler writes all the data it collects to the system. profile collection, which is a capped collection. 42. Is it possible to configure the cache size for MMAPv1 in MongoDB? No. it is not possible to configure the cache size for MMAPv1 because MMAPv1 does not allow configuring the cache size. 43. How to configure the cache size for WiredTiger in MongoDB? For the WiredTiger storage engine, you can specify the maximum size of the cache that WiredTiger will use for all data. This can be done using storage.wiredTiger.engineConfig.cacheSizeGB option. 44. How does MongoDB provide concurrency? MongoDB uses reader-writer locks for concurrency. Reader-writer locks allow concurrent readers shared access to a resource, such as a database or collection, but give exclusive access to a single write operation. 45. What is the difference between MongoDB and Redis database? Difference between MongoDB and Redis: Redis is faster than MongoDB. Redis has a key-value storage whereas MongoDB has a document type storage. Redis is hard to code but MongoDB is easy. 46. What is the difference between MongoDB and CouchDB? Difference between MongoDB and CouchDB: MongoDB is faster than CouchDB while CouchDB is safer than MongoDB. Triggers are not available in MongoDB while triggers are available in CouchDB. MongoDB serializes JSON data to BSON while CouchDB doesn't store data in JSON format. 47. What is the difference between MongoDB and Cassandra? Difference between MongoDB and Cassandra: MongoDB is cross-platform document-oriented database system while Cassandra is high performance distributed database system. MongoDB is written in C++ while Cassandra is written in Java. MongoDB is easy to administer in the case of failure while Cassandra provides high availability with no single point of failure. 48. Is there any need to create database command in MongoDB? You don't need to create a database manually in MongoDB because it creates automaically when you save the value into the defined collection at first time. 49. What do you understand by NoSQL databases? Is MongoDB a NoSQL database? explain. At the present time, the internet is loaded with big data, big users, big complexity etc. and also becoming more complex day by day. NoSQL is answer of all these problems, It is not a traditional database management system, not even a relational database management system (RDBMS). NoSQL stands for "Not Only SQL". NoSQL is a type of database that can handle and sort all type of unstructured, messy and complicated data. It is just a new way to think about the database. Yes. MongoDB is a NoSQL database. MongoDB Questions and Answers Pdf Download Read the full article
0 notes
Text
Getting Started with JavaScript Backend Basics
JavaScript is included in the three major languages (HTML, CSS, and JavaScript) that a coder or programmer must learn. To start with, the browsers possess their own JavaScript Engine and it is responsible to support the JavaScript in order to make JavaScript work properly. Some of the JavaScript Engines that are used by most popular websites are Firefox: Spider Monkey, Safari: JavaScript Core, Chrome: V8, and Microsoft Edge/ Internet Explorer: Chakra.
JavaScript is a programming language that is not only limited to the web pages but it has extended and used by server programmers and desktops.
The backend is divided into three sections that are the application, database, and server. The backend developers are responsible for managing the back end of several applications as per the requirement. Backend developers are not just limited to learning the programming languages but they need to have knowledge about the server architecture.
Currently, website management has emerged as one of the most demanding career opportunities for which JavaScript stands as the major element. For getting employed in this field, you should go to JavaScript Interview Questions where you will get all the questions that are frequently asked in interviews.
Meaning of ECMA Script Standard
The ECMA Script Standard can be termed as a scripting language that is extensively used for trademarks. This scripting language has also been standardized and validated by the European Computer Manufacturers Association (ECMA). The major use of the ECMA script is to set a certain standard for the JavaScript language. This means, all the code written in JavaScript tends to follow the set standard to be supported on varied web browsers.
Definitions Kinds in JavaScript
There are several definitions types available in JavaScript such as:
Dynamic typing – this typing is dependent on several conditions.
Primitive Data Types- these types don’t have any method attached to them.
Conclusion
To sum it all, JavaScript is an essential programming language along with HTML and CSS. So opting for a career as an HTML developer is an option worth. If you are looking for the easy way to crack the HTML Interview, you can refer to Top 50 HTML Interview Questions to know about the frequently asked questions to a coder.
Source Url:-https://medium.com/@codingtag.com/getting-started-with-javascript-backend-basics-38cf3d107cc3
0 notes
Text
WHAT NO ONE UNDERSTANDS ABOUT OPINIONS
So any new protocol is a big part of what makes them good hackers: when something's broken, they need to fix it. 0 terms, Don't maltreat users is a subset of Don't be evil. Nor does it harm you in the real world, it's generally for some common purpose, and the VCs will try to undermine the super-angels have appeared. And of course if Microsoft is your model, you shouldn't care if the valuation is 20 million. And that's why smart people's lives are worst between, say, Altria is not. But the clearest message is that you need those people. It's like the word allopathic. But since then the west coast has just pulled further ahead.
Why would they go to extra trouble to get programmers into the US, towns have become startup hubs if and only if they attract those who have them. They can't pay as much for that. When you reach the top? DC and LA seem to send messages too, but I think a lot of that there. If your startup is connected to a specific industry, you may not finish your training till 30. From the Cliff's Notes, it turned out. They like cafes instead of clubs; used bookshops instead of fashionable clothing shops; hiking instead of dancing; sunlight instead of tall buildings. When you tread water, you lift yourself up by pushing water down. It's harder to say about other countries, because you couldn't reproduce it in most of the world, not fashions and parties.
After I made the list there turned out to be very hard. In software, paradoxical as it sounds, good craftsmanship means working fast. Where should one look for it? One ingredient of its meaning is certainly Ajax, which I took to refer to web-based applications. And when all the companies that won't use patents on startups are attacking innovation at the root. But in her case it goes beyond that. So what makes a place good to them? I think, is that they're the sort of thing was done at the time, but the whole program around it. It's interesting Our two junior team members were enthusiastic. We're not hearing about Perl and Python because people are using them to write Windows apps. They used drugs, at least unconsciously, is the problem so bad in most other fields. But there is no external opponent, so the variation we see is something that more and more varied experience a belief survived, the less likely it would be Fred.
The thing about languages, though, are busy. Seattle owes much of its position as a tech center to the same cause. Who's right? Asking whether you're default alive or default dead? The warped little world we lived in was as fake as a Twinkie. When I notice something surprising, it's usually very faint at first. 5% of the time we called retards. Or if they are, they are, because it's hard to imagine how that town felt about the Steelers. And then of course there's the question, how do you know when you meet one? You also can't tell from their resumes.
But if we're going to do that are not so much that it's critical to get your product to market early, but that a they aren't told about it, and that's why we even hear about new, indy languages like Perl and Python. Kids are sent off to spend six years memorizing meaningless facts in a world ruled by a caste of giants who run after an oblong brown ball, as if the active ingredient of Silicon Valley were the office space. Imagination is hard to appreciate is that it makes me slightly queasy. As with an actual gold mine, you still have to show up for work every day, they care more about what they have in common. Silicon Valley. Saying pleased to meet you, whether you are or not. The conference itself didn't seem very grassroots. In a typical American school, standards for coolness are so high or at least the average of the acquisition market—in which public companies do behave as pooled-risk company management companies existed, signing up with one would seem the ideal plan for most people, would be if you could get the right answers, at least, first-rate computer science departments.
And what's especially dangerous is that they have other things to think about. And most importantly, their status depends on how far along you are. And so American software and movies, and Japanese cars, all have this in common: the people in charge care about design—the Bay Area would be the ideal place—that it didn't predict anything. So I think VC funds are seriously threatened by the super-angels and VCs. We didn't even know at the time. And I have no idea that working in a cubicle feels to a hacker like having one's brain in a blender. Then you'd automatically get your share of the returns of the whole pool. The problem with most schools is, they have no purpose. The technology companies are right. All other things being equal, the more effort you'll have to switch to plan B if plan A isn't working. What the anti-immigration people say that instead of letting foreigners take these jobs, we should train more Americans to be programmers. Why did he?
What does it take to make a silicon valley becomes: who are the great hackers I know are gradually switching to Macs. But we were comparatively old when we started that our users were called direct marketers. And in fact it was the same at the schools I went to, the focus of rebellion was drug use, specifically marijuana. When I was in school, though that counted for something, but to most people at the time. During interviews, Robert and Trevor and I would pepper the applicants with technical questions. But the company may not be a coincidence. For them the right approach would be to design them so that the programmer could guess what library call would do the right thing. And they're justified in doing so with opinions about things that don't change much, like human nature. In travel books they show you mostly natural environments: the Grand Canyon, whitewater rafting, horses in a field, any weird idea or apparently irrelevant question that occurs to you is ipso facto worth exploring.
#automatically generated text#Markov chains#Paul Graham#Python#Patrick Mooney#programmers#Ajax#field#towns#countries#Canyon#idea#use#books#water#members#center#LA#Perl#plan#Silicon#allopathic#bookshops#program#Microsoft
0 notes
Text
300+ TOP RUBY Interview Questions and Answers
RUBY Interview Questions for freshers experienced :-
1. What is Ruby programming language? Ruby is a dynamic, reflective, general purpose, open source programming language that focuses on simplicity and productivity. Ruby has a mixed features of Perl, small talk, Eiffel, Ada and Lisp. Ruby was designed to create a new language which makes a balance with the functionality of Imperative languages. 2. Who is the developer of Ruby? Ruby is designed and developed by Yukihiro "martz" Matsumoto in mid 1990 in Japan. 3. Why Ruby is known as a language of flexibility? Ruby is known as a language of flexibility because it facilitates its author to alter the programming elements. Some specific parts of the language can be removed or redefined. Ruby does not restrict the user. For example, to add two numbers, Ruby allows to use + sign or the word 'plus'. This alteration can be done with Ruby's built-in class Numeric. 4. List some features of Ruby? Ruby has many features. Some of them are listed below. Object-oriented Flexible Dynamic typing and Duck typing Garbage collector Keyword arguments 5. Explain some differences between Ruby and Python. Similarities: High level language Support multiple platforms Use interactive prompt called irb Server side scripting language Differences: Ruby is fully object oriented while Python is not. Ruby supports EclipseIDE while Python supports multiple IDEs. Ruby use Mixins while Python doesn't. Ruby supports blocks, procs and lambdas while Python doesn't. 6. Write the command to get installed Ruby version in your system. ruby -v 7. What are class libraries in Ruby? Ruby class libraries contain variety of domain such as thread programming, data types, various domains. Following is a list of domains which has relevant class libraries: Text processing CGI Programming Network programming GUI programming XML programming 8. Name some operators used in Ruby. Operators are a symbol which is used to perform different operations. Unary operator Airthmetic operator Bitwise operator Logical operator Ternary operator 9. What is RubyGems in Ruby programming language? RubyGems provides a standard format for distributing ruby programs and libraries. It works as a package manager for the Ruby programming language. RubyGems is now a part of the standard library from Ruby version 1.9. 10. What are Ruby variables. Ruby variables hold data which can be used later in a program. Each variable act as a memory and shas a different name. There are four types of variables in Ruby: Local variable Class variable Instance variable Global variable
RUBY Interview Questions 11. What is the difference between nil and false in Ruby? nil false nil cannot be a value. false can be a value. nil is returned where there is no predicate. in case of a predicate, true or false is returned by a method. nil is not a boolean data type. false is a boolean data type. nil is an object of nilclass. false is an object of falseclass. 12. Explain Ruby data types. Ruby data types represent type of data such as text, string, numbers, etc. There are different data types in Ruby: Numbers Strings Symbols Hashes Arrays Booleans 13. What is the use of load and require in Ruby? In Ruby, load and require both are used for loading the available code into the current code. In cases where loading the code required every time when changed or every times someone hits the URL, it is suggested to use 'load'. It case of autoload, it is suggested to use 'require'. 14. Explain Ruby if-else statement. The Ruby if-else statement is used to test condition. There are various types of statement in Ruby. if statement if-else statement if-else-if (elsif. statement ternary statement 15. Explain case statement in Ruby. In Ruby, we use 'case' instead of 'switch' and 'when' instead of 'case'. The case statement matches one statement with multiple conditions just like a switch statement in other languages. 16. Explain for loop in Ruby. Ruby for loop iterates over a specific range of numbers. Hence, for loop is used if a program has fixed number of itrerations. Ruby for loop will execute once for each element in expression. 17. Explain while loop in Ruby. Ruby while loop is used to iterate a program several times. If the number of iterations is not fixed for a program, while loop is used. 18. Explain do while loop in Ruby. Ruby do while loop iterates a part of program several times. In this, loop will execute at least once because do while condition is written at the end. 19. Explain until loop in Ruby. Ruby until loop runs until the given condition evaluates to true. It exits the loop when condition becomes true. It is opposite of the while loop. 20. Explain break statement in Ruby. Ruby break statement is used to terminate a loop. It is mostly used in while loop where value is printed till the condition is true. 21. Explain next statement in Ruby. Ruby next statement is used to skip loop's next iteration. Once the next statement is executed, no further iteration will be performed. 22. Explain redo statement in Ruby. Ruby redo statement is used to repeat the current iteration of the loop. The redo statement is executed without evaluating loop's condition. 23. Explain retry statement in Ruby. Ruby retry statement is used to repeat the whole loop iteration from the start. 24. How will you comment in Ruby. Ruby comments are non-executable lines in a program. They do not take part in the execution of a program. Single line comment syntax: #This is single line comment. Multi line comment syntax: =begin This is multi line comment =end 25. Explain Ruby object. Object is the default root of all Ruby objects. Ruby objects inherit from BasicObject which allows creating alternate object hierarchies. 26. How to create Ruby object? Objects in Ruby are created by calling new method of the class. It is a unique type of method and predefined in Ruby library. Syntax: objectName=className.new 27. Explain Ruby class. Each Ruby class is an instance of Ruby class. Classes in Ruby are first class objects. It always starts with a keyword class followed by the class name. Syntax: class ClassName codes... end 28. Define Ruby methods. Ruby method prevent us from writing the same code in a program again and again. Ruby methods are similar to functions in other languages. 29. How to use Ruby methods. To use a Ruby method, we need to first define it. It is defined with def and end keyword. Method name should always start with a lowercase letter. Syntax: def methodName code... end 30. What are Ruby blocks. Ruby code blocks are called closures in other programming languages. It consist of a group of codes which is always enclosed with braces or written between do...end. 31. In how many ways a block is written in Ruby. A block is written in two ways: Multi-line between do and end Inline between braces {} Both are same and have the same functionality. syntax: block_name{ statement1 statement2 .......... } 32. What is yield statement in Ruby. The yield statement is used to call a block within a method with a value. 33. Explain ampersand parameter (&block. in Ruby) The &block is a way to pass a reference (instead of a local variable) to the block to a method. Here, block word after the & is just a name for the reference, any other name can be used instead of this. 34. Explain Ruby module. Ruby module is a collection of methods and constants. A module method may be instance method or module method. They are similar to classes as they hold a collection of methods, class definitions, constants and other modules. They are defined like classes. Objects or subclasses can not be created using modules. There is no module hierarchy of inheritance. Modules basically serve two purposes: They act as namespace. They prevent the name clashes. They allow the mixin facility to share functionality between classes. Syntax: module ModuleName statement1 statement2 ........... end Module name should start with a capital letter. 35. Explain module mixins in Ruby. Ruby doesn't support multiple inheritance. Modules eliminate the need of multiple inheritance using mixin in Ruby. A module doesn't have instances because it is not a class. However, a module can be included within a class. When you include a module within a class, the class will have access to the methods of the module. 36. Explain Ruby strings. Ruby string object holds and manipulates an arbitary sequence of bytes, typically representing characters. They are created using String::new or as literals. 37. How to access Ruby strings elements in an application. You can access Ruby string elements in different parts with the help of square brackets . Within square brackets write the index or string. 38. How to write multiline string in Ruby. Writing multiline string is very simple in Ruby language. We will show three ways to print multiline string. String can be written within double quotes. The % character is used and string is enclosed within / character. In heredoc syntax, we use Read the full article
0 notes
Text
300+ TOP PERL Interview Questions and Answers
Perl Interview Questions for freshers and experienced :-
1.How many type of variable in perl Perl has three built in variable types Scalar Array Hash 2.What is the different between array and hash in perl Array is an order list of values position by index. Hash is an unordered list of values position by keys. 3.What is the difference between a list and an array? A list is a fixed collection of scalars. An array is a variable that holds a variable collection of scalars. 4.what is the difference between use and require in perl Use : The method is used only for the modules(only to include .pm type file) The included objects are varified at the time of compilation. No Need to give file extension. Require: The method is used for both libraries and modules. The included objects are varified at the run time. Need to give file Extension. 5.How to Debug Perl Programs Start perl manually with the perl command and use the -d switch, followed by your script and any arguments you wish to pass to your script: "perl -d myscript.pl arg1 arg2" 6.What is a subroutine? A subroutine is like a function called upon to execute a task. subroutine is a reusable piece of code. 7.what does this mean '$^0'? tell briefly $^ - Holds the name of the default heading format for the default file handle. Normally, it is equal to the file handle's name with _TOP appended to it. 8.What is the difference between die and exit in perl? 1) die is used to throw an exception exit is used to exit the process. 2) die will set the error code based on $! or $? if the exception is uncaught. exit will set the error code based on its argument. 3) die outputs a message exit does not. 9.How to merge two array? @a=(1, 2, 3, 4); @b=(5, 6, 7, 8); @c=(@a, @b); print "@c"; 10.Adding and Removing Elements in Array Use the following functions to add/remove and elements: push(): adds an element to the end of an array. unshift(): adds an element to the beginning of an array. pop(): removes the last element of an array. shift() : removes the first element of an array.
PERL Interview Questions and Answers 11.How to get the hash size %ages = ('Martin' => 28, 'Sharon' => 35, 'Rikke' => 29); print "Hash size: ",scalar keys %ages,"n"; 12.Add & Remove Elements in Hashes %ages = ('Martin' => 28, 'Sharon' => 35, 'Rikke' => 29); # Add one more element in the hash $age{'John'} = 40; # Remove one element from the hash delete( $age{'Sharon'} ); 13.PERL Conditional Statements The conditional statements are if and unless 14.Perl supports four main loop types: While, for, until, foreach 15.There are three loop control keywords: next, last, and redo. The next keyword skips the remainder of the code block, forcing the loop to proceed to the next value in the loop. The last keyword ends the loop entirely, skipping the remaining statements in the code block, as well as dropping out of the loop. The redo keyword reexecutes the code block without reevaluating the conditional statement for the loop. 16.Renaming a file rename ("/usr/test/file1.txt", "/usr/test/file2.txt" ); 17.Deleting an existing file unlink ("/usr/test/file1.txt"); 18.Explain tell Function The first requirement is to find your position within a file, which you do using the tell function: tell FILEHANDLE tell 19.Perl Regular Expression A regular expression is a string of characters that define the pattern There are three regular expression operators within Perl Match Regular Expression - m// Substitute Regular Expression - s/// Transliterate Regular Expression - tr/// 20.What is the difference between chop & chomp functions in perl? chop is used remove last character, chomp function removes only line endings. 21.Email address validation – perl if ($email_address =~ /^(w¦-¦_¦.)+@((w¦-¦_)+.)+{2,}$/) { print "$email_address is valid"; } else { print "$email_address is invalid"; } 22.Why we use Perl? 1.Perl is a powerful free interpreter. 2.Perl is portable, flexible and easy to learn. 23. Given a file, count the word occurrence (case insensitive) open(FILE,"filename"); @array= ; $wor="word to be found"; $count=0; foreach $line (@array) { @arr=split (/s+/,$line); foreach $word (@arr) { if ($word =~ /s*$wors*/i) $count=$count+1; } } print "The word occurs $count times"; 24.Name all the prefix dereferencer in perl? The symbol that starts all scalar variables is called a prefix dereferencer. The different types of dereferencer are. (i) $-Scalar variables (ii) %-Hash variables (iii) @-arrays (iv) &-subroutines (v) Type globs-*myvar stands for @myvar, %myvar. What is the Use of Symbolic Reference in PERL? $name = "bam"; $$name = 1; # Sets $bam ${$name} = 2; # Sets $bam ${$name x 2} = 3; # Sets $bambam $name-> = 4; # Sets $bam symbolic reference means using a string as a reference. 25. What is the difference between for & foreach, exec & system? Both Perl's exec() function and system() function execute a system shell command. The big difference is that system() creates a fork process and waits to see if the command succeeds or fails - returning a value. exec() does not return anything, it simply executes the command. Neither of these commands should be used to capture the output of a system call. If your goal is to capture output, you should use the $result = system(PROGRAM); exec(PROGRAM); 26. What is the difference between for & foreach? Technically, there's no difference between for and foreach other than some style issues. One is an lias of another. You can do things like this foreach (my $i = 0; $i { # normally this is foreach print $i, "n"; } for my $i (0 .. 2) { # normally this is for print $i, "n";} 27. What is eval in perl? eval(EXPR) eval EXPR eval BLOCK EXPR is parsed and executed as if it were a little perl program. It is executed in the context of the current perl program, so that any variable settings, subroutine or format definitions remain afterwards. The value returned is the value of the last expression evaluated, just as with subroutines. If there is a syntax error or runtime error, or a die statement is executed, an undefined value is returned by eval, and $@ is set to the error message. If there was no error, $@ is guaranteed to be a null string. If EXPR is omitted, evaluates $_. The final semicolon, if any, may be omitted from the expression. 28. What's the difference between grep and map in Perl? grep returns those elements of the original list that match the expression, while map returns the result of the expression applied to each element of the original list. 29. How to Connect with SqlServer from perl and how to display database table info? there is a module in perl named DBI - Database independent interface which will be used to connect to any database by using same code. Along with DBI we should use database specific module here it is SQL server. for MSaccess it is DBD::ODBC, for MySQL it is DBD::mysql driver, for integrating oracle with perl use DBD::oracle driver is used. IIy for SQL server there are avilabale many custom defined ppm( perl package manager) like Win32::ODBC, mssql::oleDB etc.so, together with DBI, mssql::oleDB we can access SQL server database from perl. the commands to access database is same for any database. 30. Remove Duplicate Lines from a File use strict; use warnings; my @array=qw(one two three four five six one two six); print join(" ", uniq(@array)), "n"; sub uniq { my %seen = (); my @r = (); foreach my $a (@_) { unless ($seen{$a}) { push @r, $a; $seen{$a} = 1; } } return @r; } or my %unique = (); foreach my $item (@array) { $unique{$item} ++; } my @myuniquearray = keys %unique; print "@myuniquearray"; PERL Interview Questions with Answers 1. How do you know the reference of a variable whether it is a reference, scaler, hash or array? There is a ‘ref’ function that lets you know 2. What is the difference between ‘use’ and ‘require’ function? Use: 1. the method is used only for modules (only to include .pm type file) 2. the included object are verified at the time of compilation. 3. No Need to give file extension. Require: 1. The method is used for both libraries (package) and modules 2. The include objects are verified at the run time. 3. Need to give file Extension. 3. What is the use of ‘chomp’ ? what is the difference between ‘chomp’ and ‘chop’? ‘chop’ function only removes the last character completely ‘from the scalar, where as ‘chomp’ function only removes the last character if it is a newline. by default, chomp only removes what is currently defined as the $INPUT_RECORD_SEPARATOR. whenever you call ‘chomp ‘, it checks the value of a special variable ‘$/’. whatever the value of ‘$/’ is eliminated from the scaler. by default the value of ‘$/’ is ‘n’ 4. Print this array @arr in reversed case-insensitive order @solution = sort {lc $a comp lc$b } @arr. 5. What is ‘->’ in Perl? It is a symbolic link to link one file name to a new name. So let’s say we do it like file1-> file2, if we read file1, we end up reading file2. 6. How do you check the return code of system call? System calls “traditionally” returns 9 when successful and 1 when it fails. System (cmd) or die “Error in command”. 7. Create directory if not there Ans: if (! -s “$temp/engl_2/wf”){ System “mkdir -p $temp/engl_2/wf”; } if (! -s “$temp/backup_basedir”) { system “mkdir -p $temp/backup_basedir”; } 8. What is the use of -M and -s in the above script? Ans: -s means is filename a non-empty file -M how long since filename modified 9. How to substitute a particular string in a file containing million of record? perl -p -i.bak -e ‘s/search_str/replace_str/g’ filename 10. I have a variable named $objref which is defined in main package. I want to make it as a Object of class XYZ. How could I do it? use XYZ my $objref =XYZ -> new() OR, bless $objref, ‘XYZ’; 11. What is meant by a ‘pack’ in perl? Pack converts a list into a binary representation. Takes an array or list of values and packs it into a binary structure, returning the string containing the structure it takes a LIST of values and converts it into a string. The string contains a con-catenation of the converted values. Typically, each converted values looks like its machine-level representation. For example, on 32-bit machines a converted integer may be represented by a sequence of 4 bytes. 12. How to implement stack in Perl? Through push() and shift() function. push adds the element at the last of array and shift() removes from the beginning of an array. 13. What is Grep used for in Perl? Grep is used with regular expression to check if a particular value exists in an array. It returns 0 it the value does not exists, 1 otherwise. 14. How to code in Perl to implement the tail function in UNIX? You have to maintain a structure to store the line number and the size of the file at that time e.g. 1-10 bytes, 2-18 bytes.. You have a counter to increase the number of lines to find out the number of lines in the file. once you are through the file, you will know the size of the file at any nth line, use ‘sysseek’ to move the file pointer back to that position (last 10) and then tart reading till the end. 15. Explain the difference between ‘my’ and ‘local’ variable scope declarations? Both of them are used to declare local variables. The variables declared with ‘my’ can live only within the block and cannot gets its visibility inherited functions called within that block, but one defined as ‘local’ can live within the block and have its visibility in the functions called within that block. 16. How do you navigate through an XML documents? You can use the XML::DOM navigation methods to navigate through an XML::DOM node tree and use the get node value to recover the data. DOM Parser is used when it is need to do node operation. Instead we may use SAX parser if you require simple processing of the xml structure. 17. How to delete an entire directory containing few files in the directory? rmtree($dir); OR, you can use CPAN module File::Remove Though it sounds like deleting file but it can be used also for deleting directories. &File::Removes::remove (1,$feed-dir,$item_dir); 18. What are the arguments we normally use for Perl Interpreter -e for Execute -c to compile -d to call the debugger on the file specified -T for traint mode for security/input checking -W for show all warning mode (or -w to show less warning) 19. What is it meant by ‘$_’? It is a default variable which holds automatically, a list of arguments passed to the subroutine within parentheses. 20. How to connect to sql server through Perl? We use the DBI(Database Independent Interface) module to connect to any database. use DBI; $dh = DBI->connect(“dbi:mysql:database=DBname”,”username”,”password”); $sth = $dh->prepare(“select name, symbol from table”); $sth->execute(); while(@row = $sth->fetchrow_array()){ print “name =$row.symbol= $row; } $dh->disconnect 21. What is the purpose of -w, strict and -T? -w option enables warning – strict pragma is used when you should declare variables before their use -T is taint mode. TAint mode makes a program more secure by keeping track of arguments which are passed from external source. 22. What is the difference between die and exit? Die prints out STDERR message in the terminal before exiting the program while exit just terminate the program without giving any message. Die also can evaluate expressions before exiting. 23. Where do you go for perl help? perldoc command with -f option is the best. I also go to search.cpan.org for help. 24. What is the Tk module? It provides a GUI interface 25. What is your favourite module in Perl? CGI and DBI. CGI (Common Gateway Interface) because we do not need to worry about the subtle features of form processing. 26. What is hash in perl? A hash is like an associative array, in that it is a collection of scalar data, with individual elements selected by some index value which essentially are scalars and called as keys. Each key corresponds to some value. Hashes are represented by % followed by some name. 27. What does ‘qw()’ mean? what’s the use of it? qw is a construct which quotes words delimited by spaces. use it when you have long list of words that are into quoted or you just do not want to type those quotes as you type out a list of space delimited words. Like @a = qw(1234) which is like @a=(“1?,”2?,”3?,”4?); 28. What is the difference between Perl and shell script? Whatever you can do in shell script can be done in Perl. However Perl gives you an extended advantage of having enormous library. You do not need to write everything from scartch. 29. What is stderr() in perl? Special file handler to standard error in any package. 30. What is a regular expression? It defines a pattern for a search to match. 31. What is the difference between for and foreach? Functionally, there is no difference between them. 32. What is the difference between exec and system? exec runs the given process, switches to its name and never returns while system forks off the given process, waits for its to complete and then return. 33. What is CPAN? CPAN is comprehensive Perl Archive Network. It’s a repository contains thousands of Perl Modules, source and documentation, and all under GNU/GPL or similar license. You can go to www.cpan.org for more details. Some Linux distribution provides a till names ‘cpan; which you can install packages directly from cpan. 34. What does this symbol mean ‘->’? In Perl it is an infix dereference operator. For array subscript, or a hash key, or a subroutine, then its must be a reference. Can be used as method invocation. 35. What is a DataHash() In Win32::ODBC, DataHash() function is used to get the data fetched through the sql statement in a hash format. 36. What is the difference between C and Perl? make up 37. Perl regular exp are greedy. what is it mean by that? It tries to match the longest string possible. 38. What does the world ‘&my variable’ mean? &myvariable is calling a sub-routine. & is used to indentify a subroutine. 39. What is it meant by @ISA, @EXPORT, @EXPORT_OK? @ISA -> each package has its own @ISA array. This array keeps track of classes it is inheriting. Ex: package child; @ISA=(parent class); @EXPORT this array stores the subroutines to be exported from a module. @EXPORT_OK this array stores the subroutines to be exported only on request. 40. What package you use to create windows services? use Win32::OLE. 41. How to start Perl in interactive mode? perl -e -d 1 PerlConsole. 42. How do I set environment variables in Perl programs? You can just do something like this: $ENV{‘PATH’} = ‘…’; As you may remember, “%ENV” is a special hash in Perl that contains the value of all your environment variables. Because %ENV is a hash, you can set environment variables just as you’d set the value of any Perl hash variable. Here’s how you can set your PATH variable to make sure the following four directories are in your path:: $ENV{‘PATH’} = ‘/bin:/usr/bin:/usr/local/bin:/home/your name/bin’. 43. What is the difference between C++ and Perl? Perl can have objects whose data cannot be accessed outside its class, but C++ cannot. Perl can use closures with unreachable private data as objects, and C++ doesn’t support closures. Furthermore, C++ does support pointer arithmetic via `int *ip =(int*)&object’, allowing you do look all over the object. Perl doesn’t have pointer arithmetic. It also doesn’t allow `#define private public’ to change access rights to foreign objects. On the other hand, once you start poking around in /dev/mem, no one is safe. 44. How to open and read data files with Perl? Data files are opened in Perl using the open() function. When you open a data file, all you have to do is specify (a) a file handle and (b) the name of the file you want to read from. As an example, suppose you need to read some data from a file named “checkbook.txt”. Here’s a simple open statement that opens the checkbook file for read access: open (CHECKBOOK, “checkbook.txt”);' In this example, the name “CHECKBOOK” is the file handle that you’ll use later when reading from the checkbook.txt data file. Any time you want to read data from the checkbook file, just use the file handle named “CHECKBOOK”. Now that we’ve opened the checkbook file, we’d like to be able to read what’s in it. Here’s how to read one line of data from the checkbook file: $record = ; After this statement is executed, the variable $record contains the contents of the first line of the checkbook file. The “” symbol is called the line reading operator. To print every record of information from the checkbook file open (CHECKBOOK, “checkbook.txt”) || die “couldn’t open the file!”; while ($record = ) { print $record; } close(CHECKBOOK); 45. How do i do fill_in_the_blank for each file in a directory? #!/usr/bin/perl –w opendir(DIR, “.”); @files = readdir(DIR); closedir(DIR); foreach $file (@files) { print “$filen”; } 46. How do I generate a list of all .html files in a directory Here is a snippet of code that just prints a listing of every file in teh current directory. That ends with the entension #!/usr/bin/perl –w opendir(DIR, “.”); @files = grep(/.html$/, readdir(DIR)); closedir(DIR); foreach $file (@files) { print “$filen”; } 47. What is Perl one-liner? There are two ways a Perl script can be run: –from a command line, called oneliner, that means you type and execute immediately on the command line. You’ll need the -e option to start like “C: %gt perl -e “print ”Hello”;”. One-liner doesn’t mean one Perl statement. One-liner may contain many statements in one line. –from a script file, called Perl program. 48. Assume both a local($var) and a my($var) exist, what’s the difference between ${var} and ${“var”}? ${var} is the lexical variable $var, and ${“var”} is the dynamic variable $var. Note that because the second is a symbol table lookup, it is disallowed under `use strict “refs”‘. The words global, local, package, symbol table, and dynamic all refer to the kind of variables that local() affects, whereas the other sort, those governed by my(), are variously knows as private, lexical, or scoped variable. 49. What happens when you return a reference to a private variable? Perl keeps track of your variables, whether dynamic or otherwise, and doesn’t free things before you’re done using them 50. What are scalar data and scalar variables? Perl has a flexible concept of data types. Scalar means a single thing, like a number or string. So the Java concept of int, float, double and string equals to Perl’s scalar in concept and the numbers and strings are exchangeable. Scalar variable is a Perl variable that is used to store scalar data. It uses a dollar sign $ and followed by one or more alphanumeric characters or underscores. It is case sensitive. 51. Assuming $_ contains HTML, which of the following substitutions will remove all tags in it? You can’t do that. If it weren’t for HTML comments, improperly formatted HTML, and tags with interesting data like , you could do this. Alas, you cannot. It takes a lot more smarts, and quite frankly, a real parser. 52. What is the output of the following Perl program? $p1 = “prog1.java”; $p1 =~ s/(.*).java/$1.cpp/; print “$p1n”; prog1.cpp 53. Why aren’t Perl’s patterns regular expressions? Because Perl patterns has backreferences. A regular expression by definition must be able to determine the next state in the finite automaton without requiring any extra memory to keep around previous state. A pattern /(+)c1/ requires the state machine to remember old states, and thus disqualifies such patterns as being regular expressions in the classic sense of the term. 54. What does Perl do if you try to exploit the execve(2) race involving setuid scripts? Sends mail to root and exits. It has been said that all programs advance to the point of being able to automatically read mail. While not quite at that point (well, without having a module loaded), Perl does at least automatically send it. 55. How do I do for each element in a hash? Here’s a simple technique to process each element in a hash: #!/usr/bin/perl -w %days = ( ‘Sun’ =>’Sunday’, ‘Mon’ => ‘Monday’, ‘Tue’ => ‘Tuesday’, ‘Wed’ => ‘Wednesday’, ‘Thu’ => ‘Thursday’, ‘Fri’ => ‘Friday’, ‘Sat’ => ‘Saturday’ ); foreach $key (sort keys %days) { print “The long name for $key is $days{$key}.n”; } 56. How do I sort a hash by the hash key? Ans:. Suppose we have a class of five students. Their names are kim, al, rocky, chrisy, and jane. Here’s a test program that prints the contents of the grades hash, sorted by student name: #!/usr/bin/perl –w %grades = ( kim => 96, al => 63, rocky => 87, chrisy => 96, jane => 79, ); print “ntGRADES SORTED BY STUDENT NAME:n”; foreach $key (sort (keys(%grades))) { print “tt$key tt$grades{$key}n”; } The output of this program looks like this: GRADES SORTED BY STUDENT NAME: al 63 chrisy 96 jane 79 kim 96 rocky 87 57. How do you print out the next line from a filehandle with all its bytes reversed? print scalar reverse scalar surprisingly enough, you have to put both the reverse and the in to scalar context separately for this to work. 58. How do I send e-mail from a Perl/CGI program on a Unix system? Sending e-mail from a Perl/CGI program on a Unix computer system is usually pretty simple. Most Perl programs directly invoke the Unix sendmail program. We’ll go through a quick example here. Assuming that you’ve already have e-mail information you need, such as the send-to address and subject, you can use these next steps to generate and send the e-mail message: # the rest of your program is up here … open(MAIL, “|/usr/lib/sendmail -t”); print MAIL “To: $sendToAddressn”; print MAIL “From: $myEmailAddressn”; print MAIL “Subject: $subjectn”; print MAIL “This is the message body.n”; print MAIL “Put your message here in the body.n”; close (MAIL); 59. How to read from a pipeline with Perl? To run the date command from a Perl program, and read the output of the command, all you need are a few lines of code like this: open(DATE, “date|”); $theDate = ; close(DATE); The open() function runs the external date command, then opens a file handle DATE to the output of the date command. Next, the output of the date command is read into the variable $theDate through the file handle DATE. Example 2: The following code runs the “ps -f” command, and reads the output: open(PS_F, “ps -f|”); while (){ ($uid,$pid,$ppid,$restOfLine) = split; # do whatever I want with the variables here … } close(PS_F); 60. Why is it hard to call this function: sub y { “because” } Ans. Because y is a kind of quoting operator. The y/// operator is the sed-savvy synonym for tr///. That means y(3) would be like tr(), which would be looking for a second string, as in tr/a-z/A-Z/, tr(a-z)(A-Z), or tr. 61. Why does Perl not have overloaded functions? Because you can inspect the argument count, return context, and object types all by yourself. In Perl, the number of arguments is trivially available to a function via the scalar sense of @_, the return context via wantarray(), and the types of the arguments via ref() if they’re references and simple pattern matching like /^d+$/ otherwise. In languages like C++ where you can’t do this, you simply must resort to overloading of functions. 62. What does read() return at end of file? 0. A defined (but false) 0 value is the proper indication of the end of file for read() and sysread(). 63. How do I sort a hash by the hash value? Here’s a program that prints the contents of the grades hash, sorted numerically by the hash value: #!/usr/bin/perl –w # Help sort a hash by the hash ‘value’, not the ‘key’. To highest). # sub hashValueAscendingNum { $grades{$a} $grades{$b}; } # Help sort a hash by the hash ‘value’, not the ‘key’. # Values are returned in descending numeric order # (highest to lowest). sub hashValueDescendingNum { $grades{$b} $grades{$a}; } %grades = ( student1 => 90, student2 => 75, student3 => 96, student4 => 55, student5 => 76 ); print “ntGRADES IN ASCENDING NUMERIC ORDER:n”; foreach $key (sort hashValueAscendingNum (keys(%grades))) { print “tt$grades{$key} tt $keyn”; } print “ntGRADES IN DESCENDING NUMERIC ORDER:n”; foreach $key (sort hashValueDescendingNum (keys(%grades))) { print “tt$grades{$key} tt $keyn”; } 64. How do find the length of an array? scalar @array 65. What value is returned by a lone `return;’ statement? The undefined value in scalar context, and the empty list value () in list context. This way functions that wish to return failure can just use a simple return without worrying about the context in which they were called. 66. What’s the difference between /^Foo/s and /^Foo/? The second would match Foo other than at the start of the record if $* were set. The deprecated $* flag does double duty, filling the roles of both /s and /m. By using /s, you suppress any settings of that spooky variable, and force your carets and dollars to match only at the ends of the string and not at ends of line as well — just as they would if $* weren’t set at all. 67. Does Perl have reference type? Yes. Perl can make a scalar or hash type reference by using backslash operator. For example $str = “here we go”; # a scalar variable $strref = $str; # a reference to a scalar @array = (1..10); # an array $arrayref = @array; # a reference to an array Note that the reference itself is a scalar. 68. How to dereference a reference? There are a number of ways to dereference a reference. Using two dollar signs to dereference a scalar. $original = $$strref; Using @ sign to dereference an array. @list = @$arrayref; Similar for hashes. 69. How do I do for each element in an array? #!/usr/bin/perl –w @homeRunHitters = (‘McGwire’, ‘Sosa’, ‘Maris’, ‘Ruth’); Foreach (@homeRunHitters) { print “$_ hit a lot of home runs in one yearn”; } 70. How do I replace every character in a file with a comma? perl -pi.bak -e ‘s/t/,/g’ myfile.txt 71. What is the easiest way to download the contents of a URL with Perl? Once you have the libwww-perl library, LWP.pm installed, the code is this: #!/usr/bin/perl use LWP::Simple; $url = get ‘http://www.websitename.com/’; 72. How to concatenate strings in Perl? Through . operator. 73. How do I read command-line arguments with Perl? With Perl, command-line arguments are stored in the array named @ARGV. $ARGV contains the first argument, $ARGV contains the second argument, etc. $#ARGV is the subscript of the last element of the @ARGV array, so the number of arguments on the command line is $#ARGV + 1. Here’s a simple program: #!/usr/bin/perl $numArgs = $#ARGV + 1; print “thanks, you gave me $numArgs command-line arguments.n”; foreach $argnum (0 .. $#ARGV) { print “$ARGVn”; } 74. Assume that $ref refers to a scalar, an array, a hash or to some nested data structure. Explain the following statements: $$ref; # returns a scalar $$ref; # returns the first element of that array $ref- > ; # returns the first element of that array @$ref; # returns the contents of that array, or number of elements, in scalar context $&$ref; # returns the last index in that array $ref- > ; # returns the sixth element in the first row @{$ref- > {key}} # returns the contents of the array that is the value of the key “key” 75. Perl uses single or double quotes to surround a zero or more characters. Are the single(‘ ‘) or double quotes (” “) identical? They are not identical. There are several differences between using single quotes and double quotes for strings. 1. The double-quoted string will perform variable interpolation on its contents. That is, any variable references inside the quotes will be replaced by the actual values. 2. The single-quoted string will print just like it is. It doesn’t care the dollar signs. 3. The double-quoted string can contain the escape characters like newline, tab, carraige return, etc. 4. The single-quoted string can contain the escape sequences, like single quote, backward slash, etc. 76. How many ways can we express string in Perl? Many. For example ‘this is a string’ can be expressed in: “this is a string” qq/this is a string like double-quoted string/ qq^this is a string like double-quoted string^ q/this is a string/ q&this is a string& q(this is a string) 77. How do you give functions private variables that retain their values between calls? Create a scope surrounding that sub that contains lexicals. Only lexical variables are truly private, and they will persist even when their block exits if something still cares about them. Thus: { my $i = 0; sub next_i { $i++ } sub last_i { –$i } } creates two functions that share a private variable. The $i variable will not be deallocated when its block goes away because next_i and last_i need to be able to access it. 78. Explain the difference between the following in Perl: $array vs. $array-> Because Perl’s basic data structure is all flat, references are the only way to build complex structures, which means references can be used in very tricky ways. This question is easy, though. In $array, “array” is the (symbolic) name of an array (@array) and $array refers to the 4th element of this named array. In $array->, “array” is a hard reference to a (possibly anonymous) array, i.e., $array is the reference to this array, so $array-> is the 4th element of this array being referenced. 79. How to remove duplicates from an array? There is one simple and elegant solution for removing duplicates from a list in PERL @array = (2,4,3,3,4,6,2); my %seen = (); my @unique = grep { ! $seen{ $_ }++ } @array; print “@unique”; PERL Questions and Answers pdf Download Read the full article
0 notes
Text
300+ TOP MAPREDUCE Interview Questions and Answers
MAPREDUCE Interview Questions for freshers experienced :-
1. What is MapReduce? It is a framework or a programming model that is used for processing large data sets over clusters of computers using distributed programming. 2. What are 'maps' and 'reduces'? 'Maps' and 'Reduces' are two phases of solving a query in HDFS. 'Map' is responsible to read data from input location, and based on the input type, it will generate a key value pair,that is, an intermediate output in local machine.'Reducer' is responsible to process the intermediate output received from the mapper and generate the final output. 3. What are the four basic parameters of a mapper? The four basic parameters of a mapper are LongWritable, text, text and IntWritable. The first two represent input parameters and the second two represent intermediate output parameters. 4. What are the four basic parameters of a reducer? The four basic parameters of a reducer are Text, IntWritable, Text, IntWritable.The first two represent intermediate output parameters and the second two represent final output parameters. 5. What do the master class and the output class do? Master is defined to update the Master or the job tracker and the output class is defined to write data onto the output location. 6. What is the input type/format in MapReduce by default? By default the type input type in MapReduce is 'text'. 7. Is it mandatory to set input and output type/format in MapReduce? No, it is not mandatory to set the input and output type/format in MapReduce. By default, the cluster takes the input and the output type as 'text'. 8. What does the text input format do? In text input format, each line will create a line off-set, that is an hexa-decimal number. Key is considered as a line off-set and value is considered as a whole line text. This is how the data gets processed by a mapper. The mapper will receive the 'key' as a 'LongWritable' parameter and value as a 'Text' parameter. 9. What does job conf class do? MapReduce needs to logically separate different jobs running on the same cluster. 'Job conf class' helps to do job level settings such as declaring a job in real environment. It is recommended that Job name should be descriptive and represent the type of job that is being executed. 10. What does conf.setMapper Class do? Conf.setMapperclass sets the mapper class and all the stuff related to map job such as reading a data and generating a key-value pair out of the mapper.
MAPREDUCE Interview Questions 11. What do sorting and shuffling do? Sorting and shuffling are responsible for creating a unique key and a list of values.Making similar keys at one location is known as Sorting. And the process by which the intermediate output of the mapper is sorted and sent across to the reducers is known as Shuffling. 12. What does a split do? Before transferring the data from hard disk location to map method, there is a phase or method called the 'Split Method'. Split method pulls a block of data from HDFS to the framework. The Split class does not write anything, but reads data from the block and pass it to the mapper.Be default, Split is taken care by the framework. Split method is equal to the block size and is used to divide block into bunch of splits. 13. How can we change the split size if our commodity hardware has less storage space? If our commodity hardware has less storage space, we can change the split size by writing the 'custom splitter'. There is a feature of customization in Hadoop which can be called from the main method. 14. What does a MapReduce partitioner do? A MapReduce partitioner makes sure that all the value of a single key goes to the same reducer, thus allows evenly distribution of the map output over the reducers. It redirects the mapper output to the reducer by determining which reducer is responsible for a particular key. 15. How is Hadoop different from other data processing tools? In Hadoop, based upon your requirements, you can increase or decrease the number of mappers without bothering about the volume of data to be processed. this is the beauty of parallel processing in contrast to the other data processing tools available. 16. Can we rename the output file? Yes we can rename the output file by implementing multiple format output class. 17. Why we cannot do aggregation (addition) in a mapper? Why we require reducer for that? We cannot do aggregation (addition) in a mapper because, sorting is not done in a mapper. Sorting happens only on the reducer side. Mapper method initialization depends upon each input split. While doing aggregation, we will lose the value of the previous instance. For each row, a new mapper will get initialized. For each row, inputsplit again gets divided into mapper, thus we do not have a track of the previous row value. 18. What is Streaming? Streaming is a feature with Hadoop framework that allows us to do programming using MapReduce in any programming language which can accept standard input and can produce standard output. It could be Perl, Python, Ruby and not necessarily be Java. However, customization in MapReduce can only be done using Java and not any other programming language. 19. What is a Combiner? A 'Combiner' is a mini reducer that performs the local reduce task. It receives the input from the mapper on a particular node and sends the output to the reducer. Combiners help in enhancing the efficiency of MapReduce by reducing the quantum of data that is required to be sent to the reducers. 20. What happens in a TextInputFormat? In TextInputFormat, each line in the text file is a record. Key is the byte offset of the line and value is the content of the line. For instance,Key: LongWritable, value: Text. 21. What do you know about KeyValueTextInputFormat? In KeyValueTextInputFormat, each line in the text file is a 'record'. The first separator character divides each line. Everything before the separator is the key and everything after the separator is the value. For instance,Key: Text, value: Text. 22. What do you know about SequenceFileInputFormat? SequenceFileInputFormat is an input format for reading in sequence files. Key and value are user defined. It is a specific compressed binary file format which is optimized for passing the data between the output of one MapReduce job to the input of some other MapReduce job. 23. What do you know about NLineOutputFormat? NLineOutputFormat splits 'n' lines of input as one split. 24. What is the difference between an HDFS Block and Input Split? HDFS Block is the physical division of the data and Input Split is the logical division of the data. 25. After restart of namenode, Mapreduce jobs started failing which worked fine before restart. What could be the wrong ? The cluster could be in a safe mode after the restart of a namenode. The administrator needs to wait for namenode to exit the safe mode before restarting the jobs again. This is a very common mistake by Hadoop administrators. 26. What do you always have to specify for a MapReduce job ? The classes for the mapper and reducer. The classes for the mapper, reducer, and combiner. The classes for the mapper, reducer, partitioner, and combiner. None; all classes have default implementations. 27. How many times will a combiner be executed ? At least once. Zero or one times. Zero, one, or many times. It’s configurable. 28. You have a mapper that for each key produces an integer value and the following set of reduce operations Reducer A: outputs the sum of the set of integer values. Reducer B: outputs the maximum of the set of values. Reducer C: outputs the mean of the set of values. Reducer D: outputs the difference between the largest and smallest values in the set. 29. Which of these reduce operations could safely be used as a combiner ? All of them. A and B. A, B, and D. C and D. None of them. Explanation: Reducer C cannot be used because if such reduction were to occur, the final reducer could receive from the combiner a series of means with no knowledge of how many items were used to generate them, meaning the overall mean is impossible to calculate. Reducer D is subtle as the individual tasks of selecting a maximum or minimum are safe for use as combiner operations. But if the goal is to determine the overall variance between the maximum and minimum value for each key, this would not work. If the combiner that received the maximum key had values clustered around it, this would generate small results; similarly for the one receiving the minimum value. These sub ranges have little value in isolation and again the final reducer cannot construct the desired result. 30. What is Uber task in YARN ? If the job is small, the application master may choose to run them in the same JVM as itself, since it judges the overhead of allocating new containers and running tasks in them as outweighing the gain to be had in running them in parallel, compared to running them sequentially on one node. (This is different to Mapreduce 1, where small jobs are never run on a single task tracker.) Such a job is said to be Uberized, or run as an Uber task. 31. How to configure Uber Tasks ? By default a job that has less than 10 mappers only and one reducer, and the input size is less than the size of one HDFS block is said to be small job. These values may be changed for a job by setting mapreduce.job.ubertask.maxmaps , mapreduce.job.uber task.maxreduces , and mapreduce.job.ubertask.maxbytes It’s also possible to disable Uber tasks entirely by setting mapreduce.job.ubertask.enable to false. 32. What are the ways to debug a failed mapreduce job ? Commonly there are two ways. By using mapreduce job counters YARN Web UI for looking into syslogs for actual error messages or status. 33. What is the importance of heartbeats in HDFS/Mapreduce Framework ? A heartbeat in master/slave architecture is a signal indicating that it is alive. A datanode sends heartbeats to Namenode and node managers send their heartbeats to Resource Managers to tell the master node that these are still alive. If the Namenode or Resource manager does not receive heartbeat from any slave node then they will decide that there is some problem in data node or node manager and is unable to perform the assigned task, then master (namenode or resource manager) will reassign the same task to other live nodes. 34. Can we rename the output file ? Yes, we can rename the output file by implementing multiple format output class. 35. What are the default input and output file formats in Mapreduce jobs ? If input file or output file formats are not specified, then the default file input or output formats are considered as text files. MAPREDUCE Questions and Answers pdf Download Read the full article
0 notes
Text
300+ TOP Ruby on Rails Interview Questions and Answers
Ruby on Rails Interview Questions for freshers experienced :-
1. What is Ruby on Rails? Ruby: It is an object oriented programming language inspired by PERL and PYTHON. Rails: It is a framework used for building web application 2. What is class libraries in Ruby? Class libraries in Ruby consist of a variety of domains, such as data types, thread programming, various domains, etc. 3. What is the naming convention in Rails? Variables: For declaring Variables, all letters are lowercase, and words are separated by underscores Class and Module: Modules and Classes uses MixedCase and have no underscore; each word starts with a uppercase letter Database Table: The database table name should have lowercase letters and underscore between words, and all table names should be in the plural form for example invoice_items Model: It is represented by unbroken MixedCase and always have singular with the table name Controller: Controller class names are represented in plural form, such that OrdersController would be the controller for the order table. 4. What is “Yield” in Ruby on Rails? A Ruby method that receives a code block invokes it by calling it with the “Yield”. 5. What is ORM (Object-Relationship-Model) in Rails? ORM or Object Relationship Model in Rails indicate that your classes are mapped to the table in the database, and objects are directly mapped to the rows in the table. 6. What the difference is between false and nil in Ruby? In Ruby False indicates a Boolean datatype, while Nil is not a data type, it have an object_id 4. 7. What are the positive aspects of Rails? Rails provides many features like Meta-programming: Rails uses code generation but for heavy lifting it relies on meta-programming. Ruby is considered as one of the best language for Meta-programming. Active Record: It saves object to the database through Active Record Framework. The Rails version of Active Record identifies the column in a schema and automatically binds them to your domain objects using metaprogramming Scaffolding: Rails have an ability to create scaffolding or temporary code automatically Convention over configuration: Unlike other development framework, Rails does not require much configuration, if you follow the naming convention carefully Three environments: Rails comes with three default environment testing, development, and production. Built-in-testing: It supports code called harness and fixtures that make test cases to write and execute. 8. What is the role of sub-directory app/controllers and app/helpers? App/controllers: A web request from the user is handled by the Controller. The controller sub-directory is where Rails looks to find controller classes App/helpers: The helper’s sub-directory holds any helper classes used to assist the view, model and controller classes. 9. What is the difference between String and Symbol? They both act in the same way only they differ in their behaviors which are opposite to each other. The difference lies in the object_id, memory and process tune when they are used together. Symbol belongs to the category of immutable objects whereas Strings are considered as mutable objects. 10. How Symbol is different from variables? Symbol is different from variables in following aspects It is more like a string than variable In Ruby string is mutable but a Symbol is immutable Only one copy of the symbol requires to be created Symbols are often used as the corresponding to enums in Ruby
Ruby on Rails Interview Questions 11. What is Rails Active Record in Ruby on Rails? Rails active record is the Object/Relational Mapping (ORM) layer supplied with Rails. It follows the standard ORM model as Table map to classes Rows map to objects Columns map to object attributes 12. How Rails implements Ajax? Ajax powered web page retrieves the web page from the server which is new or changed unlike other web-page where you have to refresh the page to get the latest information. Rails triggers an Ajax Operation in following ways Some trigger fires: The trigger could be a user clicking on a link or button, the users inducing changes to the data in the field or on a form Web client calls the server: A Java-script method, XMLHttpRequest, sends data linked with the trigger to an action handler on the server. The data might be the ID of a checkbox, the whole form or the text in the entry field Server does process: The server side action handler does something with the data and retrieves an HTML fragment to the web client Client receives the response: The client side JavaScript, which Rails generates automatically, receives the HTML fragment and uses it to update a particular part of the current 13. How you can create a controller for subject? To create a controller for subject you can use the following command C:\ruby\library> ruby script/generate controller subject 14. What is Rails Migration? Rails Migration enables Ruby to make changes to the database schema, making it possible to use a version control system to leave things synchronized with the actual code. 15. List out what can Rails Migration do? Rails Migration can do following things Create table Drop table Rename table Add column Rename column Change column Remove column and so on 16. What is the command to create a migration? To create migration command includes C:\ruby\application>ruby script/generate migration table_name 17. When self.up and self.down method is used? When migrating to a new version, self.up method is used while self.down method is used to roll back my changes if needed. 18. What is the role of Rails Controller? The Rails controller is the logical center of the application. It faciliates the interaction between the users, views, and the model. It also performs other activities like It is capable of routing external requests to internal actions. It handles URL extremely well It regulates helper modules, which extend the capabilities of the view templates without bulking of their code It regulates sessions; that gives users the impression of an ongoing interaction with our applications 19. What is the difference between Active support’s “HashWithIndifferent” and Ruby’s “Hash” ? The Hash class in Ruby’s core library returns value by using a standard “= =” comparison on the keys. It means that the value stored for a symbol key cannot be retrieved using the equivalent string. While the HashWithIndifferentAccess treats Symbol keys and String keys as equivalent. 20. What is Cross-Site Request Forgery (CSRF) and how Rails is protected against it? CSRF is a form of attack where hacker submits a page request on your behalf to a different website, causing damage or revealing your sensitive data. To protect from CSRF attacks, you have to add “protect_from_forgery” to your ApplicationController. This will cause Rails to require a CSRF token to process the request. CSRF token is given as a hidden field in every form created using Rails form builders. 21. What is Mixin in Rails? Mixin in Ruby offers an alternative to multiple inheritances, using mixin modules can be imported inside other class. 22. How you define Instance Variable, Global Variable and Class Variable in Ruby? Ruby Instance variable begins with — @ Ruby Class variables begin with — @@ Ruby Global variables begin with — $ 23. How you can run Rails application without creating databases? You can execute your application by uncommenting the line in environment.rb path=> rootpath conf/environment.rb config.frameworks = 24. What is the difference between the Observers and Callbacks in Ruby on Rails? Rails Observers: Observers is same as Callback, but it is used when method is not directly associated to object lifecycle. Also, the observer lives longer, and it can be detached or attached at any time. For example, displaying values from a model in the UI and updating model from user input. Rails Callback: Callbacks are methods, which can be called at certain moments of an object’s life cycle for example it can be called when an object is validated, created, updated, deleted, A call back is short lived. For example, running a thread and giving a call-back that is called when thread terminates 25. What is rake in Rails? Rake is a Ruby Make; it is a Ruby utility that substitutes the Unix utility ‘make’, and uses a ‘Rakefile’ and ‘.rake files’ to build up a list of tasks. In Rails, Rake is used for normal administration tasks like migrating the database through scripts, loading a schema into the database, etc. 26. How you can list all routes for an application? To list out all routes for an application you can write rake routes in the terminal. 27. What is sweeper in Rails? Sweepers are responsible for expiring or terminating caches when model object changes. 28. Mention the log that has to be seen to report errors in Ruby Rails? Rails will report errors from Apache in the log/Apache.log and errors from the Ruby code in log/development.log. 29. What is the difference between Dynamic and Static Scaffolding? Dynamic Scaffolding Static Scaffolding It automatically creates the entire content and user interface at runtime It enables to generation of new, delete, edit methods for the use in application It does not need a database to be synchronized It requires manual entry in the command to create the data with their fields It does not require any such generation to take place It requires the database to be migrated 30. What is the function of garbage collection in Ruby on Rails? The functions of garbage collection in Ruby on Rails includes It enables the removal of the pointer values which is left behind when the execution of the program ends It frees the programmer from tracking the object that is being created dynamically on runtime It gives the advantage of removing the inaccessible objects from the memory, and allows other processes to use the memory 31. What is the difference between redirect and render in Ruby on Rails? Redirect is a method that is used to issue the error message in case the page is not issued or found to the browser. It tells browser to process and issue a new request. Render is a method used to make the content. Render only works when the controller is being set up properly with the variables that require to be rendered. 32. What is the purpose of RJs in Rails? RJs is a template that produces JavaScript which is run in an eval block by the browser in response to an AJAX request. It is sometimes used to define the JavaScript, Prototype and helpers provided by Rails. 33. What is Polymorphic Association in Ruby on Rails? Polymorphic Association allows an ActiveRecord object to be connected with Multiple ActiveRecord objects. A perfect example of Polymorphic Association is a social site where users can comment on anywhere whether it is a videos, photos, link, status updates etc. It would be not feasible if you have to create an individual comment like photos_comments, videos_comment and so on. 34. What are the limits of Ruby on Rails? Ruby on Rails has been designed for creating a CRUD web application using MVC. This might make Rails not useful for other programmers. Some of the features that Rails does not support include Foreign key in databases Linking to multiple data-base at once Soap web services Connection to multiple data-base servers at once 35. What is the difference between calling super() and super call? super(): A call to super() invokes the parent method without any arguments, as presumably expected. As always, being explicit in your code is a good thing. super call: A call to super invokes the parent method with the same arguments that were passed to the child method. An error will therefore occur if the arguments passed to the child method don’t match what the parent is expecting. 36. What about Dig, Float and Max? Float class is used whenever the function changes constantly. Dig is used whenever you want to represent a float in decimal digits. Max is used whenever there is a huge need of Float. 37. How can we define Ruby regular expressions? Ruby regular expression is a special sequence of characters that helps you match or find other strings. A regular expression literal is a pattern between arbitrary delimiters or slashes followed by %r. 38. What is the defined operator? Define operator states whether a passed expression is defined or not. If the expression is defined, it returns the description string and if it is not defined it returns a null value. 39. List out the few features of Ruby? Free format – You can start writing from program from any line and column Case sensitive – The uppercase and lowercase letters are distinct Comments – Anything followed by an unquoted #, to the end of the line on which it appears, is ignored by the interpreter Statement delimiters- Multiple statements on one line must be separated by semicolons, but they are not required at the end of a line. 40. Mention the types of variables available in Ruby Class? Types of variables available in Ruby Class are, Local Variables Global Variables Class Variables Instance Variables 41. How can you declare a block in Ruby? In Ruby, the code in the block is always enclosed within braces ({}). You can invoke a block by using “yield statement”. 42. What is the difference between put and putc statement? Unlike the puts statement, which outputs the entire string onto the screen. The Putc statement can be used to output one character at a time. 43. What is a class library in Ruby? Ruby class libraries consist of a variety of domains, such as thread programming, data types, various domains, etc. These classes give flexible capabilities at a high level of abstraction, giving you the ability to create powerful Ruby scripts useful in a variety of problem domains. The following domains which have relevant class libraries are, GUI programming Network programming CGI Programming Text processing 44. In Ruby, it explains about the defined operator? The defined operator tells whether a passed expression is defined or not. If the expression is not defined, it gives null, and if the expression is defined it returns the description string. 45. What is the difference in scope for these two variables: @@name and @name? The difference in scope for these two variables is that: @@name is a class variable @name is an instance variable 46. What is the syntax for Ruby collect Iterator? The syntax for Ruby collect Iterator collection = collection.collect. 47. In Ruby code, often it is observed that coder uses a short hand form of using an expression like array.map(&:method_name) instead of array.map { |element| element.method_name }. How this trick actually works? When a parameter is passed with “&” in front of it. Ruby will call to_proc on it in an attempt to make it usable as a block. So, symbol to_Proc will invoke the method of the corresponding name on whatever is passed to it. Thus helping our shorthand trick to work. 48. What is Interpolation in Ruby? Ruby Interpolation is the process of inserting a string into a literal. By placing a Hash (#) within {} open and close brackets, one can interpolate a string into the literal. 49. What is the Notation used for denoting class variables in Ruby? In Ruby, A constant should begin with an uppercase letter, and it should not be defined inside a method A local must begin with the _ underscore sign or a lowercase letter A global variable should begin with the $ sign. An uninitialized global has the value of “nil” and it should raise a warning. It can be referred anywhere in the program. A class variable should begin with double @@ and have to be first initialized before being used in a method definition 50. What is the difference between Procs and Blocks? The difference between Procs and Blocks, Block is just the part of the syntax of a method while proc has the characteristics of a block Procs are objects, blocks are not At most one block can appear in an argument list Only block is not able to be stored into a variable while Proc can 51. What is the difference between a single quote and double quote? A single-quoted strings don’t process ASCII escape codes, and they don’t do string interpolation. 52. What is the difference between a gem and a plugin in Ruby? Gem: A gem is a just ruby code. It is installed on a machine, and it’s available for all ruby applications running on that machine. Plugin: Plugin is also ruby code, but it is installed in the application folder and only available for that specific application. 53. What is the difference extend and include? The “include” makes the module’s methods available to the instance of a class, while “extend” makes these methods available to the class itself. 54. Why Ruby on Rails? There are lot of advantages of using ruby on rails: 1. DRY Principal 2. Convention over Configuration 3. Gems and Plugins 4. Scaffolding 5. Pure OOP Concept 6. Rest Support 7. Rack support 8. Action Mailer 9. Rpc support 10. Rexml Support 11. etc.. 55. What is the Difference between Symbol and String? Symbol are same like string but both behaviors is different based on object_id, memory and process time (cpu time) Strings are mutable , Symbols are immutable. Mutable objects can be changed after assignment while immutable objects can only be overwritten. For example p "string object jak".object_id #=> 22956070 p "string object jak".object_id #=> 22956030 p "string object jak".object_id #=> 22956090 p :symbol_object_jak.object_id #=> 247378 p :symbol_object_jak.object_id #=> 247378 p :symbol_object_jak.object_id #=> 247378 p " string object jak ".to_sym.object_id #=> 247518 p " string object jak ".to_sym.object_id #=> 247518 p " string object jak ".to_sym.object_id #=> 247518 p :symbol_object_jak.to_s.object_id #=> 22704460 p :symbol_object_jak.to_s.object_id #=> 22687010 p :symbol_object_jak.to_s.object_id #=> 21141310 And also it will differ by process time For example: Testing two symbol values for equality (or non-equality) is faster than testing two string values for equality, Note : Each unique string value has an associated symbol 56. What things we can define in the model? There are lot of things you can define in models few are: 1. Validations (like validates_presence_of, numeracility_of, format_of etc.) 2. Relationships(like has_one, has_many, HABTM etc.) 3. Callbacks(like before_save, after_save, before_create etc.) 4. Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model 5. ROR Queries in Sql 6. Active record Associations Relationship 57. What do you mean by the term Rail Migration? It is basically an approach with the help of which the users can make the changes to the already existing database Schema in Ruby and can implement a version control system. The main aim is to synchronize the objects to get the quality outcomes. 58. What exactly do you know about the Rail Observers? It is very much similar to that of Callback. They can be deployed directly in case the methods are not integrated with the lifecycle of the object. It is possible for the users to attach the observer to any file and perform the reverse action by the user. 59. Name the two types of Scaffolding in the Ruby? These are Static and Dynamic Scaffolding 60. Explain some of the looping structures available in Ruby? For loop, While loop, Until Loop. Be able to explain situations in which you would use one over another. Ruby on Rails Questions and Answers Pdf Download Read the full article
0 notes
Text
300+ TOP MAPREDUCE Interview Questions and Answers
MAPREDUCE Interview Questions for freshers experienced :-
1. What is MapReduce? It is a framework or a programming model that is used for processing large data sets over clusters of computers using distributed programming. 2. What are 'maps' and 'reduces'? 'Maps' and 'Reduces' are two phases of solving a query in HDFS. 'Map' is responsible to read data from input location, and based on the input type, it will generate a key value pair,that is, an intermediate output in local machine.'Reducer' is responsible to process the intermediate output received from the mapper and generate the final output. 3. What are the four basic parameters of a mapper? The four basic parameters of a mapper are LongWritable, text, text and IntWritable. The first two represent input parameters and the second two represent intermediate output parameters. 4. What are the four basic parameters of a reducer? The four basic parameters of a reducer are Text, IntWritable, Text, IntWritable.The first two represent intermediate output parameters and the second two represent final output parameters. 5. What do the master class and the output class do? Master is defined to update the Master or the job tracker and the output class is defined to write data onto the output location. 6. What is the input type/format in MapReduce by default? By default the type input type in MapReduce is 'text'. 7. Is it mandatory to set input and output type/format in MapReduce? No, it is not mandatory to set the input and output type/format in MapReduce. By default, the cluster takes the input and the output type as 'text'. 8. What does the text input format do? In text input format, each line will create a line off-set, that is an hexa-decimal number. Key is considered as a line off-set and value is considered as a whole line text. This is how the data gets processed by a mapper. The mapper will receive the 'key' as a 'LongWritable' parameter and value as a 'Text' parameter. 9. What does job conf class do? MapReduce needs to logically separate different jobs running on the same cluster. 'Job conf class' helps to do job level settings such as declaring a job in real environment. It is recommended that Job name should be descriptive and represent the type of job that is being executed. 10. What does conf.setMapper Class do? Conf.setMapperclass sets the mapper class and all the stuff related to map job such as reading a data and generating a key-value pair out of the mapper.
MAPREDUCE Interview Questions 11. What do sorting and shuffling do? Sorting and shuffling are responsible for creating a unique key and a list of values.Making similar keys at one location is known as Sorting. And the process by which the intermediate output of the mapper is sorted and sent across to the reducers is known as Shuffling. 12. What does a split do? Before transferring the data from hard disk location to map method, there is a phase or method called the 'Split Method'. Split method pulls a block of data from HDFS to the framework. The Split class does not write anything, but reads data from the block and pass it to the mapper.Be default, Split is taken care by the framework. Split method is equal to the block size and is used to divide block into bunch of splits. 13. How can we change the split size if our commodity hardware has less storage space? If our commodity hardware has less storage space, we can change the split size by writing the 'custom splitter'. There is a feature of customization in Hadoop which can be called from the main method. 14. What does a MapReduce partitioner do? A MapReduce partitioner makes sure that all the value of a single key goes to the same reducer, thus allows evenly distribution of the map output over the reducers. It redirects the mapper output to the reducer by determining which reducer is responsible for a particular key. 15. How is Hadoop different from other data processing tools? In Hadoop, based upon your requirements, you can increase or decrease the number of mappers without bothering about the volume of data to be processed. this is the beauty of parallel processing in contrast to the other data processing tools available. 16. Can we rename the output file? Yes we can rename the output file by implementing multiple format output class. 17. Why we cannot do aggregation (addition) in a mapper? Why we require reducer for that? We cannot do aggregation (addition) in a mapper because, sorting is not done in a mapper. Sorting happens only on the reducer side. Mapper method initialization depends upon each input split. While doing aggregation, we will lose the value of the previous instance. For each row, a new mapper will get initialized. For each row, inputsplit again gets divided into mapper, thus we do not have a track of the previous row value. 18. What is Streaming? Streaming is a feature with Hadoop framework that allows us to do programming using MapReduce in any programming language which can accept standard input and can produce standard output. It could be Perl, Python, Ruby and not necessarily be Java. However, customization in MapReduce can only be done using Java and not any other programming language. 19. What is a Combiner? A 'Combiner' is a mini reducer that performs the local reduce task. It receives the input from the mapper on a particular node and sends the output to the reducer. Combiners help in enhancing the efficiency of MapReduce by reducing the quantum of data that is required to be sent to the reducers. 20. What happens in a TextInputFormat? In TextInputFormat, each line in the text file is a record. Key is the byte offset of the line and value is the content of the line. For instance,Key: LongWritable, value: Text. 21. What do you know about KeyValueTextInputFormat? In KeyValueTextInputFormat, each line in the text file is a 'record'. The first separator character divides each line. Everything before the separator is the key and everything after the separator is the value. For instance,Key: Text, value: Text. 22. What do you know about SequenceFileInputFormat? SequenceFileInputFormat is an input format for reading in sequence files. Key and value are user defined. It is a specific compressed binary file format which is optimized for passing the data between the output of one MapReduce job to the input of some other MapReduce job. 23. What do you know about NLineOutputFormat? NLineOutputFormat splits 'n' lines of input as one split. 24. What is the difference between an HDFS Block and Input Split? HDFS Block is the physical division of the data and Input Split is the logical division of the data. 25. After restart of namenode, Mapreduce jobs started failing which worked fine before restart. What could be the wrong ? The cluster could be in a safe mode after the restart of a namenode. The administrator needs to wait for namenode to exit the safe mode before restarting the jobs again. This is a very common mistake by Hadoop administrators. 26. What do you always have to specify for a MapReduce job ? The classes for the mapper and reducer. The classes for the mapper, reducer, and combiner. The classes for the mapper, reducer, partitioner, and combiner. None; all classes have default implementations. 27. How many times will a combiner be executed ? At least once. Zero or one times. Zero, one, or many times. It’s configurable. 28. You have a mapper that for each key produces an integer value and the following set of reduce operations Reducer A: outputs the sum of the set of integer values. Reducer B: outputs the maximum of the set of values. Reducer C: outputs the mean of the set of values. Reducer D: outputs the difference between the largest and smallest values in the set. 29. Which of these reduce operations could safely be used as a combiner ? All of them. A and B. A, B, and D. C and D. None of them. Explanation: Reducer C cannot be used because if such reduction were to occur, the final reducer could receive from the combiner a series of means with no knowledge of how many items were used to generate them, meaning the overall mean is impossible to calculate. Reducer D is subtle as the individual tasks of selecting a maximum or minimum are safe for use as combiner operations. But if the goal is to determine the overall variance between the maximum and minimum value for each key, this would not work. If the combiner that received the maximum key had values clustered around it, this would generate small results; similarly for the one receiving the minimum value. These sub ranges have little value in isolation and again the final reducer cannot construct the desired result. 30. What is Uber task in YARN ? If the job is small, the application master may choose to run them in the same JVM as itself, since it judges the overhead of allocating new containers and running tasks in them as outweighing the gain to be had in running them in parallel, compared to running them sequentially on one node. (This is different to Mapreduce 1, where small jobs are never run on a single task tracker.) Such a job is said to be Uberized, or run as an Uber task. 31. How to configure Uber Tasks ? By default a job that has less than 10 mappers only and one reducer, and the input size is less than the size of one HDFS block is said to be small job. These values may be changed for a job by setting mapreduce.job.ubertask.maxmaps , mapreduce.job.uber task.maxreduces , and mapreduce.job.ubertask.maxbytes It’s also possible to disable Uber tasks entirely by setting mapreduce.job.ubertask.enable to false. 32. What are the ways to debug a failed mapreduce job ? Commonly there are two ways. By using mapreduce job counters YARN Web UI for looking into syslogs for actual error messages or status. 33. What is the importance of heartbeats in HDFS/Mapreduce Framework ? A heartbeat in master/slave architecture is a signal indicating that it is alive. A datanode sends heartbeats to Namenode and node managers send their heartbeats to Resource Managers to tell the master node that these are still alive. If the Namenode or Resource manager does not receive heartbeat from any slave node then they will decide that there is some problem in data node or node manager and is unable to perform the assigned task, then master (namenode or resource manager) will reassign the same task to other live nodes. 34. Can we rename the output file ? Yes, we can rename the output file by implementing multiple format output class. 35. What are the default input and output file formats in Mapreduce jobs ? If input file or output file formats are not specified, then the default file input or output formats are considered as text files. MAPREDUCE Questions and Answers pdf Download Read the full article
0 notes
Text
Top 30 Perl Interview Questions 2020
Coding Tag offers you the PERL interview questions with detailed explanations of every section covering PERL language basics that are required before facing a PERL developer interview.
1) PERL stands for?
Practical Extraction and Report Language
2) Who Developed the PERL language?
Larry Wall
3) What is PERL?
Perl is the most prominent interpreted open source programming language containing a wide range of libraries, programmer, and resources used for various tasks related to web development, system administration, network programming, GUI development, report language, practical extraction and other bulk text processing tasks.
PERL is trendier nowadays due to its rapid development cycle and text manipulation capabilities.
4) List some features of PERL?
PERL contain effective inbuilt regular expressions for Data Transformation and Filtration
Support web data encryption including e-commerce transactions
Support DBI package for easy web-database integration
Support Unicode, procedural and object oriented language
SWIG and XS can be used for Perl interfaces with external C++/C libraries
Perl is the request-response type of language
Single script can be used in multiple devices
Platform independent
It is simple to learn Perl language
5) What is the main reason for choosing PERL language as a scripting language?
Following are the reasons for selecting PERL languages as a scripting language:
Perl single line of code is equivalent to multiple line codes in another language.
Single script can be used in multiple devices
You don't need to implement our own logic as in Python or C
It contains huge built-in parsing interpreter, pattern matching, and regular expressions.
6) Differentiate Between USE and REQUIRE?
USE
REQUIRE
Act at compile time (Perl compilation phase)
Act at runtime
File extension is not required
File extension is not required
Used for only modules
Used for modules and libraries
7) How can you empty an array?
There are three methods to empty an array that is as follows:
By setting length placing its length to any negative number.
By assigning a null list().
Set an array to under to clear it.
8) Is the length of Perl code is same as in C++ and Java code?
Perl code is less as a comparison to Java and C++ language since Perl code is one-fifth the size of the C++ code, we need less to maintain, write and debug.
9) Is Binary extension can be load dynamically?
Yes, the Binary extension can be loaded dynamically if your systems support it.
10) Between the list and the terms, which has the highest precedence?
Terms have the highest precedence in comparison with list operators. Terms are variables, expressions in parenthesis, quotes etc.
Read more article :https://www.codingtag.com/top-30-perl-interview-questions
0 notes