Category Archives: Upwork Web Development

Upwork Web Development

Email Etiquette Certification Test

Published by:

1. Which of the following is the best technique for sending a large e-mail attachment?

Answers:

  1. Just attach it and send it.
  2. Email the other party directly first and make sure their connection can handle a large download.
  3. Try and break it up into several smaller downloads, or ‘zip’ the file if possible.
  4. Send part of it, and wait to see if they request the remaining part.
  5. b and c

2. When sending an e-mail, why is it a good idea to try and use the cc: field sparingly?

Answers:

  1. The cc: can be confusing since the recipients might not know who is supposed to act on the message.
  2. Unless the recipient in the cc: field knows why they are receiving a copy of the message, he or she may not act on the message, but assume it is really only for the main recipient.
  3. It can sometimes devalue the main message depending on the context, as it could be seen to depersonalize the main message.

3. Which of the following is the best description of an ‘internet troll’?

Answers:

  1. Someone who goes trolling on the internet, moving from place to place without settling anywhere in a chat room or on a board.
  2. A funny emoticon made to look like a troll.
  3. Another name for a spammer.
  4. Someone who participates in a message board or chat with the intention to disrupt it in some way.

4. What does ‘flaming’ or ‘to flame’ mean in the online world?

Answers:

  1. Flaming means delivering a strongly held opinion without holding back any emotion, often offending the person who is ‘flamed’.
  2. To grow angry and increasingly upset by a message you have received.
  3. To grow red in the face, embarrassed by certain online content.
  4. To cause a shutdown of your computer and several others on the same network, even if by accident.

5. Why should you not type in all caps when writing an email?

Answers:

  1. Because it can be difficult to read.
  2. Because it takes up more room and makes the email longer.
  3. Because it is considered ‘yelling’.
  4. Because it is tough on your keyboard.
  5. a and c

6. What does ‘scrolling the chat screen’ in an internet chat room mean, and is it good or bad netiquette?

Answers:

  1. Looking further down the screen (good netiquette).
  2. Scrolling down to follow the conversation as it develops (bad netiquette).
  3. Posting multiple, often single letter postings so the chat screen scrolls very fast for all users (bad netiquette).
  4. Flicking between multiple chat screen on multiple sites (neither good nor bad netiquette).
  5. None of the above

7. What is the better solution than using bold or italic to emphasize meaning when e-mailing or posting online?

Answers:

  1. Use capitals
  2. Use color
  3. Use carefully chosen words and phrases, so that the meaning is clear and not ambiguous and unlikely to cause misunderstandings.
  4. Draw a picture and insert it around the text.
  5. None of the above

8. What is a very useful last thing to do before sending out any e-mail?

Answers:

  1. Read the e-mail through for spelling and grammatical errors, to simplify the message if possible, and to check the recipient’s e-mail address.
  2. Nothing, the quicker you send it, the quicker they will receive it.
  3. Copy the e-mail at least twice into a word document, as a double precaution.
  4. Check the time, so you can remember when you sent it, in case they call.
  5. All of the above

9. Which of the following could be considered as not being ‘virtual events,’ so you may wish to respond using a more direct reply or regular mail?

Answers:

  1. Weddings, funerals, engagements, birthdays.
  2. After hours get-togethers.
  3. Casual meetings related to school or work.
  4. A local prize draw.

10. What is the best way to treat ‘spam’ or unsolicited e-mails?

Answers:

  1. Do not reply to them.
  2. Delete them.
  3. Transfer them to your spam folder.
  4. Ignore them (if you notice them, as they are usually transfered to your spam folder automatically).
  5. All of the above

11. Which of the following best reflects a so-called ‘Golden Rule’ of etiquette?

Answers:

  1. Spam your friends.
  2. Remember the human (remember that a real person is receiving the message).
  3. Sometimes act friendly in chat and emails.
  4. Only flame your friends by accident.
  5. All of the above

12. Which of the following is the best explanation of ‘netiquette’?

Answers:

  1. Electronic netball practice.
  2. An abbreviation for ‘internet etiquette’ or even ‘ethics on the net,’ the correct way to interact in an online setting.
  3. Networking expertise, especially when off-line.
  4. Online chatrooms for sophisticated Mac and PC users.

13. What does ‘HTH’ mean in an email or on a message board?

Answers:

  1. Happy today happy
  2. Hope this helps
  3. Help the human
  4. Happy to help
  5. b and d

14. Why is it important to be careful with formatting when sending an e-mail message?

Answers:

  1. It’s not – you can format in any style you like, as the recipient will find a way to understand the message.
  2. Because the recipient may not be able to read certain fonts or formats on his or her computer.
  3. It is polite, and looks neater, especially if you use pretty colors.
  4. Sometimes computers have been known to blow up when used with the wrong fonts.
  5. None of the above

15. What is the correct way to address someone online, if you are unsure of how he or she would like to be addressed?

Answers:

  1. Use their first name, it is always the friendliest option.
  2. Use their last name, such as Mr. Jones or Ms. Jones.
  3. Use their full name, with their first name in parentheses afterwards.
  4. Use Dear X to demonstrate your uncertainty, and they will probably correct you.

16. If you are chatting with someone via the instant messenger and text ‘BRB’, what have you said?

Answers:

  1. Been Ready Buddy
  2. Been Really Busy
  3. Being Really Busy
  4. Be Right Back

17. What is the purpose of icon-emotions or so-called ’emoticons’ in email communication?

Answers:

  1. They contain important information such as credit card number.
  2. They indicate that the email is urgent.
  3. They are meant for fun and entertainment value.
  4. They act as a signature which is added at the end of each sent mail.

18. What does it mean to ‘respect somebody else’s bandwidth’?

Answers:

  1. To measure the width of the desktop PC in comparison to a laptop of the same brand.
  2. To open doors for them to fit through, a reference specifically to the real rather than the virtual world.
  3. To be conscious of how much storage space you are controlling in any given communication, since everyone only has limited space.
  4. To allow them two communications for every single communication of your own.
  5. None of the above

19. What is the most important aspect of writing content for a blog, either as a main posting or as a comment on someone else’s blog?

Answers:

  1. Always make your posts accurate and truthful (as well as entertaining) especially if they reflect on your reputation as someone with an online presence.
  2. Make it long and detailed, and occasionally bend the truth a little for the sake of impact, even if you are discovered.
  3. Make the blog colorful, or make your posting in bold, italic or in capitals, for emphasis.
  4. All of the above

20. Which of the following 2 options are not good practices for reacting to virus hoaxes and chain letters?

Answers:

  1. Forwarding them to your friends, as often advised by the e-mail hoax itself.
  2. Discarding or deleting them immediately.
  3. Considering them, and allowing them to send to your entire contacts list, for other people to decide about their authenticity.
  4. Printing them out and sending hard copies to a local internet watchdog or awareness group.

21. Which of the following is a good statement about time delays between e-mail exchanges?

Answers:

  1. Try to reply within a 24-48 hour window, but allow at least the same amount of time before sending a follow-on e-mail, if not longer.
  2. Always reply within 24 hours, and expect the same from someone else.
  3. Wait 36 hours before replying to any e-mail, but send a follow-on e-mail within 24 hours if you don’t hear anything.
  4. Always allow a month for a reply, and return your own received e-mails within three weeks.

22. Why is it sometimes important not to leave out the message thread, i.e. the previous messages in the e-mail chain?

Answers:

  1. To be polite. People expect to always see the thread.
  2. To increase comprehension of the latest message, and show the history of messages that led up to this point in the exchange.
  3. Because it looks like an oversight. The thread should always be there.
  4. None of the above

23. What should you do if you do not want to type your name at the end of every email you send?

Answers:

  1. Only sign emails which you send to business associates.
  2. Do not sign at all as people know who the email is from, courtesy your return email address.
  3. Include the ‘from’ information in the subject line so you can save the time of ‘signing’ the email.
  4. Create a signature that will get automatically attached to every email you send.

24. When writing an email, it is generally a good idea for your paragraphs to be _______.

Answers:

  1. long
  2. short
  3. in a huge font making them easier to read
  4. always indented
  5. None of the above

25. Why is it always good to use proper grammar and correct spelling in internet postings like message boards?

Answers:

  1. People who are non-native English speakers will understand your writing easily.
  2. Good grammar and spelling keep ambiguity to a minimum, thereby communicating the message more clearly.
  3. You do not want to be embarrassed.
  4. It is good manners, and you can be proud of yourself.
  5. You are always morally judged by how many typos you make.

26. What do the abbreviations ‘FWIW’ and ‘FYI’ stand for?

Answers:

  1. For What It’s Worth, For Your Information
  2. For Why It’s War, For Your Info
  3. For Whom It Worries, Forget Your Instructor
  4. Future Wear Inside Walls, Fool Your Insides
  5. For Whom It Worries, Fax Your Information

27. How often is it sensible to use ‘reply all’ when replying to an e-mail?

Answers:

  1. As often as possible, the more people know the information the better.
  2. Always, as e-mails should have at least two recipients at all times.
  3. Only if the information is really relevant to everyone on the list, otherwise keep ‘reply all’ to a minimum.
  4. You should ‘reply all’ about twice as often as you simply ‘reply’.
  5. None of the above

28. What does the phrase ‘lurk before you leap’ commonly mean on internet sites?

Answers:

  1. That you should set up a virtual online presence and scare people when they log-in.
  2. That you should familiarize yourself with a website’s contents — its purpose, its FAQ, its community — before making a contribution.
  3. a and b
  4. That you should contribute quickly before anyone discovers that you are an unwelcome presence, or only tenuously connected to the site and its online community.

29. Which of the following is the best advice when writing a business e-mail?

Answers:

  1. To use varied italics, colors and special fonts because people like to see them.
  2. To keep the information relatively short, precise and always polite, with simple questions relating to what you expect to happen.
  3. To make detailed demands in long paragraphs, with the implication of wrongdoing on the part of the receiver.
  4. To panic, but then recover, and decide to send the message by regular mail, as this is definitely more secure.

30. On a social networking site, which of the following is important to consider — in a personal way – when uploading photographs?

Answers:

  1. How many images you can upload as fast as possible.
  2. Consider the feelings and reputation of the person whose image you are uploading, especially if the image is compromising in some way.
  3. Whether it is clear that you are the one uploading the images or not.
  4. None of the above

31. What are vCards and why are they sometimes distracting or difficult for the recipient?

Answers:

  1. vCards are online invitation cards, but the recipient often does not want to attend the event.
  2. vCards are e-mail that copy in other members of your contacts list automatically, which is often not desirable.
  3. vCards are electronic business cards, but they often take the form of an e-mail attachment, therefore making every e-mail look like it has an attachment.
  4. vCards are online stationery cards used for a variety of events, and therefore business and recreational events can get confused.
  5. None of the above

32. Which of the following is the best response to sending a message that you didn’t intend to send, or sent to the wrong recipient?

Answers:

  1. Make a request for the e-mail to be recalled or sent back to you.
  2. Race over to the recipient’s computer, especially if he or she lives or works locally, and delete the message manually.
  3. Send a follow-up message explaining that the previous message was a mistake, with a brief apology and explaining that the message can be ignored.
  4. Jump up and down in frustration and tear your hair.
  5. All of the abov

33. How would you abbreviate ‘Be Seeing You’ in email jargon?

Answers:

  1. BSU
  2. BCNU
  3. BCINU
  4. BCINYU
  5. BSNU

34. A common online symbol, what is the correct ’emoticon’ for a regular ‘smiley face’ from the list below?

Answers:

  1. 1f609
  2. simple-smile
  3. :))
  4. (– :
  5. (-:

35. What does it mean when you type an e-mail in all capitals?

Answers:

  1. The e-mail is important
  2. The e-mail is an emergency
  3. The e-mail is classified information
  4. The effect is that you are shouting
  5. b and c

36. What does ‘spamming’ mean, and is it good or bad netiquette?

Answers:

  1. Sending online presents or ‘spam’ to your co-workers and friends (good netiquette).
  2. Sending unsolicited e-mails or communications to people online (bad netiquette).
  3. Both a and b, depending on the context.
  4. Same as ‘flaming’ (good netiquette).
  5. Same as ‘e-mail jousting’ (bad netiquette).

1,715 total views, 2 views today

Upwork Web Development

Django Test 2016

Published by:

1. Consider the following Python string representing a human readable date and time:
dt = ‘Jan 14 2009 11:00PM’

Which of the following code snippets will convert the above string to a Python Datetime object that is suitable for a django.models.DateField?

Answers:

  1. date_object = time.strptime(dt, ‘%b %d %Y %I:%M%p’)
  2. date_object = datetime.strptime(dt, ‘%b %d %Y %I:%M%p’)
  3. date_object = datetime.strptime(dt, ‘%B %D %Y %I:%M%p’)
  4. date_object = time.strptime(dt, ‘%b %d %Y %I:%M%p’)

2. Which of the following is false about the django.models.SlugField() model field?

Answers:

  1. It is used when performing a query, or as a part of a URL, since by default it ensures uniqueness.
  2. To create a slug based on another field automatically in the admin, prepopulated_fields has to be used.
  3. It can only contain letters, numbers, underscores or hyphens.
  4. Slugs can created in Django templates using the builtin filter, “django.template.defaultfilters.slugify”, formatted as {{ some_text|slugify }}.

3. What does the django.core.context_processors.static() method do?

Answers:

  1. It takes a path and urljoins it with the static prefix STATIC_URL.
  2. It adds STATIC_URL to every template context rendered with RequestContext contexts.
  3. It populates a template variable with the static prefix STATIC_URL to be used as a variable or directly.
  4. None of these.

4. Which of the following statements is true about the django.template.RequestContext class?

Answers:

  1. It takes a Context object as its first argument.
  2. It takes an HttpRequest as its first argument.
  3. It does not automatically the context with variables.
  4. It can only be given one context processor.

5. Consider two Django QuerySets query_set_1 and query_set_2 from two different models.
Which of the following code snippets is the most performant when concatenating the two QuerySets into one list?

Answers:

  1. from itertools import chain result_list = list(chain(query_set_1,query_set_2))
  2. result_list = query_set_1 | query_set_2
  3. from django.db.models import Q result_list = Q(query_set_1) | Q(query_set_1)
  4. from itertools import chain result_list = chain(query_set_1, query_set_2)

6. Which of the following statements about database transactions in Django is false?

Answers:

  1. “atomic” blocks allows the creation of blocks of code within which the atomicity on the database is guaranteed.
  2. “atomic” blocks cannot be nested.
  3. “atomic” can be used as a decorator.
  4. “atomic” can be used as a context manager.

7. Consider the following code snippet for a Django Model:

class Salary(models.Model):
amount = models.PositiveIntergerField(help_text=’eg 8000′)
retired = models.BooleanField(help_text=’True if above average’)
………..

Which of the following will correctly produce a QuerySet of all Salary objects where retired == True and amount != 7300?

Answers:

  1. results = Salary.objects.exclude(retired=true, amount__lt=7300).exclude(retired=true,amount__gt=7300)
  2. from django.db.models import Q results = Salary.filter(~Q(amount=7300),retired=True)
  3. results = Salary.objects.filtered(retired=True, amount__ne=7300)
  4. from django.db.models import Q results = Salary.filter(Q(amount=7300),retired=True)

8. Which of the following gets called when a view raises an exception?

Answers:

  1. view_exception()
  2. process_exception()
  3. execution_exception()
  4. controller_exception()

9. What is the best way to extend the Django user model with extra custom fields in addition to the fields already provided?

Answers:

  1. Use a a proxy model based on django.contrib.auth.models.User.
  2. Subclass django.contrib.auth.models.AbstractUser and add the extra fields.
  3. Subclass django.contrib.auth.models.AbstractBaseUser and add the extra fields.
  4. Use a one-to-one relationship to a model containing the extra fields.

10. Which of the following statements are true about the ImageField class?

Answers:

  1. It inherits all attributes and methods from the FileField class.
  2. It validates that the uploaded object is a valid image.
  3. Its instances are created as varchar(200) columns in the database.
  4. It’s default form widget is a ClearableFileInput.

11. What does the “with” template tag do?

Answers:

  1. It adds its argument to the value.
  2. It caches a complex under a simpler name.
  3. It filters the contents of the blog through one or more filters.
  4. None of these.

12. Which of the following statement is false about the django.http.HttpRequest.get_host() method ?

Answers:

  1. If DEBUG = False and ALLOWED_HOSTS= [] the method will raise SuspiciousOperation exception resulting in an HTTP Error 500 Internal server error.
  2. The method will fail when the host is behind multiple proxies, in this case one solution is to use middleware which will rewrite the proxy headers.
  3. This method is invoked if some code accesses the Host header from request.META, thus providing a security measure to prevent an attacker from poisoning caches and password reset emails with links to malicious hosts by submitting requests with a fake HTTP Host header.
  4. The method uses information from the HTTP_X_FORWARDED_HOST and HTTP_HOST headers, in that order, or a combination of SERVER_NAME and SERVER_PORT if the latter does not provide a value.

13. What is the default max_length value of a SlugField class in Django?

Answers:

  1. 50
  2. 100
  3. 25
  4. 150

14. Which of the following is a built-in BaseCommand subclass?

Answers:

  1. AppCommand
  2. HelperCommand
  3. HandlerCommand
  4. DBCommand

15. Which of the following statements is true about Django’s default implementation of the authentication system?

Answers:

  1. Django stores passwords in plain text on the user model.
  2. It returns a UserAccount object is the password for a given username is authenticated.
  3. Permissions can only be set on a per type of object basis.
  4. django.contrib.auth will ensure that add, change and delete permissions are created for each Django model defined in an installed application.

16. Which of the following happens when process_exception() returns “None”?

Answers:

  1. The template response will be applied.
  2. The response middleware will be applied.
  3. The default exception handling will be applied.
  4. None of these.

17. Which of the following is not a predefined log level in Django?

Answers:

  1. DEBUG
  2. INFO
  3. WARNING
  4. FATAL

18. Which of the following classes uses an HTTP 304 status code?

Answers:

  1. HttpResponseNotModified
  2. HttpResponseRedirect
  3. HttpResponseForbidden
  4. HttpResponseServerError

19. Which of the following django.template.loader functions will take a list of template names and return the first template that exists?

Answers:

  1. find_one_template
  2. find_template
  3. get_template
  4. select_template

20. Which of the following is not a built-in Django template loader class?

Answers:

  1. file.Loader
  2. cached.Loader
  3. eggs.Loader
  4. app_directories.Loader

1,486 total views, 2 views today

Upwork Web Development

Ruby on Rails Test 2016

Published by:

1. Which of the following will return a User object when used with a model which deals with a table named User?

Answers:

  1. User.new
  2. User.destroy
  3. User.find
  4. User.save

2. In the case of Rails application performance optimization, select all valid ways to do assets compilation:

Answers:

  1. Running the rake task with the assets:precompile parameter when CSS and JavaScript files are updated.
  2. Set a true value for the config.assets.compile parameter in the config/environments/production.rb file.
  3. Implementing the Rails asset pipeline feature to minify JavaScript & CSS assets.
  4. All of these.

3. What is the best way to get the current request URL in Rails?

Answers:

  1. request.url
  2. request.request_uri
  3. request.fullpath
  4. request.current_path

4. How can a value be stored so that it’s shared across an entire request (i.e. make it accessible in controllers, views and models)?

Answers:

  1. Put it in a global variable.
  2. Create a Singleton and store it in a class variable.
  3. Store it in a thread locally.

5. Which of the following commands adds the data model info to the model file?

Answers:

  1. bundle install
  2. generate model
  3. annotate
  4. Rails server

6. Which of the following HTML template languages are supported by Ruby?

Answers:

  1. Embedded Ruby
  2. HAML
  3. Mustache
  4. Razor

7. In a has_many association, what is the difference between build and new?
// user.rb
has_many :posts
// post.rb
belongs_to :user

Answers:

  1. ‘new’ sets the foreign key while ‘build’ does not.
  2. ‘build’ sets the foreign key while ‘new’ does not.
  3. ‘build’ sets the foreign key and adds it to the collection.
  4. ‘new’ sets the foreign key and adds it to the collection.

8. What is the output of the following code?

"test"*5

Answers:

  1. type casting error
  2. test5
  3. 5
  4. testtesttesttesttest

9. When using full-page caching, what happens when an incoming request matches a page in the cache?

Answers:

  1. The web-server serves the file directly from disk, bypassing Rails.
  2. Rails checks to see if there is a cached page on disk and passes it onto the server.
  3. Rails checks its in-memory cache and passes the page onto the server.

10. What is the difference between _url and _path while being used in routes?

Answers:

  1. _url is absolute while _path is relative.
  2. _path is relative while _path is absolute.
  3. _path is used in controllers while _url is used in views.
  4. _path is used in views while _url is used in controllers.

11. Which of the following code samples will get the index of |page| inside of a loop?

Answers:

  1. <% @images.each.do |page,index| %> <% end %>
  2. <% @images.each_with_index do |page, index| %> <% end %>
  3. <% @images.collect.each.at_index do |page, index| %> <% end %>
  4. None of these

12. Which of the following choices will write routes for the API versioning scenario described below?

/api/users returns a 301 to /api/v2/users
/api/v1/users returns a 200 of users index at version 1
/api/v3/users returns a 301 to /api/v2/users
/api/asdf/users returns a 301 to /api/v2/users

Answers:

  1. namespace :api do namespace :v1 do resources :users end namespace :v2 do resources :users end match ‘v:api/*path’, :to => redirect(“/api/v2/%{path}”) match ‘*path’, :to => redirect(“/api/v2/%{path}”) end
  2. namespace :api do resources :users end namespace :v2 do resources :users end match ‘v:api/*path’, :to => redirect(“/api/v1/%{path}”) match ‘*path’, :to => redirect(“/api/v1/%{path}”) end
  3. namespace :api do scope :module => :v3, &current_api_routes namespace :v3, &current_api_routes namespace :v2, &current_api_routes namespace :v1, &current_api_routes match “:api/*path”, :to => redirect(“/api/v3/%{path}”) end
  4. None of these

13. What is the output of the following Ruby code?

puts “The multiplication output of 10,10,2 is #{10*10*2}”

Answers:

  1. 200.
  2. The multiplication output of 10,10,2 is #{10*10*2}.
  3. The multiplication output of 10,10,2 is 200.
  4. The code will give a syntax error.

14. What is difference between “has_one” and “belong_to”?

Answers:

  1. “has_one” should be used in a model whose table have foreign keys while “belong_to” is used with an associated table.
  2. “belong_to” should be used in a model whose table have foreign keys while “has_one” is used with an associated table.
  3. The two are interchangeable.
  4. None of these.

15. Which of the following is the correct way to know the Rails root directory path?

Answers:

  1. RAILS_ROOT
  2. Rails.root
  3. Rails.root.show
  4. Rails.show.root

16. What is best way to create primary key as a string field instead of integer in rails.

Answers:

  1. when creating a new table don’t add primary key using this create_table users, :id => false do |t| t.string :id, :null => false …… end execute(“ALTER TABLE users ADD PRIMARY KEY (id)”) if not using id as primary key then in users model add the following line class User < ActiveRecord::Base self.primary_key = “column_name” …. end
  2. you can add a key to column name to make it primary create_table users :id => false do |t| t.string :column_name, :primary => true end

17. In a Rails application, a Gemfile needs to be modified to make use of sqlite3-ruby gems. Which of the following options will use these gems, as per the new Gemfile?

Answers:

  1. install bundle Gemfile
  2. bundle install
  3. mate Gemfile
  4. gem bundle install

18. What is the recommended Rails way to iterate over records for display in a view?

Answers:

  1. Implicitly loop over a set of records, and send the partial being rendered a :collection.
  2. Use each to explicitly loop over a set of records.
  3. Use for to fetch individual records explicitly in a loop.

19. where we use attr_accessor and attr_accessible in rails ?

Answers:

  1. controller
  2. helper
  3. model
  4. view

20. Given the following code, where is the “party!” method available?

module PartyAnimal
def self.party!
puts “Hard! Better! Faster! Stronger!”
end
end

class Person
include PartyAnimal
end

Answers:

  1. PartyAnimal.party!
  2. Person.party!
  3. Person.new.party!
  4. Both PartyAnimal.party! and Person.party!
  5. None of these

21. Which part of the MVC stack does ERB or HAML typically participate in?

Answers:

  1. Class
  2. Controller
  3. Model
  4. Module
  5. View

22. Which of the following items are stored in the models subdirectory?

Answers:

  1. helper classes
  2. database classes
  3. HTML layout templates
  4. Config files

23. What is the output of the following code in Ruby?
x= “A” + “B”
puts x
y= “C” << “D”
puts y

Answers:

  1. AB CD
  2. AB C
  3. AB D
  4. AB DC

24. Which gem is used to install a debugger in Rails 3?

Answers:

  1. gem ‘ruby-debug1’
  2. gem “ruby-debug19”
  3. gem “debugger19”
  4. gem “ruby-debugger”

25. What exception cannot be handled with the rescue_from method in the application controller?
e.g
class ApplicationControllers < ActionController::Base
rescue_from Exception, with: error_handler
……….
end

Answers:

  1. Server errors
  2. Record not found (404)
  3. Routing errors
  4. All of these

26. What component of Rails are tested with unit tests?

Answers:

  1. Models
  2. Controllers
  3. View helpers

27. Which of the following replaced the Prototype JavaScript library in Ruby on Rails as the default JavaScript library?

Answers:

  1. jQuery
  2. Ajax
  3. Script.aculo.us
  4. ajax-li

28. If a method #decoupage(n) is described as O(n^2), what does that mean?

Answers:

  1. The fewest number of operations it will perform is n*n.
  2. The worst case run time is proportional to the size of the square of the method’s input.
  3. The method operates by squaring the input.
  4. The return value for the method will be the length of the input squared.

29. What is green-threading?

Answers:

  1. A design pattern where a fixed-size pool of threads is shared around a program.
  2. When threads are emulated by a virtual machine or interpreter.
  3. Where programs are run across multiple CPUs.

30. Which of the following assertions are used in testing views?

Answers:

  1. assert_valid
  2. assert_select_email
  3. assert_select_encoded
  4. css_select

31. Is an AJAX call synchronous or asynchronous?

Answers:

  1. Asynchronous
  2. Synchronous
  3. Either; it is configurable

32. Which of the following commands will clear out sample users from the development database?

Answers:

  1. rake db:migrate
  2. rake db:reset
  3. rake db:rollback

33. Given below are two statements regarding the Ruby programming language:

Statement X: “redo” restarts an iteration of the most internal loop, without checking loop condition.
Statement Y: “retry” restarts the invocation of an iterator call. Also, arguments to the iterator are re-evaluated.Which of the following options is correct?

Answers:

  1. Statement X is correct, but statement Y is incorrect.
  2. Statement X is incorrect, but statement Y is correct.
  3. Both statements are correct.
  4. Both statements are incorrect.

34. Choose the best way to implement sessions in Rails 3:

A) Using CookieStore
B) By creating a session table and setting config/initializers/session_store.rb with Rails.application.config.session_store :active_record_store
C) By setting config/initializers/session_store.rb with Rails.application.config.session_store :active_record_store only

Answers:

  1. A
  2. B
  3. C
  4. B and C

35. Which of the following is the correct way to skip ActiveRecords in Rails 3?

Answers:

  1. ActiveRecords cannot be skipped.
  2. Use option -O while generating application template.
  3. Use option -SKIP_AR while generating the application template.
  4. Add new line SKIP: ACTIVERECORD in config.generators.

36. Which of the following is the default way that Rails seeds data for tests?

Answers:

  1. Data Migrations
  2. Factories
  3. Fixture Factories
  4. Fixtures

37. Which of the following options, when passed as arguments, skips a particular validation?

Answers:

  1. :validate => skip
  2. :validate => off
  3. :validate => disable
  4. :validate => false

38. What declaration would you use to set the layout for a controller?

Answers:

  1. layout ‘new_layout’
  2. set_layout ‘new_layout’
  3. @layout = ‘new_layout’

39. What is the output of the following code?

puts “aeiou”.sub(/[aeiou]/, ‘*’)

Answers:

  1. *
  2. *****
  3. *eiou
  4. nil

40. Suppose a model is created as follows:
rails generate model Sales
rake db:migrate

What would be the best way to completely undo these changes, assuming nothing else has changed in the meantime?

Answers:

  1. rails reset models; rake db:rollback
  2. rails destroy model Sales; rake db:rollback
  3. rake db:rollback; rails rollback model Sales
  4. rake db:rollback; rails destroy model Sales

41. What is the difference between :dependent => :destroy and :dependent => :delete_all in Rails?

Answers:

  1. There is no difference between the two; :dependent => :destroy and :dependent => :delete_all are semantically equivalent.
  2. In :destroy, associated objects are destroyed alongside the object by calling their :destroy method, while in :delete_all, they are destroyed immediately, without calling their :destroy method.
  3. In :delete_all, associated objects are destroyed alongside the object by calling their :destroy method, while in :destroy, they are destroyed immediately, without calling their individual :destroy methods.
  4. None of these.

42. Which of the following methods is used to check whether an object is valid or invalid?

Answers:

  1. .valid? and .invalid?
  2. valid() and invalid()
  3. isvalid and isinvalid

43. Which of the following is the correct way to rollback a migration?

Answers:

  1. A migration cannot be rollbacked.
  2. rake db:rollback STEP=N (N is the migration number to be rollbacked)
  3. rake db:migrate:reset: (N) (N is the migration number to be rollbacked)
  4. rake db:rollback migration=N (N is the migration number to be rollbacked)

44. Which of the following is the correct syntax for an input field of radio buttons in form_for?

Answers:

  1. <%= f.radio_button :contactmethod, ‘sms’ %>
  2. <%= f.radio_button_tag :contactmethod, ‘sms’ %>
  3. <%= radio_button_tag :contactmethod, ‘sms’ %>
  4. <%= f.radio_button “contactmethod”, ‘sms’ %>

45. Which is the best way to add a page-specific JavaScript code in a Rails 3 app?
<%= f.radio_button :rating, ‘positive’, :onclick => “$(‘some_div’).show();” %>

Answers:

  1. <% content_for :head do %> <script type=”text/javascript”> <%= render :partial => “my_view_javascript” </script> <% end %> Then in layout file <head> … <%= yield :head %> </head>
  2. In the application_helper.rb file: def include_javascript (file) s = ” <script type=”text/javascript”>” + render(:file => file) + “</script>” content_for(:head, raw(s)) end Then in your particular view (app/views/books/index.html.erb in this example) <% include_javascript ‘books/index.js’ %>
  3. In the controller: def get_script render :file => ‘app/assessts/javascripts/’ + params[:name] + ‘.js’ end def get_page @script = ‘/’ + params[:script_name] + ‘.js?body=1’ render page end In View <script type=”text/javascript”,:src => @script>
  4. None of these

46. In order to enable locking on a table, which of the following columns is added?

Answers:

  1. lock_version column
  2. identity column
  3. primary key column
  4. lock_optimistic column

47. If a float is added to an integer, what is the class of the resulting number? i.e. 1.0 + 2

Answers:

  1. Integer
  2. Float
  3. BigDecimal

48. In a Rails Migration, which of the following will make a column unique, and then have it indexed?

Answers:

  1. add_index :table_name, :column_name, :unique => true
  2. add_index :unique => true ,:table_name, :column_name
  3. add_index :table_name, [:column_name_a, :unique => true ,:column_name_b], :unique => true
  4. None of these

49. Which of the following will disable browser page caching in Rails?

Answers:

  1. expire_page(:controller => ‘products’, :action => ‘index’)
  2. expire_fragment(:controller => ‘products’, :action => ‘index’)
  3. expire_page_fragment(‘all_available_products’)
  4. expire_fragment(‘all_available_products’)

50. Which of the following commands will test a particular test case, given that the tests are contained in the file test/unit/demo_test.rb, and the particular test case is test_one?

Answers:

  1. $ ruby -Itest test/unit/demo_test.rb -n test_one
  2. $ ruby -Itest test/unit/demo_test.rb -a test_one
  3. $ ruby -Itest test/unit/demo_test.rb test_one
  4. $ ruby -Itest test/unit/demo_test.rb -t test_one

51. Consider the following code snippet:

def index
render
end
The corresponding index.html.erb view is as following:
<html>
<head>

<title>Ruby on Rails sample application | <%=@title%></title>
</head>
<body></body>
</html>

Which of the following options is correct?

Answers:

  1. The application will give an exception as @title variable is not defined in the controller.
  2. The HTML page will render with the title: Ruby on Rails sample application | <%=@title%>.
  3. The HTML page will render with the title: Ruby on Rails sample application |.
  4. The HTML page will render with the title: Ruby on Rails sample application.

52. Unit tests are used to test which of the following components of Ruby on Rails?

Answers:

  1. Models
  2. Controllers
  3. Views
  4. Helper classes

53. If a controller is named “Users”, what would its helpers module be called?

Answers:

  1. UsersHelper
  2. UserControllerHelper
  3. UserHelp

54. Which of the following serves as a structural skeleton for all HTML pages created?

Answers:

  1. application.html.erb
  2. default.html.erb
  3. index.html.erb
  4. layout.html.erb

55. Which of the following statements is incorrect?

Answers:

  1. Rails does not support ODBC connectivity.
  2. Rails can rollback database changes in development mode.
  3. Rails can work and connect with multiple databases.
  4. Rails database information is stored in the database.yml file.

56. What is the Singleton design pattern?

Answers:

  1. A class for which there is only ever one instance.
  2. A single feature application, intended to enhance usability by keeping things simple.
  3. A class which is never instanced, but acts as a container for methods which are used by it’s subclasses.

57. Users who are new to MVC design often ask how to query data from Views. Is this possible? And if so, is this a good idea?

Answers:

  1. It is not possible, because ActiveRecord queries cannot be made from Views.
  2. It is not possible, because Controllers do not provide enough information to the Views.
  3. It is possible, but it is a bad idea because Views should only be responsible for displaying objects passed to them.

58. What does REST stand for?

Answers:

  1. Ruby Enclosed Standard Templating
  2. Resource Standard Transfer
  3. REasonable Standards Testing
  4. REpresentational State Transfer
  5. Rights Enabled Safety Tunnel

59. With the two models Hive and Bee; when creating a belongs_to association from the Bee model to Hive, what is the foreign key generated on Bee?

Answers:

  1. hive_id
  2. hives_id
  3. ee_id

60. Which of the following is not true about log levels in Ruby on Rails?

Answers:

  1. The available log levels are: :debug, :info, :warn, :error, and :fatal, corresponding to the log level numbers from 1 up to 5 respectively.
  2. To check the current log level, the Rails.logger.level method has to be called.
  3. By default, each log is created under Rails.root/log/ and the log file name is environment_name.log.
  4. The default Rails log level is error in production mode and debug in development and test mode.

61. When a new controller named “admin2” is created, the JS and the CSS files are created in:

Answers:

  1. controllers
  2. helpers
  3. assets
  4. views

62. Select all incorrect statements regarding the Ruby Version Manager (RVM):

Answers:

  1. RVM is a command-line tool which allows developers to easily install, manage, and work with multiple Ruby environments from interpreters to sets of gems.
  2. RVM provides a revision control tool to maintain current and historical versions of files such as source code, web pages, and documentation.
  3. Test suites, rake tasks, benchmarks and gem commands can be run against multiple Ruby versions at the same time with RVM.
  4. RVM cannot automate the installation and maintenance of gems, it has to be done manually.

63. Which of the following is not a built-in Rails caching strategy used to reduce database calls?

Answers:

  1. Page Caching
  2. Fragment Caching
  3. Object Caching
  4. Query Caching

64. In a Rails application, the developmental and production configuration are stored in the:

Answers:

  1. config/environment folder
  2. public folder
  3. spec folder
  4. task folder

65. What is the convention for methods which end with a question mark? e.g. #all?, #kind_of?, directory?

Answers:

  1. They should always require arguments.
  2. They should always return a boolean value.
  3. They should always report a value of the object they’re being called on.

66. Which of the following correctly handles the currency field?

A) add_column :items, :price, :decimal, :precision => 8, :scale => 2
B) add_money :items, :price, currency: { present: false }

Answers:

  1. A
  2. B
  3. Both A and B are correct.
  4. Both A and B are incorrect.

67. How can a partial called “cart” be rendered from a controller called “ProductsController”, assuming the partial is in a directory called “shared”?

Answers:

  1. render :partial => ‘shared/cart’
  2. partial ‘shared/cart’
  3. render ‘cart’

68. What does the 4xx series of HTTP errors represent?

Answers:

  1. They are intended for cases in which the server seems to have encountered an error.
  2. They are intended for cases in which the client seems to have encountered an error.
  3. They indicate that further action needs to be taken by the user agent in order to fulfill the request.
  4. They indicate that no further action can be taken by the user agent.

69. Which of the following validations in Rails checks for null fields?

Answers:

  1. validates_presence_of
  2. validates_length_of
  3. validates_confirmation_of
  4. validates_uniqueness_of

70. Using ERB for views, what filename should be given to a partial called ‘login’?

Answers:

  1. partial_login.e
  2. _login.html.e
  3. login.html.e

71. What is output of following statements?
1) “”.nil? == “”.empty? && “”.blank? == “”.empty?
2) !””.nil? == “”.empty? && “”.blank? == “”.empty?
3) nil.nil? == nil.empty? && nil.blank? == nil.empty?
4) !””.blank? == “”.present?
5) “”.any? == !””.empty?
6) ” “.blank? == ” “.empty?

Answers:

  1. 1) false 2) true 3) NoMethodError: undefined method `empty?’ for nil:NilClass 4) true 5) NoMethodError: undefined method `any?’ for “”:String 6) false
  2. 1) false 2) NoMethodError: undefined method `empty?’ for “”:String 3) true 4) true 5) NoMethodError: undefined method `any?’ for “”:String 6) false
  3. 1) false 2) true 3) true 4) true 5) false 6) false
  4. 1) false 2) true 3) false 4) true 5) true 6) false

72. For the String class, what’s the difference between “#slice” and “#slice!”?

Answers:

  1. None, “#slice” is just an alias for “#slice!”.
  2. There is no “#slice!” method in Ruby on Rails.
  3. “#slice” returns a new object, “#slice!” destructively updates — mutates — the object’s value.

73. Which of the following controller actions (by default) are best suited to handle the GET HTTP request?

Answers:

  1. index
  2. show
  3. create
  4. edit
  5. update

74. Rails automatically requires certain files in an application. Which of the following files are automatically included without an explicit ‘require’ being necessary?

Answers:

  1. All files in lib.
  2. All files in models, views, controllers, and files named rails.rb in lib.
  3. All files in models, views, controllers, and any init.rb in plugins.
  4. Only files explicitly referenced from an initializer in config/initializers.

75. Which of the following is true about writing tests for a Ruby on Rails application?

Answers:

  1. Rails semi-automates the process of writing tests. It starts by producing skeleton test code in the background while models and controllers are being written.
  2. Running tests in Rails ensures that the code adheres to the desired functionality even after major code refactoring.
  3. Rails tests can simulate browser requests, and thus test the application’s response without having to test it through a browser.
  4. All of these.

76. What is the behavior of class variables with subclasses?

Answers:

  1. Subclasses inherit a default value for the class variable, which can then be modified for just the subclass.
  2. Class variables are shared between between all classes in the hierarchy.
  3. Class variables are not inherited.

77. There is a table named Product in a Rails application. The program is required to fetch any 5 rows where the productid is 2. Which of the following is the correct option to perform this action?

Answers:

  1. Product.find(:productid=>2), :offset=>5
  2. Product.find(:productid=>2), :limit=>5
  3. Product.find(:productid=>2), :only=>5

78. Consider the following information for a User view:

user_path named route with value “/users/”

@user = 1

Now, consider the following code in the HTML erb template:

<%= link_to user_path(@user), “Angel” %>

What will be the HTML output of this code?

Answers:

  1. a href=’/users/1′>Angel</a
  2. a href=’Angel’>/users/1</a
  3. a href=’/users/1′>/users/1</a
  4. a href=’Angel’>Angel</a

79. If a model called BlogComment is defined, what would its DB table be called?

Answers:

  1. blog_comment
  2. blogcomments
  3. blog_comments

80. What is the output of the following code?
$val = 20
print “Sample Textn” if $val

Answers:

  1. 20
  2. Sample Text
  3. No output
  4. Syntax error

81. Which of the following options will disable the rendering of the view associated with a controller action?

Answers:

  1. render :layout=>false
  2. render :layout=>nil
  3. render :layout=>disabled
  4. render :layout=>off

82. The =~ operator is used to do inline Regular Expression matching, for instance:

“function” =~ /fun/
“function” =~ /dinosaurs/

What are possible return values for the =~ matcher?

Answers:

  1. true, false
  2. “fun”, nil
  3. 1 and 0 only
  4. 0 and nil only
  5. nil, 0, and any positive integer

83. Which of the following options is used to create a form HTML in the erb files?

Answers:

  1. form_for
  2. create_form
  3. form_do
  4. form

84. Which of the following actions is fired by default when a new controller is created?

Answers:

  1. index
  2. run
  3. show
  4. login

3,020 total views, 7 views today

Upwork Web Development

Twitter Bootstrap Test 2016

Published by:

1. Which of the following LESS variables does not belong to the Navbar component?

Answers:

  1. @navbar-margin-bottom
  2. @navbar-border-radius
  3. @navbar-padding-horizontal
  4. @navbar-default-height

2. Which of the following classes will make tables scroll up horizontally when width of the view is under 768px?

Answers:

  1. .table
  2. .table-striped
  3. .table-condensed
  4. .table-responsive
  5. .table-scrollable

3. Which of the following will set a modal window to be closed when the escape key is pressed?

Answers:

  1. Setting the option “backdrop” to true
  2. Setting the option “backdrop” to static
  3. Setting the option “keyboard” to true
  4. Setting the option “escape” to true

4. Which of the following is the correct description of the given table?

<table class=”table”>

</table>

Answers:

  1. It has light padding and only horizontal dividers with an enabled hover state on table rows within a <tbody>.
  2. It has zebra-striping enabled on any table row within the <tbody>,
  3. It has light padding and only horizontal dividers.
  4. It is compacted by cutting cell padding in half.

5. Which of the following will correctly call a dialog prompt?

Answers:

  1. $(‘#myModal’).modal()
  2. $(‘#myModal’).modal({ keyboard: false })
  3. $(‘#myModal’).modal(‘show’)
  4. All of these

6. Which of the following is not a Bootstrap component?

Answers:

  1. Glyphicons
  2. Breadcrumbs
  3. Dropdowns
  4. Pivottable

7. Which of the following colors is the default hover background color of the table row?

Answers:

  1. #f9f9f9
  2. #f5f5f5
  3. #ddd
  4. #66afe9

8. How many validation styles for states of on-form controls does Bootstrap have?

Answers:

  1. 6
  2. 5
  3. 4
  4. 3

9. Which of the following are not options of the method $().tooltip(options)?

Answers:

  1. animation
  2. delay
  3. backdrop
  4. show

10. Which of the following are helper classes?

Answers:

  1. .close
  2. .badge
  3. .caret
  4. .clearfix

11. Which of the following statements is correct about using the Collapse plugin?
A) The Transitions plugin must be included.
B) The Popover plugin must be included.

Answers:

  1. Statement A is true while Statement B is false.
  2. Statement B is true while Statement A is false.
  3. Both statements are true.
  4. Both statements are false.

12. Which of the following are not Bootstrap plugins?

Answers:

  1. transition
  2. tocible
  3. tooltip
  4. boilerplate

13. Which of the following statements are correct with regards passing options?

A) Options can be passed via data attributes or JavaScript.
B) For data attributes, the option name has to be appended to option-, as in option-animation=””.
C) For data attributes, the option name has to be appended to data-, as in data-animation=””.
D) Options can be passed only via JavaScript.

Answers:

  1. A and B
  2. A and D
  3. C
  4. A and C

14. Which type of trigger cannot be used with the “delay” option to show and hide a popover?

Answers:

  1. click
  2. hover
  3. focus
  4. manual

15. What is the default amount of time delay between automatically cycling items in a carousel?

Answers:

  1. 2000
  2. 3000
  3. 5000
  4. None of these

16. Which of the following classes are contextual classes?

Answers:

  1. .success
  2. .warning
  3. .error
  4. .danger

17. Which of the following will set a modal window to not be closed on click?

Answers:

  1. Setting the option “backdrop” to true
  2. Setting the option “backdrop” to static
  3. Setting the option “keyboard” to true
  4. None of these

18. Which of the following components is used to indicate the current page’s location within a navigational hierarchy?

Answers:

  1. navs
  2. breadcrumbs
  3. pagination
  4. navbar
  5. progress bars

19. What does the following HTML code do?
<span class=”caret”></span>

Answers:

  1. It generates a close icon for dismissing content like modals and alerts.
  2. It utilizes the micro clearfix.
  3. It indicates dropdown functionality and direction.
  4. It indicates back button functionality.

20. What does the following HTML code do?

<span class=”badge”>…</span>

Answers:

  1. It indicates dropdown functionality and direction.
  2. It utilizes the micro clearfix.
  3. It highlights new or unread items.
  4. It extends the entire viewport.

5,581 total views, 22 views today

Upwork Web Development

SEO Test 2016

Published by:

1. Which of the following image file types can be indexed by Google?

Answers:

  1. TIFF
  2. RAW
  3. WEBP
  4. PNG

2. Which of the following correctly describes what are considered to be “Doorway pages”?

Answers:

  1. Pages with a permanent redirect(301) to an external page with relevant content.
  2. Pages especially designed to link partner sites.
  3. Sets of poor-quality pages where each page is optimized for a specific keyword or phrase.
  4. None of these.

3. What would be the impact of meta keywords on Google’s ranking algorithm?

Answers:

  1. Meta keywords are not used by Google.
  2. Multiple meta keywords may bring better results in SERP.
  3. Google encourages the use of a single meta keyword for each page.
  4. Multiple meta keywords get penalized by Google.

4. Which of the following best describes the practice of “Google Bowling” from a negative SEO context?

Answers:

  1. Increasing the organic search ranking of a particular website or page by pointing hundreds or thousands of links at it, using very specific anchor text.
  2. Knocking a competitor out of the search results by pointing hundreds or thousands of low trust, low quality links at their website.
  3. Making a search engine believe that another website exists at a given URL.
  4. Using words which were traditionally associated with low quality content that caused search engines to want to demote the rankings of a page.

5. Which of the following HTTP headers tells search engines when content has been changed since the site was last crawled?

Answers:

  1. If-Modified-Since
  2. Last-Modified
  3. ETag
  4. Server

6. ]Which of the following is not a valid goal type from the perspective of Google Analytics?

Answers:

  1. Destination
  2. Duration
  3. Pages/Screens per visit
  4. Conversions

7. Which of the following best describes a blog “TrackBack”?

Answers:

  1. An automated notification that a website mentioned another website; it is a built-in feature on most popular blogging software programs.
  2. A link from one website to another. It is also called an inbound link.
  3. A method used to break a page down into multiple points on the web graph by breaking its pages down into smaller blocks.
  4. It is a method for tracking visitors on a website.

8. Which of the following practices are allowable under Google Webmaster Guidelines?

Answers:

  1. Using automated programs or services to create links to a site.
  2. Links with optimized anchor text in articles or press releases distributed on other sites.
  3. Forum commenting with optimized links in the post or signature.
  4. Advertising links that use the nofollow attribute.

9. Please choose which of the following tool belongs to the Bing Search Engine?

Answers:

  1. Keyword Planner
  2. SEO Analyzer
  3. Object Browser
  4. Open Graph Debugger

10. Which of the following rich snippet formats are supported by Google? Select all that apply.

Answers:

  1. Microdata
  2. Microformats
  3. Data Highlighter
  4. RDFa

11. Which of the following is not a valid method for verifying site ownership on Google?

Answers:

  1. HTML file verification
  2. Meta tag verification
  3. Google Analytics code verification
  4. None of these.

12. Which of the following statements is true about Sitemaps?

Answers:

  1. If a site is accessible on both the www and non-www versions of its domain, a separate Sitemap for each version must be submitted.
  2. A Sitemap file must contain no more than 50,000 URLs and must be no larger than 50MB when uncompressed.
  3. A Sitemap file should be specified under the following XML namespace: xmlns=”http://www.google.com/schemas/sitemap/0.9″.
  4. Google only accepts Sitemap files in XML format.

13. Which of the following HTML attributes can be used to provide descriptive text for site assets that a search engine crawler doesn’t typically recognize?

Answers:

  1. DESC
  2. ALT
  3. TEXT
  4. ROBOT

14. Which of the following practices may improve the Domain Authority rank of an automobile trading website?

A: Submitting the website to all directories that are available.
B: Getting backlinks from auto-niche blogs.
C: Getting backlinks from fashion-niche blogs.
D: Using Robots to post on forums.
E: Manually posting at least 50 comments/day.

Answers:

  1. A, D and E
  2. B
  3. B, D and E
  4. All of above.

15. Which of the following is an example of “Cloaking”, which is considered a “black hat” SEO technique?

Answers:

  1. Sending a visitor to a different URL than the one they initially requested.
  2. Locating text behind an image.
  3. Serving a page of HTML text to search engines, while showing a page of images or Flash to users.
  4. Using CSS to position text off-screen.

16. Which is the correct usage of the Keyword Planner Tool in order to get a Phrase Match search volume for “New York hotels”?

Answers:

  1. New York Hotels
  2. “New York Hotels”
  3. [New York Hotels]
  4. ?New York Hotels

17. Which of the following statements is true about the effect of page load times to a page’s ranking in Google’s search results?

Answers:

  1. Page load times affect a page’s ranking, and is given the same importance as a page’s relevance to the search query.
  2. Page load times affect a page’s ranking, but is given lesser importance compared to a page’s relevance to the search query.
  3. Page load times do not affect a page’s ranking.
  4. Google gives up on crawling a page if its load time is greater than 5 seconds.

18. Which of the following is true about Google’s treatment of keyword density in a given page?

Answers:

  1. Keyword density is no longer being considered by Google’s search algorithms.
  2. Targeted keywords should be used as frequently as possible in a page to maximize PageRank.
  3. Artificially increasing keyword density offers diminishing returns and may be penalized for “keyword stuffing” if taken too far.
  4. None of these.

19. Which of the following examples are considered by Google as “auto-generated” content? Select all that apply.

Answers:

  1. Text translated by an automated tool without human review or curation before publishing
  2. Text generated from scraping Atom/RSS feeds or search results
  3. Text generated by the website’s content management system
  4. Text generated using automated synonymizing or obfuscation techniques

20. Which of the following are recommended actions to take when a website is penalized by an “Unnatural links to your site” Manual Action from Google? Select all that apply.

Answers:

  1. Removing old content from the site.
  2. Preventing links that violate Google’s guidelines from passing PageRank.
  3. Using the Google Webmaster Tools to disavow any offending links that the site management isn’t responsible for.
  4. Requesting reconsideration of the site from Google.

6,006 total views, 28 views today

Upwork Web Development

Node.js Test 2016

Published by:

1. Which Node.js module can be used to get the IP address of the server the program is running on?

Answers:

  1. util
  2. os
  3. dns
  4. net

2. What does the following code do?

var http = require(‘http’);
var fs = require(‘fs’);

var file = fs.createWriteStream(“file.png”);
var request = http.get(“http://path/to/file.png”, function(response) {
response.pipe(file);
});

Answers:

  1. It creates an HTTP GET request and pipes its response into a writeable file stream.
  2. It creates an HTTP GET request, and synchronously pipes its response into a writeable file stream.
  3. It creates an HTTP POST request and pipes its response into a readable file stream.
  4. It creates an HTTP POST request and pipes its response into a writeable file stream.

3. Which of the following methods can be used to write a file in Node.js?

Answers:

  1. fs.write()
  2. fs.writeFile()
  3. fs.createWriteStream()
  4. fs.writeStream()

4. Which of the following methods will print to the console without a trailing new line?

Answers:

  1. process.stdout.print()
  2. console.error()
  3. console.log()
  4. process.stdout.write()

5. Which of the following statements is true about the process object in Node.js?

Answers:

  1. It is a local object.
  2. It is an instance of the events.EventEmitter class.
  3. The process.exit(1) method ends the process with a “success” code.
  4. “process.stderr” and “process.stdout” are non-blocking if they refer to regular files or TTY file descriptors.

6. Which of the following will synchronously check if a file/directory exists?

Answers:

  1. fs.exists()
  2. fs.existsSync()
  3. fs.checkFileSync()
  4. fs.checkDirSync()

7. Which of the following methods can be used to read the contents of a directory?

Answers:

  1. fs.readdir()
  2. fs.readdirSync()
  3. fs.readDirectory()
  4. fs.readdirAsync()

8. Which of the following console commands will update all installed global packages to the latest available versions?

Answers:

  1. npm upgrade -g
  2. npm install -uga
  3. npm update -g
  4. npm version –install-latest

9. Which of the following statements are true about the child_process module in Node.js?

Answers:

  1. It is not possible to stream data through a child process’ stdin, stdout, and stderr in a fully non-blocking way.
  2. Child processes always have two streams associated with them.
  3. “require(‘child_process’).spawn()” can be used to create a child process.
  4. “require(‘child_process’).fork()” can be used to create a child process.

10. Which array contains the command line arguments in Node.js?

Answers:

  1. process.argv
  2. args.argv
  3. arguments.argv
  4. env.argv

11. Which of the following will copy a file in Node.js?

Answers:

  1. var fs = require(‘fs’); fs.createReadStream(‘test.file’).pipe(fs.createWriteStream(‘newFile.file’));
  2. var fs = require(‘fs’); fs.createReadBuffer(‘test.file’).pipe(fs.createWriteBuffer(‘newFile.file’));
  3. var fs = require(‘file’); fs.createFileReader(‘test.file’).pipe(fs.createFileWriter(‘newFile.file’));
  4. var fs = require(‘fs’); fs.createReadBuffer(‘test.file’).stream(fs.createWriteBuffer(‘newFile.file’));

12. Which of the following statements are true about the module.exports object in Node.js?

Answers:

  1. It is the object that gets returned from a require() call.
  2. It can be assigned in a callback.
  3. Assigning an export object to module.exports will rebind the local exports variable.
  4. None of these.

13. Which of the following will open a file, then read its contents one line at a time?

Answers:

  1. fs.readFileStream()
  2. fs.readFile()
  3. fs.createReadStream()
  4. fs.createFileStream()

14. Which of the following NPM commands will install both dependencies and devDependencies of a given project?

Answers:

  1. npm install
  2. npm install –dev
  3. npm install –production
  4. None of these

15. Which of the following statements is true about the console Object in Node.js?

Answers:

  1. “console.log” can take only a single argument.
  2. “console.log” prints to stdout without a newline.
  3. Its functions are synchronous when the destination is a terminal or a file, and and asynchronous when it’s a pipe.
  4. Its functions are asynchronous when the destination is a terminal or a file, and and synchronous when it’s a pipe.

16. What does the following command do?

npm view <package-name> version

Answers:

  1. It shows the version of the package installed globally.
  2. It shows the version of the package installed locally.
  3. It shows the version of the package that is cached.
  4. It shows the latest version of the package that is available.

17. Which of the following can be used to get the currently running script’s path in Node.js?

Answers:

  1. __filename
  2. os.tmpdir()
  3. path.dirname()
  4. path.basename()

18. Which of the following can be used to access the environment variable, “ENV_VARIABLE” in Node.js?

Answers:

  1. process.env.ENV_VARIABLE
  2. process.argv.ENV_VARIABLE
  3. process.env.var.ENV_VARIABLE
  4. process.environment.ENV_VARIABLE

19. What does process.argv[1] contain?

Answers:

  1. node
  2. The file path of the JavaScript file.
  3. The first command line argument.
  4. The second command line argument.

20. Which of the following command-line arguments to “npm install” will allow an NPM package’s binaries to be run outside the project folder?

Answers:

  1. -g
  2. –global
  3. -l
  4. –link

3,244 total views, 7 views today

Upwork Web Development

Magento Test 2016

Published by:

1. Which of the following will display a customer’s TAX/VAT number?

Answers:

  1. $taxvat = $order[‘customer_taxvat’];
  2. $order->getData(‘customer_taxvat’);
  3. $order->getQuote()->getCustomerTaxvat();
  4. $order->getData()->getCustomerTaxvat();

2. Why does the error, “front controller reached 100 router match iterations”, occur?

Answers:

  1. There is an error in the code.
  2. Some modules failed to load.
  3. Router references were set incorrectly.
  4. .htacces is blocking URLs.

3. Which of the following will sort products in the catalog by the date they were added?

Answers:

  1. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘created_at’ => Mage::helper(‘catalog’)->__(‘Date’)
  2. Under “app/code/core/mage/catalog/model/resource/eav/mysql4/product/collection.php”, add this value to the $options array: $this->getSelect()->order(“e.entity_id desc”);
  3. Under “app/code/core/Mage/Catalog/Model/Config.php”, add this value to the $options array: ‘sort_by’ => Mage::helper(‘catalog’)->__(‘Date’)
  4. It’s not possible to sort products in the catalog by date.

4. Is it possible to trigger an event after an order has been set to “processing”?

Answers:

  1. Yes, by using a custom module.
  2. Yes, by registering an event.
  3. No, since it’s a security threat.
  4. No, since no additional action can be added at this stage.

5. Which of the following code samples will get all products sorted by ‘position’, assuming ‘position’ is of a numeric type?

Answers:

  1. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToSort(‘position’, ‘ASC’); ->load();
  2. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addOrder(‘position’, ‘ASC’); ->load();
  3. function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->load(); usort($products, “cmp”);
  4. function mySortByPosition($a, $b) { if ($a[‘position’] == $b[‘position’]) { return 0; } return ($a[‘position’] < $b[‘position’]) ? -1 : 1; } $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘*’) ->addSorter(mySortByPosition) ->load();

6. Which of the following statements are correct about Magento quotes?

Answers:

  1. Quotes are offers to the user, which if the user accepts get converted into orders.
  2. The lifetime of the quote cannot be controlled.
  3. Quotes don’t deal with metadata about the store.
  4. Quotes are not related to order payment and shipping method information.

7. Select which method will register observers/hooks to events in Magento:

Answers:

  1. Mage::registerObserver(‘<EventNameToHook>’,’MyClass::observerFunction’);
  2. Using the option in the Magento Admin panel: System > Configuration > Advanced > Developer > Register Observer
  3. Registering observers using the XML layout of the module: <events> <EVENT_TO_HOOK> <observers> <module> <type>singleton</type> <class>company_module_model_observer</class> <method>methodToCall</method> </module> </observers> </EVENT_TO_HOOK> </events>
  4. Mage::registerObserver(‘myglobalobserver’); Function myglobalobserver($event,$args){ switch($event){ case ‘event1’: processevent1($args); break; case ‘event2’: processevent2($args); break; } }

8. Magento has the ability to run multiple stores from the same database. After adding the new store from System -> Manage Store, what is the correct code to add to the htaccess file to make Magento automatically load the new store?

Answers:

  1. RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourOldStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
  2. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
  3. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]
  4. RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ – [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ – [E=MAGE_RUN_TYPE:website]

9. Which of the following will save a custom session variable in Magento?

Answers:

  1. $_SESSION[‘name’] = ‘frontend’;
  2. $session = Mage::getSingleton(“core/session”, array(“name”=>”frontend”)); $session->setData(“device_id”, 4);
  3. Mage::getSingleton( ‘customer/session’ )->setValue( ‘name’, array( 1, 2, 3 ) );
  4. None of the above

10. Which of the following will get information (‘customer_referrer_id’) from a currently logged-in admin user?

Answers:

  1. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
  2. $collection->addAttributeToSelection(‘customer_referrer_id’, $referrer_id); $referrer_id = Mage::getSingleton(‘admin/session’)->getUser()->getId();
  3. $collection->addAttributeToFilter(‘customer_referrer_id’, $referrer_id); $referrer_id = getSingleton(‘admin/session’)->getUser()->getId();
  4. None of these.

11. Which of the following will display a product’s thumbnail?

Answers:

  1. $product->hasThumbnail()) $product->setThumbnail($product->getImage());
  2. <img src=”<?php echo $this->helper(‘catalog/image’)->init($_item->getProductThumbnail(), ‘image’)->resize(50); ?>” alt=”<?php echo $_item->getName() ?>” />
  3. <img src=”<?php echo $_item->getProduct()->getThumbnailUrl() ?>” alt=”<?php echo $_item->getName() ?>” />
  4. <img src=”<?php echo $this->helper(‘catalog/image’)->init($_item->getProduct(), ‘thumbnail’)->resize(50); ?>” alt=”<?php echo $_item->getName() ?>” />

12. Consider the following code:
<block type=”A/B” name=”root” output=”toHtml” template=”example/view.phtml”>
What is the meaning of A/B?

Answers:

  1. “Module’s alias” / “Class name relative to the alias”
  2. “Controller’s Alias” / “Class name relative to the alias”
  3. “Controller’s Class” / “Method Name”
  4. “Method Name” / “Parameter”

13. Which of the following code samples will display a list of both active and inactive sub-categories of the current category?

Answers:

  1. <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel(‘catalog/category’)->getCategories($_category->entity_id); $helper = Mage::helper(‘catalog/category’); foreach ($collection as $cat): if($_category->getIsActive()): $cur_category = Mage::getModel(‘catalog/category’)->load($cat->getId()); ?> <a href=”<?php echo $helper->getCategoryUrl($cat);?>”> <?php echo $cat->getName();?> </a> <?php endif; endforeach; ?>
  2. <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel(‘catalog/category’)->getCategories($_category->entity_id); $helper = Mage::helper(‘catalog/category’); foreach ($collection as $cat): $cur_category = Mage::getModel(‘catalog/category’)->load($cat->getId()); ?> <a href=”<?php echo $helper->getCategoryUrl($cat);?>”> <?php echo $cat->getName();?> </a> <?php endforeach; ?>
  3. <?php $_helper = Mage::helper(‘catalog/category’); $_categories = $_helper->getStoreCategories(); if (count($_categories) > 0): foreach($_categories as $_category): ?> <a href=”<?php echo $_helper->getCategoryUrl($_category) ?>”> <?php echo $_category->getName() ?> </a> <?php endforeach; endif; ?>
  4. None of the above.

14. Which of the following will return a visitor’s UserAgent information?

Answers:

  1. Mage::helper(‘core/http’)->getHttpUserAgent()
  2. Mage::helper(‘core/mage’)->getHttpUserAgent()
  3. Mage::helper(‘core/mage’)->getHttpAgent()
  4. Mage::helper(‘core/http’)->getHttpUserServer()

15. How can account navigation links be changed?

Answers:

  1. Using an XML file to define the template
  2. Using a third party module
  3. Either using an XML file to define the template, or using a third party module
  4. None of these.

16. Which of the following will correctly add a custom event in Magento?

Answers:

  1. Mage::registerEvent
  2. Mage::dispatchEvent
  3. Mage::addAction
  4. Mage::registerObserverEvent

17. Which XML file(s) should be checked when the following Magento error occurs during installation?
“PHP Extensions “0” must be loaded”

Answers:

  1. config.xml in app/code/core/Mage/Install/etc
  2. install.xml in app/code/core/Mage/Install/etc
  3. extensions.xml in app/code/core/Mage/Install/etc
  4. None of these

18. Which of the following will set a template only if a particular module is disabled in Magento?

Answers:

  1. <action method=”setTemplate” ifconfig=”advanced/modules_disable_output/Myname_Mymodule”> <template>mytemplate.phtml</template> </action>
  2. Using File: app/code/core/Mage/Core/Model/Layout.php protected function _generateAction($node, $parent) { if (isset($node[‘ifconfig’]) && ($configPath = (string)$node[‘ifconfig’])) { if (!Mage::getStoreConfigFlag($configPath)) { return $this; } }
  3. <action method=”setTemplate”> <template helper=”mymodule/myhelper/switchTemplateIf”/> </action>
  4. None of these.

19. Which of the following XML files will remove an item from Magento’s admin panel navigation?

Answers:

  1. <?xml version=”1.0″ ?> <config> <menu> <xmlconnect> <disabled>1</disabled> </xmlconnect> </menu> </config>
  2. <?xml version=”1.0″ ?> <config> <menu> <xmlconnect> <hide>1</hide> </xmlconnect> </menu> </config>
  3. <?xml version=”1.0″ ?> <config> <menu> <xmlconnect> <delete>1</delete> </xmlconnect> </menu> </config>
  4. Items under the Magento admin panel can’t be removed.

20. Which of the following will get active store information (such as the store’s name) in Magento?

Answers:

  1. Mage::app()->getStore();
  2. Mage::app()->getStoreId();
  3. Mage::app()->getName();
  4. None of the above

21. What is the best way to store session values in Magento?

Answers:

  1. $myValue=’Hello world’; Mage::getSingleton( ‘customer/session’ )->setMyValue($myValue);
  2. $myValue=’Hello world’; Mage::getSingleton( ‘core/session’ )->setMyValue($myValue);
  3. $myValue=’Hello world’; Mage::getSingleton( ‘core/variable’ )->setMyValue($myValue);
  4. $myValue=’Hello world’; $_SESSION[‘MyValue’] = $myValue;

22. The “Suspected Fraud” Order status is grouped under which state?

Answers:

  1. Processing state
  2. Payment Processing state
  3. Pending shipment state
  4. Payment Review state

23. Which of the following needs to be edited to input and display the order attributes in Magento?

Answers:

  1. /app/design/adminhtml/default/default/template/sales/order/view/info.phtml
  2. /app/design/adminhtml/default/default/template/salesext/edit_form.phtml
  3. /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
  4. Both /app/design/adminhtml/default/default/template/sales/order/view/info.phtml and /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php

24. When using a custom Magento logo as the default logo for transactional emails; which of the following is the correct way for the logo to be maintained even after Magento system upgrades?

Answers:

  1. Replace the logo in the base theme skin directory.
  2. Create a new theme and replace the new logo in the skin directory.
  3. Update the logo in all transactional emails.
  4. Create a new theme and place the new logo, named as “logo_email.png”, in the skin directory.

25. When does the following error occur? “Not all products are available in the requested quantity”

Answers:

  1. When the products are out of stock, but the cart still proceeded to checkout
  2. When the products are in stock, but not in the cart
  3. When no products are available
  4. None of these.

26. Which of the following will change the order of existing blocks via XML?

Answers:

  1. <reference name=”parent.block.name”> <action method=”unsetChild”><alias>child_block_alias</alias></action> <action method=”insert”><blockName>child.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>
  2. <reference name=”parent.block.name”> <action method=”insert”><blockName>child.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> <action method=”unsetChild”><alias>child_block_alias</alias></action> </reference>
  3. <reference name=”child.block.name”> <action method=”unsetParent”><alias>child_block_alias</alias></action> <action method=”insert”><blockName>parent.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>
  4. It is not possible to edit the order of existing blocks.

27. Which of the following is the minimum memory requirement for running a Magento site?

Answers:

  1. at least 128MB
  2. at least 256MB
  3. at least 512MB
  4. over 512MB

28. How can the checkout process be skipped for downloadable products in Magento?

Answers:

  1. The checkout step cannot be skipped in Magento.
  2. Downloadable products automatically do not require checkout.
  3. There is an option in the admin panel to skip the checkout step for downloadable products.
  4. Magento does not support downloadable products.

29. Which of the following conditions must be met in order to successfully run a Magento install script?

Answers:

  1. The install script should be placed in MODULE/sql/RESOURCES_KEY/SCRIPT_NAME.
  2. The install script should be named using the convention, mysql4-install-MODULE_VERSION.php
  3. The module version in config.xml and in the install script file name must be same.
  4. All of these.

30. When migrating a Magento store to a new server, after moving the files and the database, where must the database access details be configured for the new server?

Answers:

  1. Database table ‘core_config_data’
  2. config.inc file at magento root
  3. app/etc/config.xml
  4. app/etc/local.xml

31. What is the best way to create global variables which can be used everywhere in Magento?

Answers:

  1. Creating a empty module and adding a system.xml file to it
  2. Using the Magento Admin panel: System > Custom Variables > create a new custom variable
  3. Via a Magento Session $myValue = ‘Hello World’; Mage::getSingleton(‘core/session’)->setMyValue($myValue);
  4. $myValue = ‘Hello World’; Mage::getModel(‘core/variable’)->addMyValue($myValue);

32. The browser is ignoring the file referred on the code below:
<link src=”http://siteurl.com/theme/skin/frontend/default/mytheme/css/colors.css.php” rel=”stylesheet” type=”text/css”>

Assume that this is a PHP file that is used as a stylesheet in a Magento extension.

Which of the following choices will make the browser apply the stylesheet?

Answers:

  1. There is no solution; a PHP file cannot be used as a stylesheet.
  2. Use the “href” attribute instead of “src” to specify the file’s location, as in: <link href=”http://siteurl.com/theme/skin/frontend/default/mytheme/css/colors.css.php” rel=”stylesheet” type=”text/css”>
  3. Call a static CSS file instead of using a PHP file as a stylesheet.
  4. Send a valid Content-Type HTTP header, as in: header(“content-type: text/css”);

33. What is the recommended way to override/extend Magento core functionality?

Answers:

  1. Directly edit the core files of Magento with proper commenting.
  2. Mage::registerOverride(‘CoreClassName’,’CoreFunctionName’,’MyClassName’,’MyFunctionname’);
  3. Copy the original Magento core file to the app/code/local folder and customize that file.
  4. Create extended versions of core files in their own folder with extension information. app/code/core/Mage/Cms/Model/Page.php app/code/core/Mage/Cms/Model/Page.1.php App/code/core/Mage/Cms/Model/Page.2.php

34. An observer in Magento is defined as a:

Answers:

  1. Method
  2. Class
  3. Event
  4. None of these.

35. What is the difference between “Flush Magento Cache” and “Flush Cache Storage” in the Magento Cache Management System?

Answers:

  1. “Flush Magento Cache” removes “/tmp/” folder’s cache only, while “Flush Cache Storage” clears everything.
  2. “Flush Cache Storage” removes “/tmp/” folder’s cache only, while “Flush Magento Cache” clears everything.
  3. “Flush Magento Cache” and “Flush Cache Storage” are equivalent; they work the same way.
  4. None of the above.

36. Which of the following will get a list of products belonging to a specific category within a view file?

Answers:

  1. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
  2. {{block type=”catalog/product_list” category_id=”7″ template=”catalog/product/list.phtml”}}
  3. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addFilter($category);
  4. $productCollection = Mage::getModel(‘catalog/product_collection’) ->addCategoryFilter($category);

37. Assuming that trees must have categories as parents and products as children, and that there are no sub-categories under main categories, which of the following code samples will get the full catalog tree?

Answers:

  1. $categories = Mage::getModel(‘catalog/category’) ->getCollection(); foreach ($categories as $category) { print $category->getName(); $categoryDetails = Mage::getModel(‘catalog/category’)->load($category->getId()); $products = $categoryDetails->loadChildProducts(); foreach($products as $product){ Print $product->getName(); } }
  2. $categories = Mage::getModel(‘catalog/category’) ->getCollection(); foreach ($categories as $category) { print $category->getName(); $products = Mage::getModel(‘catalog/category’) ->load($category->getId()) ->getProductCollection(); foreach($products as $product){ Print $product->getName(); } }
  3. $categories = Mage::getModel(‘catalog/category’) ->getCollection() ->setLoadProducts(true); foreach ($categories as $category) { print $category->getName(); foreach($category->getProducts() as $product){ print $product->getName(); } }
  4. $products = Mage::getModel(‘catalog/product’) ->getCollection(); foreach ($products as $product) { print $product->getCategory()->getName(); print $product->getName(); }

38. Which of the following will call a static block inside one of Magento’s template files?

Answers:

  1. $this->setBlockId(‘my_static_block_name’)->toHtml()
  2. $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
  3. $this->createBlock(‘cms/block’)->setBlockId(‘my_static_block_name’)->toHtml()
  4. $this->getLayout()->createBlock(‘cms/block’)->BlockId(‘my_static_block_name’)->toHtml()

39. Which of the following Magento objects will be created during checkout?

Answers:

  1. sales/payment
  2. sales/tax
  3. sales/order
  4. sales/quote

40. Assuming the following choices are to be added to a custom theme layout’s local.xml file; which of the following will move the “related products” box in the “product details page” to the bottom center column?

Answers:

  1. <catalog_product_view> <reference name=”right”> <action method=”unsetChild”> <block>catalog.product.related</block> </action> </reference> <reference name=”content”> <action method=”insert”> <block>catalog.product.related</block> </action> </reference> </catalog_product_view>
  2. <catalog_product_view> <reference name=”right”> <action method=”unsetChild”> <block>catalog.product.related</block> </action> </reference> <reference name=”product.info”> <action method=”insert”> <block>catalog.product.related</block> <after>1</after> </action> </reference> </catalog_product_view>
  3. <catalog_product_view> <reference name=”right”> <action method=”unsetChild”> <block>catalog.product.related</block> </action> </reference> <reference name=”product.info”> <action method=”insert”> <block>catalog.product.related</block> <after>0</after> </action> </reference> </catalog_product_view>
  4. None of the above.

41. What is the correct method to add an external JavaScript file to Magento’s local.xml file?

Answers:

  1. <action method=”addScript”><script>jquery/jquery.js</script></action>
  2. <action method=”addCss”><script>jquery/jquery.js</script></action>
  3. <action method=”addJS”><script>jquery/jquery.js</script></action>
  4. None of the above

42. Which of the following will check whether the currently logged-in customer ever placed an order at the Magento store?

Answers:

  1. $order = Mage::getModel(‘sales/order’)->getCollection() ->addAttributeToFilter(‘customer_id’,$session->getId()) ->getFirstItem(); if ($orders->getSizeValue()) { }
  2. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToSelect(‘*’) ->addFieldToFilter(‘entity_id’, $customer->getEntityId()); if ($orders->getSize()) { }
  3. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToFilter(‘customer_id’, $customer->getId()); if ($orders->getValue()) { }
  4. $orders = Mage::getResourceModel(‘sales/order_collection’) ->addFieldToSelect(‘*’) ->addFieldToFilter(‘customer_id’, $customer->getId()); if ($orders->getSize()) { }

43. How can a new column be added in sales_flat_order to save a custom value in Magento?

Answers:

  1. By adding column name in Model
  2. By adding column name in Controller
  3. By adding column name in Block
  4. By defining column name in Block and table

44. Which of the following will get the order increment ID in Magento?

Answers:

  1. $order = Mage::getSingleton(‘sales/order’)->getLastOrderId(); $lastOrderId = $order->getIncrementId();
  2. $orderId = $this->getOrderId();
  3. $order = Mage::getModel(‘sales/order’); $order->load(Mage::getSingleton(‘sales/order’)->getLastOrderId()); $lastOrderId = $order->getIncrementId();
  4. None of these.

45. Which of the following will get the tax amount on a page in Magento?

Answers:

  1. Mage::helper(‘checkout’)->getQuote()->getShippingAddress()->getData(‘tax_amount’);
  2. $totalItemsInCart = Mage::helper(‘checkout/cart’)->getItemsCount(); $totals = Mage::getSingleton(‘checkout/session’)->getQuote()->getTotals(); $subtotal = round($totals[“subtotal”]->getValue()); $grandtotal = round($totals[“grand_total”]->getValue()); >if(isset($totals[‘discount’]) && $totals[‘discount’]->getValue()) { $discount = round($totals[‘discount’]->getValue()); } else { $discount = ”; } if(isset($totals[‘tax’]) && $totals[‘tax’]->getValue()) { $tax = round($totals[‘tax’]->getValue()); } else { $tax = ”; }
  3. $order = Mage::getModel(‘sales/order’)->load($order_id); $items = $order->getAllItems(); $subtotals = array(); foreach ($items as $_item) { if (array_key_exists($subtotals[$_item->getTaxClassId()])) { $subtotals[$_item->getTaxClassId()] += $_item->getRowTotal(); } else { $subtotals[$_item->getTaxClassId()] = $_item->getRowTotal(); } }
  4. <?php $order = Mage::getModel(‘sales/order’)->loadByIncrementId($this->getOrderId()); $data = $order->getData(); ?>

46. Which of the following will retrieve a list of all shipping methods in Magento?

Answers:

  1. public function toOptionArray($isMultiSelect = false) { $methods = Mage::getSingleton(‘shipping/config’)->getActiveCarriers(); $options = array(); foreach($methods as $_code => $_method) { if(!$_title = Mage::getStoreConfig(“carriers/$_code/title”)) $_title = $_code; $options[] = array(‘value’ => $_code, ‘label’ => $_title . ” ($_code)”); } if($isMultiSelect) { array_unshift($options, array(‘value’=>”, ‘label’=> Mage::helper(‘adminhtml’)->__(‘–Please Select–‘))); } return $options; }
  2. $salesQuoteRate = Mage::getModel(‘sales/quote_address_rate’)->load($rate_id); if($salesQuoteRate){ echo ‘<br/>CODE : ‘.$salesQuoteRate->getCode(); echo ‘<br/>METHOD : ‘.$salesQuoteRate->getMethod(); }
  3. $iOrderId = Mage::getSingleton(‘checkout/session’)->getLastRealOrderId(); $oOrder = Mage::getModel(‘sales/order’)->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription();
  4. echo Mage::getSingleton(‘checkout/session’)->getQuote()->getShippingAddress()->getShippingMethod();

47. Which of the following will list all products from a particular category?

Answers:

  1. $products = Mage::getModel(‘catalog/category’)->load($category_id) ->getProductCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
  2. $productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addCategoryFilter($category);
  3. $products = Mage::get((‘catalog/category’)->load($category_id) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addAttributeToFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;
  4. $products = Mage::getModel(‘catalog/category’)->load($category_id) ->getProduct() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘status’, 1) ->addAttributeToFilter(‘visibility’, 4) ->addFilter(‘special_price’, array(‘neq’ => “”)) ->setOrder(‘price’, ‘ASC’) ;

48. By default, Magento allows 3 themes to be loaded at any time. In what order are they loaded? (1 being first and 3 being last)

Answers:

  1. 1 Custom default theme 2 Magento base theme 3 Custom non-default theme
  2. 1 Magento base theme 2 Custom default theme 3 Custom non-default theme
  3. 1 Custom non-default theme 2 Custom default theme 3 Magento base theme
  4. None of the above

49. What is the correct method for calling a single product inside a static block?

Answers:

  1. {{block type=”media/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
  2. {{block type=”catalog/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
  3. {{block type=”all/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}
  4. {{block type=”categories/product_single” product_id=”1″ template=”catalog/product/singleproduct.phtml”}}

50. Which of the following code samples will link a configurable product’s images to its constituent simple products, in the product details page?

Answers:

  1. $_parentIdArray = Mage::getModel(‘catalog/product_type_configurable’)->getParentIdsByChild($_product->getId()); if(sizeof($_parentIdArray)==1 && Mage::getModel(‘catalog/product’)->load($_parentIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_parentIdArray[0]); }
  2. $_childIdArray = Mage::getModel(‘catalog/product_type_configurable’)->getChildIds($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel(‘catalog/product’)->load($_childIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_childIdArray[0]); }
  3. $_parentIdArray = Mage::getModel(‘catalog/product’)->getIdsByChild($_product->getId()); if(sizeof($_parentIdArray) >= 1 && Mage::getModel(‘catalog/product’)->load($_parentIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_parentIdArray[0]); }
  4. $_childIdArray = Mage::getModel(‘catalog/product’)->getChildIdsByParent($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel(‘catalog/product’)->load($_childIdArray[0])->getTypeId() == ‘configurable’){ $_product = Mage::getModel(‘catalog/product’)->load($_childIdArray[0]); }

51. Which of the following will add a new custom block on the product details page after the media block, using a custom module?

Answers:

  1. <reference name=”product.info”> <block type=”mymodule/folder_class” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference>
  2. <reference name=”product.info”> <block type=”mymodule/folder_class” after=”media” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference> <?php echo $this->getChildHtml(‘mymodule_folder_class’);?>
  3. <reference name=”product.info”> <block type=”mymodule/folder_class” after=”media” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference> <?php echo $this->getChildHtml(‘mymodule_class’);?>
  4. None of the above.

52. Which of the following methods can be used add a new attribute to all products?

Answers:

  1. Using XML layout files
  2. By creating a new field in the database table named ‘catalog_attributes’
  3. Via the Magento Admin panel (Manage Attributes)
  4. By creating a new module

53. Assuming a left column is going to be added, which of the following are possible values of the block type in the code below?

<block type=”” name=”left” as=”left” template=”page/html/left.phtml” />

Answers:

  1. catalog/navigation
  2. core/text_list
  3. page/template_container
  4. page/html

54. What is the difference between the isSaleable() and isAvailable() functions?

Answers:

  1. isAvailable() is used to decide whether to show an “Add to Cart” button or not, while isSaleable() is used to decide whether to display the product as “in stock” or “out of stock”.
  2. There is no difference between the two functions.
  3. isSaleable() checks if the product’s type can be sold, while isAvailable() checks if the product itself can be sold.
  4. isAvailable() is used to decide whether to display the product as “in stock” or “out of stock”, while isSaleable() is used to decide whether to show an “Add to Cart” button or not.

55. Which of the following Magento classes should be used for adding custom duties/taxes to a quote during the checkout process?

Answers:

  1. Mage_Sales_Model_Quote_Item_Option
  2. Mage_Sales_Model_Quote_Address_Total_Abstract
  3. Mage_Sales_Model_Quote_Item
  4. Mage_Sales_Model_Quote_Payment

56. Select which conditions can be checked to track down a product that is not showing in a category page.

Answers:

  1. Product visibility must be “Listed”;
  2. Product must be enabled;
  3. Stock and quantity must be greater than 0;
  4. If using multiple websites, check which website the product points to;

57. How can programmatically added bundle products be shown in Magento’s front-end?

Answers:

  1. By re-indexing
  2. By using the following codes: Mage::register(‘product’, $product); Mage::register(‘current_product’, $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true);
  3. By using the following: 1. setBundleOptionsData() 2. setBundleSelectionsData() 3. setCanSaveBundleSelections(true)
  4. It is not possible to show programmatically added bundle products in the front-end.

58. Which of the following is the correct method to use to check if custom options were added to a product?

Answers:

  1. $product->hasCustomType();
  2. $product->hasCustomOptions();
  3. $product->hasOptions();
  4. $product->hasOptionsType();

59. Which of the following Events are triggered when the payment has been confirmed?

Answers:

  1. checkout_onepage_controller_success_action
  2. checkout_payment_confirmed
  3. sales_order_payment_pay
  4. payment_confirmed_action

60. Which of the following statements are true regarding custom options for products in Magento?

Answers:

  1. Custom options are only stored on the quote as option IDs and values.
  2. Every time the options are rendered, they are reloaded from the database.
  3. If the values for custom options are modified, they would need to be saved, and that will set them for all users.
  4. None of these.

61. Which of the following will get a specific product attribute from its product ID without loading the whole product?

Answers:

  1. Mage::getResourceModel(‘catalog/product’)->getAttributeRawValue($productId, ‘attribute_code’, $storeId);
  2. $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product);
  3. $object->getData($this->getAttribute()->getAttributeCode());
  4. None of the above

62. Which of the following will display only ‘configurable’ products in a page?

Answers:

  1. $_productCollection = $this ->getLoadedProductCollection() ->addAttributeToFilter(‘type_id’,’configurable’);
  2. <?php if($_product->getTypeId() == “configurable”): ?> <?php $_configurable = $_product->getTypeInstance()->getUsedProductIds(); ?> <?php foreach ($_configurable as $_config): ?> <?php $_simpleproduct = Mage::getModel(‘catalog/product’)->load($_config); ?> <?php //Magic php with a $_simpleproduct. ?> <?php endforeach; ?> <?php endif; ?>
  3. $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data[‘type_id’] == ‘configurable’) { … } }
  4. $collectionConfigurable = Mage::getResourceModel(‘catalog/product_collection’) ->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));

63. Which of the following will return the absolute path for a product image in Magento?

Answers:

  1. A) echo $_product->getImageUrl();
  2. B) echo $_product->getImagePath();
  3. C) Both A and B
  4. D) None of the above

64. Assuming that a column needs to be added under Catalog >> Manage Products in Magento, which file will need to be edited?

Answers:

  1. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php
  2. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php
  3. app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php
  4. A custom column cannot be added under Catalog >> Manage Products.

65. Select the correct sequence of methods to use to create a bundle product in Magento.

Answers:

  1. setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelections
  2. setBundleOptionsData,setCanSaveBundleSelections,setBundleSelectionsData,setAffectBundleProductSelections
  3. setBundleOptionsData, setBundleSelectionsData, setAffectBundleProductSelections, saveBundleOptions
  4. setBundleOptionsData, setCanSaveBundleSelections,setSelectionCollection, setAffectBundleProductSelections

66. Which of the following code samples will display products from a certain category in random order?

Answers:

  1. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->order(‘rand()’);
  2. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort() ->addAttributeToSelect(‘*”) ->addCategoryFilter(Mage::getModel(‘catalog/category’)->load()); $products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));
  3. $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort(‘id’, ‘RAND()’) ->addAttributeToSelect(‘small_image’) ->addCategoryFilter(Mage::getModel(‘catalog/category’) ->load($catId));
  4. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->rand();

67. For data security and privacy reasons, Magento uses two cookies for frontend session.
All I know is that one of them is being set in Mage_Core_Model_Cookie::set(..) and the other one in Zend_Session::expireSessionCookie().
Why does Magento use the Zend_Session::expireSessionCookie()?

Answers:

  1. Because it is necessary for magento and you must use that session.
  2. Because Magento relies heavily on the Zend Framework as the underpinning and it will be able to be ignored.
  3. Because Magento relies heavily on the Zend Framework as the underpinning and I must use that for frontend session without condition.
  4. It is the vestigial code, so I was able to delete the Zend cookie without any apparent deleterious effects

68. Which of the following will add a static block on the site’s home page in Magento?

Answers:

  1. <cms_index_index> <reference name=”content”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_index_index>
  2. <?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()){ ?> <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘Your_StaticBlock_Id’)->toHtml();?> <?php } ?>
  3. <cms_index> <reference name=”content”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_index>
  4. <cms_index> <reference name=”homepage”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_index>

69. Assuming that product images need to be imported from a product import file, which folder should the images be uploaded to, before running the import profile routine?

Answers:

  1. <MAGENTOROOT>/media/
  2. <MAGENTOROOT>/media/import/
  3. <MAGENTOROOT>/import/
  4. <MAGENTOURL>/

70. Which of the following methods will allow access to a Magento session from other sites on different subdomains?

Answers:

  1. subdomain.domain.com needs to be entered in Magento’s Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains.
  2. subdomain.domain.com needs to be entered in Magento’s app/code/core/Mage/Core/Model/Config.php file, to make session cookies available to other subdomains.
  3. Allowing access to session cookies from other subdomains is not part of Magento’s core functionality, but it can be achieved using extensions.
  4. It is not possible to access a Magento site’s cookies on a different subdomain.

71. Which of the following code samples will detect if the account being checked on the front-end is an admin account?

Answers:

  1. <?php require_once ‘app/Mage.php’; ini_set(‘display_errors’,true); Mage::setIsDeveloperMode(true); umask(0) ; Mage::app(); //get the admin session Mage::getSingleton(‘core/session’, array(‘name’=>’adminhtml’)); //verify if the user is logged in to the backend if(Mage::getSingleton(‘admin/session’)->isLoggedIn()){ echo “Admin Logged in with following details”.'<br>’; echo “Admin Username: – “.Mage::getSingleton(‘admin/session’)->getData(‘user’)->getUsername().'<br>’; echo “Admin Encrypted Password: – “.Mage::getSingleton(‘admin/session’)->getData(‘user’)->getPassword().'<br>’; } else { echo “You need to be logged in as an admin.”; } ?>
  2. <?php Mage::getSingleton(‘core/session’, array(‘name’=>’adminhtml’) ); $adminsession = Mage::getSingleton(‘admin/session’, array(‘name’=>’adminhtml’)); if($adminsession->isLoggedIn()) { echo “<br>”. “Admin Logged in”; } else { echo “<br>”. “Admin NOT logged in”; } ?>
  3. $sesId = isset($_COOKIE[‘adminhtml’]) ? $_COOKIE[‘adminhtml’] : false ; $session = false; if($sesId){ $session = Mage::getSingleton(‘core/resource_session’)->read($sesId); } $loggedIn = false; if($session) { if(stristr($session,’Mage_Admin_Model_User’)) { $loggedIn = true; } } var_dump($loggedIn);
  4. $userArray = Mage::getSingleton(‘admin/session’)->getData(); $user = Mage::getSingleton(‘admin/session’); echo $userId = $user->getUser()->getUserId(); echo $userEmail = $user->getUser()->getEmail(); echo $userFirstname = $user->getUser()->getFirstname(); echo $userLastname = $user->getUser()->getLastname(); echo $userUsername = $user->getUser()->getUsername(); echo $userPassword = $user->getUser()->getPassword();

72. Which of the following will add an external JavaScript file to a Magento page?

Answers:

  1. <reference name=”head”> <action method=”addJs”><script>folder/file.js</script></action> </reference>
  2. <action method=”addJs”> <script>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</script> </action>
  3. <action method=”Jsadd”> <script>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</script> </action>
  4. <action method=”addJs”>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</action>

73. Which of the followings magento features are related to CRM?

Answers:

  1. Newsletters
  2. Contact and Transactional Emails
  3. Poll
  4. All of above

74. Which of the following statements are true regarding passing data between a controller and a block in Magento?

Answers:

  1. It can not be done by using Magento’s MVC approach, but it can be done by emulating traditional PHP MVC behaviors.
  2. It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento’s MVC approach.
  3. It can be done by writing this code on a controller: Mage::transfer(‘data’, $data); and writing this in the block: $data = Mage::registry(‘data’);
  4. It can be done by writing this code on a controller: Mage::register(‘data’, $data); and writing this in the block: $data = Mage::registry(‘data’);

75. How magento contact form can be shown on a CMS page?

Answers:

  1. By using block syntax {{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
  2. By Using Layout Update <reference name=”content”> <block type=”core/template” name=”contactForm” template=”contacts/form.phtml”/> </reference>
  3. By Creating an Widget of Contact form and adding that widget to CMS page
  4. All of above is correct

76. Which of the following will check if the current request is for a backend page or a frontend page?

Answers:

  1. Mage::app()->getStore()->isAdmin()
  2. Mage::code()->getStore()->isAdminArea()
  3. Mage::app()->getStore()->Admin()
  4. Mage::app()->getStore()->AdminHtml()

77. Which of the following statements are correct to store Contact form data in database of magento?
A. By default Magento store the Contact form data in database
B. Need to create a custom module which store data in database by override the core contacts module

Answers:

  1. Statement A is true and Statement B is false
  2. Statement B is true and Statement A is false
  3. Both statements are true.
  4. Both statements are false.

78. What does the Capture method do in the Magento Purchase and Order Processing flow?

Answers:

  1. Sends an authorization request to the payment gateway’s API.
  2. Collects funds from the authorized transaction and puts it in the merchant’s account.
  3. Throws an exception when authorization has failed.
  4. Collects the order and makes the shipment.

79. Which file needs to change to update database when transfer a local Magento install onto live server?

Answers:

  1. app/etc/config.xml
  2. app/db/config.xml
  3. app/etc/local.xml
  4. app/code/core/db/local.xml

80. Which of the following attributes are the data member of magento Mage_Newsletter_Model_Subscriber Class?

Answers:

  1. STATUS_SUBSCRIBED
  2. STATUS_NOT_ACTIVE
  3. STATUS_UNSUBSCRIBED
  4. All the above

81. Which of the following will not increase the performance of a Magento site?

Answers:

  1. Reducing the time spent on creation of the blocks
  2. Disabling the cache in the admin panel
  3. Switching on compiler mode
  4. Using auto-optimization extensions

82. Which of the following will correctly display the current theme name in Magento?

Answers:

  1. Mage::getSingleton(‘core/design_package’)->getName();
  2. Mage::getDesignPackage()->getName();
  3. Mage::getSingleton(‘core/design_package’)->getTheme(‘frontend’);
  4. Mage::getSingleton(‘core/design_package’)->getName(‘package’);

4,074 total views, 15 views today

Upwork Web Development

jQuery Test 2016

Published by:

1. Consider the following code snippet:
$(‘a.arrow-1’).click(function () {
$(‘.second-row’).slideUp();
$(this).parent(‘.first-row’).siblings(‘.second-row’).slideDown();
});

The order of the animations of this code snippet are:

Answers:

  1. The targeted parent sibling .second-row will slide up, then .second-row will slide down.
  2. .second-row will slide up, then the targeted parent sibling .second-row will slide down.
  3. Both the targeted parent sibling .second-row will slide down and the .second-row will slide up actions will occur at the same time.
  4. None of the above.

2. Consider the following code snippet:
$(‘#ul1 li’).live(‘click’, function1);

$(‘#ul1’).after(‘&#60;li id=”lastLi”&#62;Last item&#60;/li&#62;’);
Is function1 executed if “lastLi” is clicked?

Answers:

  1. Yes
  2. No
  3. “lastLi” does not exist.

3. Which of the following code snippets insert(s) the code snippet <font size=2><div class=”footer”>footer</div></font> at the end of div tags?

Answers:

  1. $(‘div’).append(‘<div class=”footer”>footer</div>’);
  2. $(‘div’).appendTo(‘<div class=”footer”>footer</div>’);
  3. $(‘<div class=”footer”>footer</div>’).append(‘div’);
  4. $(‘<div class=”footer”>footer</div>’).appendTo(‘div’);

4. jQuery allows you to use ___ function to switch between showing and hiding an element.

Answers:

  1. show
  2. hide
  3. switch
  4. toggle

5. What does $(‘tr.rowClass:eq(1)’); return?

Answers:

  1. One element set which is the second row of the first table.
  2. One element set which is the first row of the first table.
  3. A set of tr tags which have “rowClass:eq(1)” class .
  4. A set of tr tags which have “eq(1)” class .

6. Which option can be used to have jQuery wait for all images to load before executing something on a page?

Answers:

  1. All jQuery code need to add inside $function() { } syntax
  2. With jQuery, can use $(document).ready() to execute something when the DOM is loaded and$(window).load() to execute something when all other things are loaded as well, such as the images.
  3. With jQuery, can use $(document).ready() or $(window).load() syntax as these both are the same.
  4. $(window).onLoad(function() { })

7. offset function gets the current offset of the first matched element in pixels relative to the ___.

Answers:

  1. document
  2. parent element
  3. children element
  4. container

8. Consider the following code snippet:

$(document).ready(function() {
$(‘div’).each(function(index) {
alert(this);
});
});

Which of the following objects does the ‘this’ variable refer to?

Answers:

  1. window
  2. document
  3. The current div tag of the iteration.
  4. The last element tag in the body.

9. Which of the following returns the children tags of “id1”?

Answers:

  1. $(‘#id1’).children();
  2. $(‘#id1’).getChildren();
  3. children(‘#id1’);
  4. getChildren(‘#id1’);

10. Which of the following is the correct way to select an option based on its text in jQuery?

Answers:

  1. $(“#myselect option”).filter(function(){ return $(this).text() == ‘text’;}).prop(‘selected’, true);
  2. $(“#myselect option”).prop(‘selected’, true).text(“text”)
  3. $(“#myselect”).filter(“option”).prop(‘selected’, true).text(“text”);
  4. $(“#myselect”).filter(function(){ return $(this).val() == ‘text’;}).prop(‘selected’, true);

11. Consider the following code snippet:

$(‘#id1’).animate({width:”240px”}, { queue:false, duration:1000 }).animate({height:”320px”}, “fast”);

The order of the animations of this code snippet is ___.

Answers:

  1. First the width animation, then the height animation.
  2. First the height animation, then the width animation.
  3. Both the width animation and the height animation occur at the same time.
  4. The order of animations is random.

12. What is the result of NaN == NaN?

Answers:

  1. true
  2. false
  3. An error occurs.
  4. None of these.

13. $(“div”).find(“p”).andSelf().addClass(“border”);
The statement adds class border to ___.

Answers:

  1. all div tags and p tags in div tags
  2. all div tags
  3. all p tags
  4. all p tags enclosed in div tags

14. $(‘#a1’).one(‘click’, {times: 3}, function1);

Which of the following is true for the above?

Answers:

  1. function1 will be executed once regardless of the number of times a1 is clicked.
  2. function1 will be executed at most 3 times if a1 is clicked more than twice.
  3. There is at most one instance of function1 to be executed at a time.
  4. There are at most three instances of function1 to be executed at a time.

15. Consider the following code snippet:
<font size=2>
<ul id=’id1′>
<li id=’li1′>Items 1</li>
<li id=’li2′>Items 2</li>
<li id=’li3′>Items 3</li>
</ul>
</font>
Which of the following code snippets return(s) a set of all li tags within id1 except for the li tag with id li2?

Answers:

  1. $(‘#id1 li’).not($(‘#li2’));
  2. $(‘#id1 li’).except($(‘#li2’));
  3. $(‘#id1 li’).remove($(‘#li2’));
  4. $(‘#id1 li’).delete($(‘#li2’));

16. Assume that you want that first the tag with “id1” fades out and then the tag with “id2” fades in. Which of the following code snippets allow(s) you to do so?

Answers:

  1. $(‘#id1’).fadeOut(‘fast’); $(‘#id2’).fadeIn(‘slow’);
  2. $(‘#id2’).fadeIn(‘slow’); $(‘#id1’).fadeOut(‘fast’);
  3. $(‘#id1’).fadeOut(‘fast’, function() {$(‘#id2’).fadeIn(‘slow’)});
  4. $(‘#id2’).fadeIn(‘slow’, function() {$(‘#id1’).fadeOut(‘fast’)});

17. Which of the following methods can be used to copy element?

Answers:

  1. clone
  2. cloneTo
  3. move
  4. moveTo

18. $(‘#id1’).animate({width:”80%”}, “slow”)

The above code snippet will ___.

Answers:

  1. animate the tag with id1 from the current width to 80% width.
  2. animate the tag with id1 from 80% width to current width.
  3. animate the tag with id1 from the current 80% width to 0px.
  4. animate the tag with id1 from 80% width to 100% width.

19. Consider the following code snippet:
<ul id=’id1′>
<li id=’li1′>Items 1</li>
<li id=’li2′>Items 2</li>
<li id=’li3′>Items 3</li>
</ul>
Which of the following code snippets return(s) a set of all li tags within id1 except for the li tag with id li2?

Answers:

  1. $(‘#id1 li’).not($(‘#li2’));
  2. $(‘#id1 li’).except($(‘#li2’));
  3. $(‘#id1 li’).remove($(‘#li2’));
  4. $(‘#id1 li’).delete($(‘#li2’));

20. Which of the following methods can be used to utilize the animate function with the backgroundColor style property?

Answers:

  1. Use the jQuery UI library.
  2. There is no need to do anything as jQuery core already supports that style property.
  3. There is no way to use animate with that style property.

21. Consider the following code snippet:
$(‘#id1’).animate({width:”240px”}, { queue:false, duration:1000 }).animate({height:”320px”}, “fast”);
The order of the animations of this code snippet is ___.

Answers:

  1. First the width animation, then the height animation.
  2. First the height animation, then the width animation.
  3. Both the width animation and the height animation occur at the same time.
  4. The order of animations is random.

22. Which of the following code snippets insert(s) the code snippet
<div class=”footer”>footer</div>
at the end of div tags?

Answers:

  1. $(‘div’).append(‘<div class=”footer”>footer</div>’);
  2. $(‘div’).appendTo(‘<div class=”footer”>footer</div>’);
  3. $(‘<div class=”footer”>footer</div>’).append(‘div’);
  4. $(‘<div class=”footer”>footer</div>’).appendTo(‘div’);

23. Which option is correct to perform a synchronous AJAX request?

Answers:

  1. beforecreate: function(node,targetNode,type,to) { jQuery.ajax({ url: ‘http://example.com/catalog/create/’ + targetNode.id + ‘?name=’ + encode(to.inp[0].value), success: function(result) { if(result.isOk == false) alert(result.message); } }); }
  2. beforecreate: function(node,targetNode,type,to) { jQuery.ajax({ url: ‘http://example.com/catalog/create/’ + targetNode.id + ‘?name=’ + encode(to.inp[0].value), success: function(result) { if(result.isOk == false) alert(result.message); }, async: sync(true) }); }
  3. beforecreate: function(node,targetNode,type,to) { jQuery.ajax({ url: ‘http://example.com/catalog/create/’ + targetNode.id + ‘?name=’ + encode(to.inp[0].value), success: function(result) { if(result.isOk == false) alert(result.message); }, async: false }); }
  4. jQuery only allow asynchronous AJAX request.

24. Which of the following is the correct way to get “Option B” with the value ‘2’ from following HTML code in jQuery?
<select id=’list’>
<option value=’1′>Option A</option>
<option value=’2′>Option B</option>
<option value=’3′>Option C</option>
</select>

Answers:

  1. $(“#list[value=’2′]”).text();
  2. $(“#list option[value=’2′]”).text();
  3. $(this).find(“option:selected”).text();
  4. element.options[element.selectedIndex].text

25. Consider the following code snippet:
<ul id=’id1′>
<li id=’li1′>Items 1</li>
<li id=’li2′>Items 2</li>
<li id=’li3′>Items 3</li>
</ul>
Which of the following code snippets returns the same result as $(‘#id1 li’).not($(‘#li2’));?

Answers:

  1. $(‘#li2’).siblings();
  2. $(‘#id2’).siblings(‘#li2’);
  3. $(‘#li2’).children();
  4. $(‘#id2’).children(‘#li2’);

26. If jQuery is included before another library, how can conflict between jQuery and that library be avoided?

Answers:

  1. By calling jQuery.noConflict(); right after including jQuery.
  2. By calling jQuery.useDefault = false; right after including jQuery.
  3. By calling jQuery.useShortcut = false; right after including jQuery.
  4. By using the jQuery object when working with the jQuery library and using the $ object for other libraries.

27. Which of the following functions is/are built-in jQuery regular expression function(s)?

Answers:

  1. test
  2. match
  3. find
  4. jQuery does not have built-in regular expression functions.

28. each() is a generic ___ function.

Answers:

  1. comparator
  2. operator
  3. iterator
  4. normal

29. Consider the following code snippet:
$(‘span.item’).each(function (index) {
$(this).wrap(‘<li>Item</li>’);
});
What does this code snippet do?

Answers:

  1. Wraps each span tag that has class item within a li tag.
  2. Inserts each span tag that has class item into a li tag.
  3. Inserts <li>Item</li> into each span that has item class.
  4. Replaces each span tag that has class item with a <li>Item</li>.

30. Consider the following code snippet:
$(document).ready(function1);
$(document).ready(function2);
$(document).ready(function3);
Which of the following functions are executed when DOM is ready?

Answers:

  1. function1
  2. function2
  3. function3
  4. function1, function2, and function3
  5. No function is executed.

31. Which of the following represents the best way to make a custom right-click menu using jQuery?

Answers:

  1. $(document).bind(“contextmenu”, function(event) { event.preventDefault(); $(“<div class=’custom-menu’>Custom menu</div>”) .appendTo(“body”) .css({top: event.pageY + “px”, left: event.pageX + “px”}); });
  2. $(document).bind(“contextrightmenu”, function(event) { event.preventDefault(); $(“<div class=’custom-menu’>Custom menu</div>”) .appendTo(“body”) .css({top: event.pageY + “px”, left: event.pageX + “px”}); });
  3. $(document).bind(“rightclick”, function(event) { event.preventDefault(); $(“<div class=’custom-menu’>Custom menu</div>”) .appendTo(“body”) .css({top: event.pageY + “px”, left: event.pageX + “px”}); });
  4. None of the above.

32. Consider the following code snippet:
$(‘#button1’).bind(‘click’, function(data) {…});
What is the data argument?

Answers:

  1. Click event’s data
  2. Function’s data
  3. Global variable
  4. Local variable

33. $(“div”).find(“p”).andSelf().addClass(“border”);

The statement adds class border to ___.

Answers:

  1. all div tags and p tags in div tags
  2. all div tags
  3. all p tags
  4. all p tags enclosed in div tags

34. Consider the following code snippet:
<font size=2>

<ul id=’id1′>

<li id=’li1′>Items 1</li>

<li id=’li2′>Items 2</li>

<li id=’li3′>Items 3</li>

</ul>

</font>
Which of the following code snippets return(s) a set of all li tags within “id1” except for li tag with id “li2”?

Answers:

  1. $(‘#id1 li’).not($(‘#li2’));
  2. $(‘#id1 li’).except($(‘#li2’));
  3. $(‘#id1 li’).remove($(‘#li2’));
  4. $(‘#id1 li’).delete($(‘#li2’));

35. What is the result of this function: jQuery.makeArray ( true )?

Answers:

  1. 1
  2. NaN
  3. [ true ]
  4. []

36. Which of the following is the correct way to get the value of a textbox using id in jQuery?

Answers:

  1. $(“.textbox”).text()
  2. $(“#textbox”).val()
  3. $(“.textbox”).val()
  4. $(“#textbox”).text()

37. The hide() function hides an element by ___.

Answers:

  1. setting “display” inline style attribute of that element to “none”.
  2. setting “visibility” inline style attribute of that element to “hidden”.
  3. setting the horizontal attribute of that element to “-100”.
  4. setting the vertical attribute of that element to “-100”.

38. Consider the following code snippet:

$(‘#table1’).find(‘tr’).filter(function(index) { return index % 3 == 0}).addClass(‘firstRowClass’);

The result of the above code snippet is ___.

Answers:

  1. The rows of table1 at order 3n + 1 (n = 0, 1, 2,…) will belong to the class firstRowClass.
  2. The rows of table1 at order 3n (n = 1, 2,…) will belong to the class firstRowClass.
  3. All rows of table1 will belong to the class firstRowClass.
  4. No row of table1 will belong to the class firstRowClass.

39. One advantage of $.ajax function over $.get or $.post is that ___.

Answers:

  1. $.ajax offers error callback option.
  2. $.ajax is easier to use.
  3. $.ajax allows passing request parameters.
  4. the result of $.ajax is formatted.

40. Using an element of some kind that is being hidden using .hide() and shown via .show(). Which of the following is the best way to determine if that element is currently hidden or visible on the screen?

Answers:

  1. $(element).is(“:visible”)
  2. $(this).css(“visibility”) == “hidden”
  3. $(element).is(“:invisible”)
  4. $(this).css(“visibile”) == “hidden”

41. Which of the following will get the first column of all tables using jQuery?

Answers:

  1. $(‘table.tblItemTemplate first-child’);
  2. $(‘table.tblItemTemplate tr:first-child’);
  3. $(‘table.tblItemTemplate td:first-child’);
  4. $(‘tabletblItemTemplate td:first-child’);

42. Which option is correct to use the below function to set cursor position for textarea?
Function:
$.fn.selectRange = function(start, end) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd(‘character’, end);
range.moveStart(‘character’, start);
range.select();
}
});
};

Answers:

  1. $(‘#elem’).selectRange(3,5);
  2. $(‘#elem’).selectRange(3 5);
  3. $(‘#elem’).selectRange(X:3,Y:5);
  4. $(‘#elem’).fn.selectRange(3,5);

43. Assuming that the jQuery UI library is used to make a list sortable, which of the following code snippets makes “list1” sortable?

Answers:

  1. $(‘#list1’).sortable();
  2. $(‘#list1’).changeable();
  3. $(‘#list1’).interchangeable();
  4. $(‘#list1’).organizeable();

44. Which of the following is the correct way to disable an input field with jQuery?

Answers:

  1. $(“input”).attr(‘disabled’,’disabled’);
  2. $(“input”).css(‘disabled’,’disabled’);
  3. $(“input”).attr(‘disable’,’disable’);
  4. $(“input”).(‘disabled’);

45. Which of the following functions can be used to stop event propagation?

Answers:

  1. stopPropagation
  2. disablePropagation
  3. cancelPropagation
  4. preventPropagation

46. How can the child img be selected inside the div with a selector?

Answers:

  1. jQuery(this).children(“img”);
  2. jQuery(this).find(“img”);
  3. $(this).find(“img”).attr(“alt”)
  4. $(this).children(“img”).attr(“alt”)

47. jQuery allows simulating an event to execute an event handler as if that event has just occurred by using ___.

Answers:

  1. trigger function
  2. execute function
  3. intimate function
  4. jQuery does not have this feature.

48. Which of the following is the correct use of ajaxStart() function?

Answers:

  1. ajaxStart() function is used to start ajax call.
  2. ajaxStart() function is used to run some code when ajax call start.
  3. a & b
  4. None of the above.

49. The height function returns the height of an element in ___.

Answers:

  1. pixel units
  2. point units
  3. em units
  4. millimeter units

50. Which of the following values is/are valid value(s) of secondArgument in addClass(‘turnRed’, secondArgument); function, if the jQuery UI library is being used?

Answers:

  1. ‘fast’
  2. slow
  3. 1000ms
  4. 3000

51. Consider the following code snippet:
$(‘#button1’).bind(‘click’, function(data) {…});
What is the data argument?

Answers:

  1. Click event’s data
  2. Function’s data
  3. Global variable
  4. Local variable

52. Which of the following is the correct way to add an additional option and select it with jQuery?

Answers:

  1. $(‘#mySelect’).append(‘<option value=”whatever”>text</option>’).val(‘whatever’)
  2. $(‘#mySelect’).html(‘<option value=”whatever”>text</option>’).val(‘whatever’)
  3. $(‘#mySelect’).text(‘<option value=”whatever”>text</option>’).val(‘whatever’)
  4. $(‘#mySelect’).val(‘whatever’)

53. How can the href for a hyperlink be changed using jQuery?

Answers:

  1. $(“a”).link(“http://www.google.com/”);
  2. $(“a”).change(“href”,”http://www.google.com/”);
  3. $(“a”).link(“href”,”http://www.google.com/”);
  4. $(“a”).attr(“href”, “http://www.google.com/”);

54. The position function gets the ___ positions of an element that are relative to its offset parent.

Answers:

  1. top and left
  2. top and right
  3. bottom and left
  4. bottom and right

55. Consider the following code snippet:

<ul id=’id1′>

<li id=’li1′>Items 1</li>

<li id=’li2′>Items 2</li>

<li id=’li3′>Items 3</li>

</ul>

Which of the following code snippets returns the same result as $(‘#id1 li’).not($(‘#li2’));?

Answers:

  1. $(‘#li2’).siblings();
  2. $(‘#id2’).siblings(‘#li2’);
  3. $(‘#li2’).children();
  4. $(‘#id2’).children(‘#li2’);

56. Which of the following is the correct way to debug JavaScript/jQuery event bindings with Firebug or a similar tool?

Answers:

  1. var clickEvents = $(‘#foo’).data(“events”).click; jQuery.each(clickEvents, function(key, value) { console.log(value) // prints “function() { console.log(‘clicked!’) }” })
  2. $.fn.listHandlers = function(events, outputFunction) { return this.each(function(i){ var elem = this, dEvents = $(this).data(‘events’); if (!dEvents) {return;} $.each(dEvents, function(name, handler){ if((new RegExp(‘^(‘ + (events === ‘*’ ? ‘.+’ : events.replace(‘,’,’|’).replace(/^on/i,”)) + ‘)$’ ,’i’)).test(name)) { $.each(handler, function(i,handler){ outputFunction(elem, ‘n’ + i + ‘: [‘ + name + ‘] : ‘ + handler ); }); } }); }); };
  3. var clickEvents = $(‘#foo’).data(“events”).click; jQuery.each(clickEvents, function(key, value) { event.console.log(value); })
  4. $.fn.listHandlers = function(events, outputFunction) { return this.each(function(i){ var elem = this, dEvents = $(this).data(‘events’); $.each(dEvents, function(name, handler){ if((new RegExp(‘^(‘ + (events === ‘*’ ? ‘.+’ : events.replace(‘,’,’|’).replace(/^on/i,”)) + ‘)$’ ,’i’)).test(name)) { $.each(handler, function(i,handler){ outputFunction(elem, ‘n’ + i + ‘: [‘ + name + ‘] : ‘ + handler ); }); } }); }); };

57. Which of the following events can be used to disable right click contextual menu?

Answers:

  1. contextmenu
  2. contextualmenu
  3. rightclickmenu
  4. The right-click contextual menu cannot be disabled.

58. Which of the following gets the href attribute of “id1”?

Answers:

  1. $(‘#id1).attr(‘href’);
  2. $(‘#id1’).getAttribute(‘href’);
  3. $(‘#id1)[0].attr(‘href’);
  4. All of these.

59. Which of the following is the correct way to manage a redirect request after a jQuery Ajax call?

Answers:

  1. $.ajax({ type: “POST”, url: reqUrl, data: reqBody, dataType: “json”, success: function(data, textStatus) { if (data.redirect) { // data.redirect contains the string URL to redirect to window.location.href = data.redirect; } else { // data.form contains the HTML for the replacement form $(“#myform”).replaceWith(data.form); } } });
  2. public ActionResult Index(){ if (!HttpContext.User.Identity.IsAuthenticated) { HttpContext.Response.AddHeader(“REQUIRES_AUTH”,”1″); } return View() }
  3. $.ajax( error: function (jqXHR, timeout, message) { var contentType = jqXHR.getResponseHeader(“Content-Type”); if (jqXHR.status === 200 && contentType.toLowerCase().indexOf(“text/html”) >= 0) { window.location.reload(); } });
  4. $(document).ready(function () { $(document).ajaxSend( function(event,request,settings) { var intercepted_success = settings.success; settings.success = function( a, b, c ) { if( request.responseText.indexOf( “<html>” ) > -1 ) window.location = window.location; else intercepted_success( a, b, c ); }; }); });

60. Which of the following is the correct way to change the image source during click event of a button in jQuery?

Answers:

  1. $(“#button”).click(function(){ $(“img”).src(); });
  2. $(“#button”).click(function(){$(“img”).attr(); });
  3. $(“#button”).submit(function(){$(“img”).text();});
  4. $(“#button”).submit(function(){$(“img”).html(); });

61. What is the purpose of $(document).ready() function in Jquery?

Answers:

  1. To execute functions after all content and images are loaded
  2. To execute functions after DOM is loaded
  3. To execute functions before DOM load
  4. To execute functions before content and images load

62. Which of the following will show an alert containing the content(s) of a database selection?

Answers:

  1. $.ajax({ type: “GET”, url: “process_file.php?comp_id=”+comp_id, success: function (result) { alert(result); } });
  2. $.ajax({ type: “GET”, success: function (result) { alert(result); } });
  3. $.ajax({ type: “GET”, url: “process_file.php?comp_id=”+comp_id, error: function (result) { alert(result); } });
  4. $.ajax({ type: “GET”, url: “process_file.php?comp_id=”+comp_id, Complete: function (result) { alert(result); } });

63. How can an Ajax request that has not yet received a response be canceled or aborted?

Answers:

  1. //xhr is an Ajax variable xhr.abort()
  2. //xhr is an Ajax variable xhr.cancel()
  3. //xhr is an Ajax variable xhr.die()
  4. //xhr is an Ajax variable xhr.destroy()

6,544 total views, 18 views today

Upwork Web Development

Joomla Test 2016

Published by:

1. Which of the following items will be checked in when you use the “Global Check-in” function?

Answers:

  1. Banner
  2. Content
  3. Contact
  4. Components
  5. Modules
  6. Plugins
  7. Languages
  8. Menu

2. In the User Manager, who can publish an article?

Answers:

  1. The Editor
  2. The Publisher
  3. The Manager
  4. The Administrator

3. In the User Manager, which of the following groups can be assigned to a new user registration?

Answers:

  1. Registered
  2. Author
  3. Editor
  4. Publisher
  5. Manager

4. Which of the following values are not required for a banner item?

Answers:

  1. Client
  2. Category
  3. Click URL
  4. Image

5. There are 21 different standard parameter types supported in the Joomla Framework for all extension types (templates, components, modules and plugins). Which of the following parameter types are not supported in the Joomla Framework?

Answers:

  1. menuitem
  2. helpsites
  3. checkbox
  4. imageM
  5. timezones
  6. usergroup

6. Which of the following mailers does Joomla support? (Select all that apply.)

Answers:

  1. PHP Mail Function
  2. SMTP
  3. IMAP
  4. Sendmail program

7. In the User Manager, which of the following options can be applied for individual users?

Answers:

  1. Back-end Language
  2. Front-end Language
  3. User Editor
  4. Templates

8. In the User Manager, what’s the step of registration after ‘submit user information’?

Answers:

  1. Wait for the system’s approval
  2. Check email and activate account
  3. No further step is required. The account is automatically activated.
  4. It depends on the “User Settings”. The account may be enabled automatically or the user may have to activate it.

9. True or False:

Joomla does not provide the capability to include a podcast.

Answers:

  1. True
  2. False

10. What is a Module?

Answers:

  1. A Module is a mini-application that renders the main body of the page.
  2. A Module is a smaller Extension typically used for rendering a small element that is displayed across multiple pages.
  3. A Module is a section of the code that runs when a pre-defined event happens within Joomla.
  4. A Module controls the way the content of a web site is displayed.

11. How will you make Joomla 1.0x extensions work with Joomla 1.5?

Answers:

  1. Joomla 1.0x extensions work well with Joomla 1.5 by default
  2. Joomla 1.0x extensions cannot work with Joomla 1.5 by default
  3. Enable the Legacy mode on the “Global Configuration”
  4. Enable Legacy plugin

12. Which option will you choose to set the site metadata for the installed website?

Answers:

  1. Global Configuration
  2. Module Manager

13. Which of the following functions is used to list a folder in a format suitable for tree display?

Answers:

  1. JFolder::listFolde
  2. JFolder::listFolderTree
  3. JPath::listFolde
  4. JPath::listFolderTree

14. What can you not do with the Media Manager?

Answers:

  1. Upload files
  2. Delete files/folders
  3. Rename files/folders
  4. Create folders

15. How do you load “layout_layout1” layout in layout.php file?

Answers:

  1. $this->loadTemplate(‘layout1’);
  2. $this->loadTemplate(‘example_layout1’);
  3. $this->loadLayout(‘example_layout1.php’);
  4. $this->importLayout(‘layout1’);

16. What is the purpose of the “registerTask” function in JController?

Answers:

  1. To create a new task in the class
  2. To register (map) a task to a method in the class
  3. To register the default task to perform if a mapping is not found
  4. To replace a task with another task in the class

17. To which of the following does the path constant link the XML-RPC Web service folder?

Answers:

  1. JPATH_XML_RPC
  2. JPATH_XMLRPC
  3. JPATH_ROOT
  4. JPATH_BASE

18. How do you define a filename.css file in your component to load into the head tag by Joomla?

Answers:

  1. $doc =& JFactory::getDocument(); $doc->addStyleSheet($url);
  2. $doc =& JFactory::getDocument(); $doc->addStyle($url);
  3. $doc =& JFactory::getDocument(); $doc->addCSS($url);

19. How can you access the User Manager?

Answers:

  1. In the Control Panel page of Administration -> Click on the “User Manager” icon
  2. Menu “Tools” -> User Manager
  3. Menu “Site” -> Global Configuration
  4. Menu “Site” -> User Manager

20. Which of the following functions is used to build a button for a media manager tools popup?

Answers:

  1. JHTML::_media_manager( ‘/’ )
  2. JToolBarHelper::custom (‘media_manager’)
  3. JToolBar::media_manager(‘/’)
  4. JToolBarHelper::media_manager( ‘/’ )

21. Which parameter is passed to a url to show module positions?

Answers:

  1. tpl=1
  2. tpl=component
  3. tp=1

22. Which Joomla file provides the central logic of the template, including any module and component display?

Answers:

  1. Index.php
  2. Template.css
  3. TemplateDetails.xml
  4. Banner.fff

23. Which file is required to turn on the SEO mode with rewrite URL?

Answers:

  1. configuration.php
  2. install.php
  3. httpd.conf
  4. .htaccess

24. In the User Manager, how can a user get back their password if they forget it?

Answers:

  1. By using the “Forgot your password?” function.
  2. Super Administrators can reveal the password.
  3. The Password is encrypted and cannot be decrypted; thus he can not get back his plain password.

25. How do you control the layout of print pages?

Answers:

  1. Style in file css/print.css
  2. Control the output of component.php
  3. Style for class “.print” inside css/template.css

26. True or False:

Joomla provides an abstracted method called getEscaped() that returns the escaped string regardless of the target database.

Answers:

  1. True
  2. False

27. In the Content Manager, Joomla! uses a 3-tier organization level for articles. It is:

Answers:

  1. Category -> Section -> Article
  2. Static content -> Category -> Article
  3. Section -> Category -> Article
  4. Section -> Static Content -> Article

28. What types of extensions does Joomla include?

Answers:

  1. Component, Module, Template
  2. Component, Module, Template, Language
  3. Component, Module, Template, Language, Plugin
  4. Component, Module, Template, Language, Plugin, Addon

29. What user authentication methods does Joomla 1.5 support?

Answers:

  1. Twitter, Facebook, MySpace
  2. Gmail, LDAP
  3. Yahoo

30. In the Media Manager, how can you set the “Maximum size” option?

Answers:

  1. Set configuration via Global Configuration > Site
  2. Set configuration via Global Configuration > System
  3. Set configuration via Global Configuration > Media

31. True or false: Like components and modules, plugin language files are automatically loaded when a plugin is loaded.

Answers:

  1. True
  2. False

32. What kinds of default menus are available in the example data?

Answers:

  1. Top Menu, Main Menu, Other menu, User menu, Resources, Example Pages and Key Concepts
  2. Top Menu, Main Menu and User menu
  3. Top Menu, Main Menu and Other menu
  4. Main Menu, Other menu and User menu

33. Which of the following files has to be renamed to .htaccess in order to enable mod_rewrite?

Answers:

  1. htaccess.php
  2. htaccess.txt
  3. htaccess.doc
  4. None of these

34. How will you create a contact page?

Answers:

  1. Create a contact item in the Contacts component. Select the contact item in the module Contacts.
  2. Create a contact item in the Contacts component. Create a menu item pointing to the contact item.
  3. Declare contact information in the module Contact and publish it.
  4. Declare contact information for the Administrator user and select it in the module Contact.

35. While installing Joomla, at the FTP Configuration step, what is the FTP layer for?

Answers:

  1. For uploading files in the Administration panel
  2. For uploading files in the Media Management panel
  3. For managing the file system in the Administration panel
  4. For handling file system manipulation and enabling Joomla! installers

36. What does the following code section do?

$user =& JFactory::getUser();
if ($user->authorize(‘com_content’, ‘edit’, ‘content’, ‘all’))
{
//Display notice
} else {
//Display notice
}

Answers:

  1. Check user’s permission to edit all articles.
  2. Check user’s permission to view all articles.
  3. Check user’s permission to edit all articles. If this permission does not exist, the system will set the edit permission for the use.

37. What is the method “getModule” in the class “JModuleHelper” used for?

Answers:

  1. To get the module by name. It returns an object with information about the module.
  2. To get the module by module position. It returns an array of objects with information about the module.

38. What will happen if you delete a menu?

Answers:

  1. The menu and all its items will be deleted out of the system.
  2. The menu will be marked as deleted and you can delete/restore it from the “Trash Manager”.
  3. The menu item will be moved to the “Menu Trash”.

39. What is the purpose of the Newsfeeds component?

Answers:

  1. To publish news to other news readers
  2. To get news from other news providers
  3. To help users submit news/articles
  4. To help users get news/articles

40. Which of the given database systems is supported by Joomla?

Answers:

  1. Microsoft SQL Server
  2. MySQL
  3. Microsoft Access
  4. All of these

41. What is implemented in the PHP file of a plugin?

Answers:

  1. Use the $mainframe object to register a function with an event.
  2. Use the JPlugin class to register a function with an event.
  3. Extends class JPlugin and overrides the appropriate function with the event.

42. Given below is the structure of view articles in the com_content component:

/components
/com_content
/views
/articles
/tmpl
default.php
form.php
view.html.php

To override the layout for the articles view in a template, what is the correct folder structure?

Answers:

  1. /templates /[template] /html /com_content /articles default.php form.php
  2. /templates /[template] /html /com_content /articles /tmpl default.php form.php

43. With the “Mass Mail” tool, which of the following number of recipients can be selected?

Answers:

  1. Multiple users in system
  2. A single user in system
  3. Multiple groups
  4. A single group

44. In the User Manager, what are the Public Back-end User groups?

Answers:

  1. Publisher, Manager, Author, Editor, Administrator, and Super Administrator
  2. Publisher, Manager, Administrator, and Super Administrator
  3. Manager, Administrator, and Super Administrator
  4. Administrator, and Super Administrator

45. From which package are the classes (i.e JSite, JAdministrator and JInstallation) which make up the Joomla CMS application extended?

Answers:

  1. Installer
  2. Application
  3. Template
  4. Database

46. In the Article Manager, what is an article managed by?

Answers:

  1. Section ID
  2. Category ID
  3. Section ID and Category ID
  4. Article ID

47. In Joomla, does the Back-End session stay alive even though it is set to expire?

Answers:

  1. Yes
  2. No

48. Which of the following is not true about the FrontPage Manager?

Answers:

  1. It is the title page of the website.
  2. The selected content is presented there in blog form.
  3. Content cannot be selected from the FrontPage from all the contents.
  4. Individual content items can be sorted within the FrontPage Manager.

49. The type “Model” of MVC pattern implemented for Joomla often ______________.

Answers:

  1. …provides methods for managing and manipulating data.
  2. …generates data for HTML pages.
  3. …determines user requests (task).

50. What is the file format supported by Joomla 1.5 to create language definitions?

Answers:

  1. .php
  2. .svc
  3. .ini
  4. .xml

51. What is true of the “Community Builder” extension?

Answers:

  1. It is an environment for producing and maintaining online communities on Joomla driven sites.
  2. It is a system that provides user profile capabilities for Joomla sites.
  3. It is a different registration/login process for Joomla sites(It supports 4 different workflows).
  4. It is an integrated forum solution for Joomla.
  5. It is a framework for other Joomla components to integrate with user profiles.

52. What does the menu parameter type do?

Answers:

  1. It provides a drop down list of the available menu items from your Joomla site.
  2. It provides a drop down list of the available menus from your Joomla site.
  3. It provides a drop down list of the menus from your Joomla site.

53. What happens if the Main Menu is deleted?

Answers:

  1. Nothing will happen.
  2. Your site will not function as it has a default menu item.
  3. Your site will work with the condition that the Top menu and the Other menu remain unchanged.

54. How will you insert a module into an article?

Answers:

  1. Create a new module -> Assign the module with an existing position -> open an article and declare with the html code {loadposition position}
  2. Create a new module -> Assign the module with a new position -> open an article and declare with the html code {loadposition newposition}
  3. Create a new module -> Assign the module with a new position -> open an article and declare with the html code {load newposition}
  4. Create a new module -> Assign the module with an existed position -> open an article and declare with the html code {load newposition}

55. How will you create a poll and display it on Frontpage?

Answers:

  1. Create a poll item in the component Poll and select the poll in the module Poll.
  2. Create a poll item in the component Poll and select the option “Show on Frontpage”.
  3. Create poll in the module Poll.
  4. Create a poll item in the component Poll. Create a menu item pointing to that poll.

56. Which is incorrect about MD5 hash values with regard to their usage in Joomla?

Answers:

  1. Each password in Joomla is stored as an MD5 hash value.
  2. It stands for message-digest algorithm 5.
  3. The length of the number for MD5 is a 128-bit hash code.
  4. None of these.

57. Does Joomla allow you to create your own routing mechanism?

Answers:

  1. Yes
  2. No

58. We have a module named “mod_module1” which has the structure:
-mod_module1

—mod_module1.php

—mod_module1.xml

—helper.php

—tmpl

—–default.php
How do you overwrite the output of a standard Joomla module?

Answers:

  1. Overwrite the appropriated style method in the file [template]/html/module.php.
  2. Overwrite the module layout in the file [template]/html/mod_module1/tmpl/default.php.
  3. Overwrite the module layout in the file [template]/html/mod_module1/default.php.
  4. Module output cannot be overwriten in the template.

59. In the User Manager, what is the difference between the Author and the Editor groups?

Answers:

  1. The Author group allows a user to edit their own content. The Editor can edit any content.
  2. The Author group allows a user to submit new content. The Editor cannot submit new content.
  3. The Author group allows a user to edit any content. The Editor can edit only their own content.

60. Which option will you select to find unpublished articles?

Answers:

  1. Component manager
  2. Module manager
  3. Article manager
  4. None of these

61. Which of the following files does the “/includes” directory contain?

Answers:

  1. application.php
  2. defines.php
  3. framework.php
  4. All of these

62. What is the way to register an event in Joomla?

Answers:

  1. $_MAMBOTS->registerFunction( $event, $handler);
  2. $globalcontainer->registerEvent( $event, $handler, $params);
  3. $mainframe->registerEvent( $event, $handler, $params);
  4. $mainframe->registerEvent( $event, $handler);

63. How do you create an upload button and view a popup screen with width 550 and height 400?

Answers:

  1. $alt = “Upload”; $bar=& JToolBar::getInstance(‘toolbar’); $bar->appendButton(‘Popup’, ‘upload’, $alt, ‘index.php’, 550, 400);
  2. $alt = “UPload”; $bar=& JToolBar::getInstance(‘upload ); $bar->appendButton(‘Popup’, ‘upload’, $alt, ‘index.php’, 550, 400);
  3. $alt = “Upload”; $bar=& JToolBar::getInstance(‘toolbar’); $bar->custom(‘Popup’, ‘toolbar’, $alt, ‘index.php’, 550, 400);

64. Does Joomla provide custom parameter types in the XML file?

Answers:

  1. Yes
  2. No

65. Is a cache module supported by Joomla or not?

Answers:

  1. Yes
  2. No

66. What is the method “isEnabled” in the class “JModuleHelper” used for?

Answers:

  1. To check if a module is enabled
  2. To enable or disable a module

67. How many levels can each menu have?

Answers:

  1. 2 levels
  2. 5 levels
  3. 10 levels
  4. As many levels as you wish

68. How can you access the media manager?

Answers:

  1. Control Panel –> Click on “Media Manager” icon
  2. Content menu –> Front page manage
  3. Click on menu “Site” –> Global Configuration
  4. Click on menu “Site”–> Media Manage

69. Which user events occur with plug-ins that are installed for the front end of the system?

Answers:

  1. Administrative events
  2. Authentication events
  3. Both administrative and authentication events
  4. None of these

70. You should not use the die() function to debug because _______________.

Answers:

  1. It introduces security vulnerabilities.
  2. it prevents the Joomla framework from finalizing certain tasks like database connection and session store.
  3. It makes database tables crash.

71. What is the main function of the media manager?

Answers:

  1. Creating new files
  2. Adding new files
  3. Uploading/Deleting files and creating new sub folders
  4. Managing the system media files

72. What will happen when a Joomla! extension is uninstalled?

Answers:

  1. Joomla! will not remove the extension files/folders.
  2. Joomla! will remove the files/folders declared in the xml file.
  3. Joomla! will remove all the files/folders inside the extension folder.
  4. Joomla! will backup all the files/folders of the extension into a package.

73. What is not true of the module Login?

Answers:

  1. Shows the Login form for the users to login
  2. Shows the Signup form for the users to create new accounts
  3. Shows the Signup link for the users to create new accounts
  4. Shows the “Forgot your password” link for the users to reset the password
  5. Show the “Forgot your username” link for the users to get back the username

74. Which is the correct solution to return ‘First 1, second 2, third 3’ string, using Jtext class?

Answers:

  1. In .php file:Jtext::sprintf(‘KEY_STRING’,1,2,3); In language file (.ini): KEY_STRING=First %d, second %d, third %d
  2. In .php file:Jtext::sprintf(‘KEY_STRING’,1,2,3); In language file (.ini): KEY_STRING=First %f, second %f, third %f
  3. In .php file:Jtext::_(‘KEY_STRING’,1,2,3); In language file (.ini): KEY_STRING=First %d, second %d, third %d
  4. In .php file:Jtext::_(‘KEY_STRING’,1,2,3); In language file (.ini): KEY_STRING=First %f, second %f, third %f

75. Why does Joomla use templateDetails.xml files?

Answers:

  1. To access the template from within by using code;
  2. To debug style sheets;
  3. To provide information and allow selection of the template within the template manager;
  4. All of these.

76. In the User Manager, which Public Back-end User group(s) can access “Global configuration”?

Answers:

  1. Super Administrator
  2. Administrator
  3. Manager
  4. System

77. What is the output format of the documentation created using PHPDocumentor?

Answers:

  1. PDF
  2. CHM (compiled HTML)
  3. XML
  4. All of these.

78. $editor =& JFactory::getEditor();

echo $editor->display(‘content’, $this->content, ‘550’, ‘400’, ’60’, ’20’, false);

How do you get the content from the editor (containing line breaks and paragraphs)

Answers:

  1. $content = JRequest::getVar(‘content’, ”, ‘post’, ‘string’, JREQUEST_ALLOWRAW);
  2. $content = JRequest::getText(‘content’, ”);
  3. $content = $editor->getContent(‘content’);
  4. $content = JRequest::get(‘content’);

79. How do you add custom html code to head section?

Answers:

  1. global $mainframe; $mainframe->addCustomHeadTag( ‘ <script type=”text/javascript”>alert(123);</script>’);
  2. JDocumentHTML::addCustomTag( ‘ <script type=”text/javascript”>alert(123);</script>’ );
  3. $doc =& JFactory::getDocument(); $doc->addCustomTag( ‘ <script type=”text/javascript”>alert(123);</script>’ );
  4. JHTML:_(‘script’,'<script type=”text/javascript”>alert(123);</script>’ );

80. Which of the following commands is used to copy a Joomla file?

Answers:

  1. JFile::copyTo($src, $dest)
  2. JFile::copy($src, $dest)
  3. JFile::move($src, $dest)
  4. Jfile->copy($src, $dest)

81. The plugin that searches content articles uses the function plgSearchContent() to handle the onSearch event.

This is how the function is registered:

$mainframe->registerEvent(‘onSearch’, ‘plgSearchContent’);

Is it correct?

Answers:

  1. True
  2. False

82. What does the result of the ContentBuildRoute method return?

Answers:

  1. A string which is a part of a URL address.
  2. An array of segments where each segment is separated by a ‘/’ which is combined to create the actual link (the items in the array should not contain ‘/’ character).
  3. A name => value array of the querystring variables that the link maps to.

83. Which database types does Joomla support?

Answers:

  1. MySQL
  2. MySQLi
  3. PostgreSQL
  4. IBM DB2
  5. Microsoft SQL Server
  6. Oracle RDBMS

84. How do you load plugins in a component?

Answers:

  1. JPluginHelper::importPlugin(‘content’);
  2. JApplication::importPlugin(‘content’);
  3. JPluginHelper::loadPlugin(‘content’);

85. What is the role of the template metadata file in the system?

Answers:

  1. It contains the basic authorship information.<>/span<
  2. It contains information about the files that make up the template.
  3. It contains information about the parameters that will be available for configuration through the administrator interface.
  4. All of these.

86. Which extension can you use to build a shopping cart using Joomla?

Answers:

  1. Fireboard
  2. VirtueMart
  3. Docman
  4. All of the above

87. Which of the following PHP directives is important to Joomla execution in order to define an alternate compression library if the standard library is not available?

Answers:

  1. zlib.output_compression
  2. zlib.output_handler
  3. extension_dir
  4. expose_php

88. Which of the following is a system event?

Answers:

  1. OnDisplay
  2. OnSave
  3. OnGetInsertMethod
  4. OnAfterInitialise

89. In the Media Manager, what happens if you delete a media item?

Answers:

  1. The media file will be deleted.
  2. The media file will be moved to the Trash folder.
  3. The item will be marked as deleted and the file will be moved to the Trash folder.

90. The Joomla System SEF plugin inherits JPlugin and overrides the onAfterRender() function. In this function, what does JResponse::getBody() command do?

Answers:

  1. It retrieves the body of the response that will be sent to the browser. The body of the response is then searched for links containing “/index.php…” and replaces them with a correct SEF url by calling JRoute::_(url).
  2. The body of the response will replace links containing “/index.php…” with a correct SEF url by calling JRoute::_(url).
  3. The body of the response will search links containing “/index.php…” and return an array to be used for the next command.

91. What is module chrome used for?

Answers:

  1. Module chrome allows template designers to have a certain amount of control over the way the output from a Module is displayed in their template.
  2. Module chrome provides a method to return the output HTML of the module.
  3. Module chrome provides a method to return the path to the layout file for the module.
  4. Module chrome support a method to return an stdClass object containing information about the module requested.

92. Which of the following are valid methods for installing a Joomla extension?

Answers:

  1. Upload the Package File
  2. Install from the Directory
  3. Install from the File
  4. Install from the URL

93. True or False:

Joomla is written in Perl.

Answers:

  1. True
  2. False

94. Which of the following Joomla component or module is not installed by default?

Answers:

  1. Login
  2. Community builder
  3. Polling
  4. Search

95. Which menu type(s) is/are used to place a graphic or other separator between menu options?

Answers:

  1. Internal Link
  2. External Link
  3. Separator
  4. Alias

96. Which of the following actions will make a custom component work with Joomfish 2.0 (that is, which makes it possible to translate a custom component using Joomfish)?

Answers:

  1. Create the Content Element XML file for Joomfish for the custom extension and place it to components/com_joomfish/contentelements.
  2. Create the Content Element XML file for Joomfish for the custom extension and place it to administrator/components/com_joomfish/contentelements.
  3. Declare the Joomfish inside the custom component xml file.
  4. In Joomfish Configuration, add and declare additional information for the custom component.

97. Which of the following information the “Who’s Online” module cannot show?

Answers:

  1. Online user names
  2. The number of guests online
  3. The number of members online
  4. The most active members

98. In Joomla, which file stores information on the database connection (database name, username…)?

Answers:

  1. .htaccess
  2. my.ini
  3. configuration.php
  4. config.inc.php

99. How will you restore a trashed menu item?

Answers:

  1. Go to “Menus->Menu Trash”, select the menu item and click “Restore”
  2. Go to “Site->Trash Manager”, select the menu item and click “Restore”
  3. Go to “Tools->Trash Manager”, select the menu item and click “Restore”

100. In the User Manager, what are the Public Front-end user groups?

Answers:

  1. Registered, Manager, Author, Editor, and Publisher
  2. Registered, Author, Editor, and Publisher
  3. Registered, Editor, and Publisher
  4. Registered and Publisher

101. Which articles can the frontpage view display?

Answers:

  1. Articles from any section and category
  2. Articles restricted to just a few sections and categories
  3. Only static item contents

102. What is the root object that Joomla framework has inherited?

Answers:

  1. JObject
  2. Object
  3. JoomlaObject
  4. JoomlaGenericObject

103. In the Content Manager, is there any relationship between the 3-tier organization level for articles and the structure of the menus on your site?

Answers:

  1. Yes. The structure menus depend on the 3-tier organization level.
  2. No. Your site can have any menu level.

104. Which extension can be used to build a download system using Joomla?

Answers:

  1. Fireboard
  2. Community Builder
  3. Docman
  4. Joom!Fish

105. There is a method in the application called _______,

which triggers events in the global event dispatcher, notifying the relevant listeners.

It is a pass-through method for the JEventDispatcher ____ method.

Answers:

  1. triggerEvent()/trigger()
  2. egisterEvent()/register()
  3. triggerEvent()/register()

106. Which creational pattern is used by Joomla classes, particularly for database access?

Answers:

  1. Abstract Factory Pattern
  2. Singleton Pattern
  3. Builder Pattern
  4. All of these

107. Which of the following commands is used to get a model in the controller.php file of a component?

Answers:

  1. $model = JRequest::getModel(‘register’)
  2. $model = getModel(‘register’)
  3. $model = $this->getModel(‘register’)
  4. $Model = JModel::getModel(‘register’)

2,227 total views, 5 views today

Upwork Web Development

E4X Test 2016

Published by:

1. Which of the following methods is not one of the global methods and properties in E4X?

Answers:

  1. isXMLName()
  2. isScopeNamespaces()
  3. namespaceDeclarations()
  4. removeNamespaces()

2. Which of the following characters are treated as white space characters?

Answers:

  1. tab
  2. space
  3. Line feed
  4. enter

3. Which of the following is the correct syntax for calling the Namespace constructor as a function in E4X?

Answers:

  1. Namespace()
  2. Namespace(prefixValue)
  3. Namespace(uriValue)
  4. Namespace(prefixValue,uriValue)

4. Which of the following methods would give the output corresponding to the code snippet?

var test =
<type name=”Joe”>
<base name=”Bob”></base>
example
</type>;

output:

<type name=”Joe”>
<base name=”Bob”/>
example
</type>

Answers:

  1. alert(test.toString());
  2. alert(test.toXMLString());
  3. alert(test.text());
  4. alert(test.elements());

5. What is the value returned when the input parameter type of the XMLList() function in E4x is Number?

Answers:

  1. TypeError exception
  2. The value is first converted to a string and then converted to an XMLList object.
  3. The value is converted to an XMLList object.
  4. The input value is returned unchanged.

6. Consider the code snippet below. Which of the given options represents the correct sequence of outputs when this code is executed in E4X?

var p1 = <p>Kibology for all.</p>;
alert(p1.name().uri);
default xml namespace = ‘http://www.w3.org/1999/xhtml’;
var p2 = <p>Kibology for all.</p>;
alert(p2.name().uri);
default xml namespace = ”;
var p3 = <p>Kibology for all.</p>;
alert(p3.name().uri);

Answers:

  1. ”,http://www.w3.org/1999/xhtml,”
  2. ”,”,”
  3. ”,http://www.w3.org/1999/xhtml,http://www.w3.org/1999/xhtml
  4. None of the above

7. Consider the following code snippet. Which of the given options would be used in E4X to change the color of the descendant node chair?

var element = <Home>
<Room>
<Furniture>
<chair color=”Brown”/>
<Furniture>
</Room>
</Home>

Answers:

  1. element.chair.color=”light brown”
  2. element.chair.@color=”light brown”
  3. element..chair.@color=”light brown”
  4. element…chair.@color=”light brown”

8. Which of the following public methods in E4X has the return type XML?

Answers:

  1. localName()
  2. nodeKind()
  3. parent()
  4. valueOf()

9. Which of the following operators is used for inserting XML objects in the context of their parent in E4X?

Answers:

  1. =
  2. +
  3. +=
  4. =+

10. What will be the output of the following code snippet?

var xml = <body></body>;
xml.appendChild(“hello”);
Xml.appendChild(” world”);
xml.normalize();
alert(xml.children().length());

Answers:

  1. 1
  2. 2
  3. 3

11. Consider the code snippet below. Which of the given options represents the correct output of the code attribute substitution for special characters in E4X?

var b = ‘Best of luck “Studentname & Roll no” for your exam’;
var el = <foo a={b}/>;
alert(el.toXMLString());

Answers:

  1. <foo a=”Best of luck “Studentname & Roll no” for your exam”/>
  2. <foo a=”Best of luck Studentname & Roll no for your exam”/>
  3. <foo a=”Best of luck “Studentname & Roll no” for your exam”/>
  4. <foo a=”Best of luck “Studentname & Roll no” for your exam”/>

12. What is the default value of the property prettyIndent in E4X?

Answers:

  1. 2
  2. 0
  3. 4
  4. 1

13. What will be the output of the following code snippet?

element = <xhtml:p xmlns:xhtml=”http://www.example.org”>Kibology
for all.</xhtml:p>;
elementName = element.name();
alert(elementName.localName); //1
alert(elementName.uri); // 2

Answers:

  1. 1-p,2-http://www.example.org
  2. 1-http://www.example.org,2-p
  3. 1-http://www.example.org,2-http://www.example.org
  4. 1-p,2-p

14. Which of the following is not a valid built-in method for XMLList objects in E4X?

Answers:

  1. attributes()
  2. descendants([name])
  3. hasOwnProperty(propertyName)
  4. append()

15. Which of the following is not a reserved keyword in E4X and JavaScript?

Answers:

  1. volatile
  2. transient
  3. super
  4. version
  5. synchronized

16. State whether true or false:

An arbitrary xml file can be loaded as an E4X ready object.

Answers:

  1. True
  2. False

17. Which of the following settings are there in E4x to influence parsing and serialization?

element = <xhtml:p xmlns:xhtml=”http://www.example.org”>Kibology
for all.</xhtml:p>;
elementName = element.name();
alert(elementName.localName); //
alert(elementName.uri); //

Answers:

  1. ignoreComments
  2. ignoreProcessingInstructions
  3. ignoreWhitespace
  4. All of the above

18. Which of the following options would be returned by the code shown in the code snippet:

var f =
<foo>
<a>
text
</a>
<a>
<b/>
</a>
</foo>;
alert(f.a[0].hasComplexContent());// p
alert(f.a[1].hasComplexContent());//q
alert(f.a[0].hasSimpleContent());//r
alert(f.a[1].hasSimpleContent());//s

Answers:

  1. p-false,q-true,r-true,s-false
  2. p-true,q-false,r-false,s-true
  3. p-1,q-0,r-0,s-1
  4. p-0,q-1,r-1,s-0

19. Which of the following options can be used for adding direct support for XML to JavaScript?

Answers:

  1. E4X
  2. regex
  3. Generators and Iterators
  4. let

20. What will be the output of the following code snippet?

var customer = <customer>
<phone type=”mobile”>888-555-1212</phone>
<phone type=”office”>888-555-2121</phone>
<preferred>mobile</preferred>
</customer>;
alert(customer.childIndex());

Answers:

  1. 0
  2. 3
  3. NaN
  4. 2

21. Which of the following options is the correct alternative to the code snippet so as to get the given output?

Code:

var e= <employee>
<name>Smith</name>
<designation>S/w Engineer</designation>
</employee>
e.prependChild(<prefix>Mr.</prefix>);
alert(e.toString());

Output:

<employee>
<prefix>Mr.</prefix>
<name>Smith</name>
<designation>S/w Engineer</designation>
</employee>

Answers:

  1. e.insertChildAfter(null,<prefix>Mr.</prefix>);
  2. e.insertChildBefore(<prefix>Mr.</prefix>);
  3. b.e.insertChildAfter(null,<prefix>Mr.</prefix>);
  4. b.e.insertChildBefore(null,<prefix>Mr.</prefix>);

22. Which of the following are not global methods and properties in E4X?

Answers:

  1. ignoreComments
  2. ignoreWhiteSpace
  3. setName()
  4. setNamespace()
  5. a and b
  6. c and d

23. Which of the following is not true of the Namespace constructor in E4X?

Answers:

  1. If the value of the prefixValue parameter is undefined, the prefix is set to undefined.
  2. If the value is a valid XML name, the prefix property is set to a string.
  3. If the value is not a valid XML name, the prefix property is set to undefined.
  4. If a QName object is passed, the uri property is set to the value of the QName object’s uri property.

24. Which of the following is the correct way to create an XML object in E4X?

Answers:

  1. var languages = new XML(‘<languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>’);
  2. var languages XML = new XML(‘<languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>’);
  3. var languages = <languages type=”dynamic”> <lang>JavaScript</lang> <lang>Python</lang> </languages>;
  4. All of the above are correct.
  5. a and c
  6. b and c

25. State whether true or false:

The QName.prototype.toString() method throws a TypeError exception if its value is not a QName object.

Answers:

  1. True
  2. False

26. Which of the following can be used to create attribute values by placing variables and expressions within them?

Answers:

  1. []
  2. ()
  3. {}
  4. <>

27. Which of the following options is used to access the attributes in E4X?

Answers:

  1. @
  2. ::
  3. #
  4. *

28. What is the correct way to add a method to an XML.prototype in E4X?

Answers:

  1. XML.prototype.function::methodName
  2. XML.prototype.function::[methodNameString]
  3. XML.prototype.method::[methodNameString]

29. Which of the following options can be used to delete a child node of an XML object in E4X?

Answers:

  1. delete xmlobject.child;
  2. delete xmlobject.child[0];
  3. delete xmlobject.@attribute;
  4. All of the above

30. Which of the given options represents the correct length when alert(Emp..*.length()); is applied to the following code?

var Emp = <Emp>
<name>Mark</name>
<likes>
<os>Linux</os>
<browser>Firefox</browser>
<language>JavaScript</language>
<language>Python</language>
</likes>
</Emp>

Answers:

  1. 11
  2. 5
  3. 7
  4. 12

665 total views, 1 views today