oDesk Wordpress Test Answers-2015

In this stock quote api for wordpress of yahoo http://download/finance.yahoo.com/d/quotes.cav? what does a' stand for?
Ans: Stock symbol


Which of the following code snippets best protects a system from SQL injections?

Ans: Sql_real_escape_string()


Which of the following codes will return the current plugin directory in WordPress?
Ans:a. <?php plugin_basename($file); ?> 


Which of the following code snippets can be used to create custom POST status in 
wordpress 3.0 +?
Ans:  register_post_status()


How can a post ID be retrieved from the permalink?
Ans:  url_to_postid($permalink) 


Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?
Ans:  switch_to_blog()


Which conditional tag checks if the dashboard or the administration panel is attempting to be displayed by returning "true' (if the URL being accessed is in the admin section) or "false" (for a front-end page).
 Ans: is_admin()


Which of the following functions can be used to create a WordPress page?
Ans: wp_insert_post()


Which of the following is the correct way to retrieve a featured image from a post?
 Ans: <?php echo get_the_post_thumbnail$post_id$size$attr ); ?> 


Which of the following methods can be used to make permalinks SEO friendly?
 Ans:D) Configuring the features in the admin settings (Answer)


Which of the following functions are used to add administration menu item in WordPress ?
Ans: add_menu_page();


How can a Wordpress template be integrated inside a codeigniter framework using  Wordpress functions like wp_header, wp_footer, wp_sidebar?
Ans:  Include the file wp-blog-header.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter's view.


Which of the following is an example of a WordPress plugin that provides multilingual capabilities?
Ans: qTranslate


Which of the following will hash a string/password to its md5 equivalent?
Ans: b.wp_generate_password()


How can the upload media panel be included in a Wordpress template/plugin?
Ans:  By using function wp_enqueue_script('media-upload');


How can a user be found through its meta data?
Ans: d. get_users($args)


Which function is used to display the name of current page in wordpress?
Ans:  get_the_title()

Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?
Ans:a)  1. Use $wpdb to iterate through all blogs
               2. Hook according to the $blog_id
               3. Install the plugin as Network only
               4. Uninstall depends the specific plugin


Which of the following role levels has the highest privilege?
 
Ans: b. Level_10

What is the output of the following code?
[sourcecode language="r"]


Your R code and
comments
x <- rnorm(100)
y <- x + 10
[/sourcecode]

Answer: embed R in blog post


Which of the following will give the option to add inline Ajax for comment posting?

Ans: Using the Ajax Comment Posting Plugin


What is the output of the following code?

    example 1
   
    example 2

    example 3

    example 4


    $(document).ready(function() {
     $('#sortable').sortable({
    update: function(event, url) {
        var newOrder = $ (this).sortable('toArray').toString();
        $.get('saveSortable.php', {order:newOrder});
        }
      });
});  
Answer: b. Saves sortable positions to data base
based on the user input


Which of the following is a quick way to move a Wordpress website from one server to another?
Ans:  b.  Copying wordpress files and database from source to destination server



What is the right order (by priority in use) to display page in Template Hierarchy?
Ans:  a. page-{slug}.php, page-{id}.php, page.php, index.php


Is super cache a built-in plugin of Wordpress?
Ans: No


One possible way to collect real-time statistics about traffic to a WordPress site is to …………..

Ans:a) use a built-in tool
         b) use a plug-in
         c) use a widget
         d) None of the above


Which of the following is the correct way to print the slug property of $firstTag object in 
this code snippet?
 
Ans: $firstTag->slug


Meta tags can be added to WordPress pages by ________________.
Ans:  a) using plug-ins


What is the BEST way to get last inserted row ID from Wordpress database ?
Ans: d. Straight after the $wpdb->insert()  insert, the following code should be added;
Ans:$last id = $wpdb->insert_id() ;


What is the first action you need to take for enabling WordPress MU feature?

Ans: c.       Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );


User Level 7 converts to _________?
 Ans:User Level 7 converts to Editor


How can the Name link be disable from the Wordpress top nav?
Ans:  using jquery to hide it.
 

Which of the following code snippets will create plugins back-end page without showing it 
as menu item?
Ans:b.  add_menu_page with parent slug = null
   d.  add_menu_page without parent slug = null


A possible way to allow the display of several authors' names on one post is to ______
Ans:  Use a plug-in


On which of the following databases can WordPress be installed by default?
Ans:  MySQL


Which of the following correctly creates a custom taxonomy page of custom post type order by terms?
Answer:
b)
<?php
$taxonomy = ‘vc-memorial’;
$term_args=array(
  orderby‘ => ‘name’,
  order
=> ‘ASC’
);
$terms = get_terms($taxonomy,$term_args);
    if( $my_query->have_posts()
) { 
 ?>
      <div
class=”category section”>
            <h3><?php echo ‘Category ‘.$term->name;?></h3>
            <ul>
            <?php
      while ($my_query->have_posts())
: $
my_query->the_post();
?>
        <li><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to
<?
php the_title_attribute();
?>”><?
php the_title();
?></a></
li>
        <div><?php the_excerpt ?></div>
       <?php
      endwhile;
      ?>
      </ul>
      </div>
 <?php
    }
  }
}
wp_reset_query();
?>


Why is WordPress considered to be poorly programmed? 
1. Because there are issues that impede coders trying to work with it ex: get_the_content() and get_permalink() 
2. Flaws in get_header(),get_footer(),get_siderbar() 
3. Due to memory usage issues. 4. Having built in caching . Select from the following answers:
Ans:  1,4,2


What should be done if a fatal error message “Out of Memory” is received while adding a newpost in WordPress?
Answer:c) Add define(‘…’); to your wp-config.php file.


Which of the following functions are used when adding CSS and jQuery codes on a  
WordPress plugin?
Note:There may be more than one right answer.

Ans:  wp_enqueue_scripts


Which of the following is the correct code to get an array of every image uploaded to a particular post?
Ans: B. $images = wp_get_attachment_url(get_post_thumbnail_id($post->ID) );


Which of the following code snippets will create plugins back-end page without showing it as menu item?
Ans: b add_menu_page with parent slug = null


Which of the following commands can change the ownership of Wordpress directory to www-data (for Apache)?
Ans:  Answer:sudo crown -Df www-data *


Which of the following actions cannot be hooked in with add_submenu_page() function?
Ans:  admin_menu


How would you integrate Wordpress Tiny NCE editor with a plugin?
Ans:  wp_editor( $content, $id );


Which of the following is the correct way to assign a category to a Wordpress post?
Ans: wp_set_post_categories($postId,$categories)
 

Which of the following is the correct way to redirect the default login and registration page URL to a custom login registration page URL?
Ans: 

_____________ can publish, edit, and delete their own posts. They cannot write pages. They can upload some kinds of media files, and they are allowed to use only the limited set of HTML tags.
 Ans: b, Author



How can Wordpress comments be saved in Markdown format?
Ans:  <?php add_filter('comment_text', 'Markdown'); ?>



Which of the following methods can be used to make permalinks SEO friendly?
Ans: Configuring the feature in the admin settings.


Are categories and tags available for pages?
<b>Note</b>  Categories must have distinct slugs, Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.
Ans:  Yes


How can a custom content filter be added?
Ans:  By using add_filter( 'the_content', 'my_custom_filter' );


Which of the following will correctly load localized (translated) text for a Wordpress plugin?
Ans:  D. function load_theme_textdomain(‘tutsplus’,  $lang_dir);  {
                        $lang_dir = get_template_directory()  .  ‘/lang’);
                          Custom_theme_setup();
                }
                Add_action(‘after_setup_theme’,  ‘custom_theme_ setup’);



Which of the following is the correct way to get Wordpress Post ID from the Post title?
Ans:  <?php $page = get_page_by_title( 'About' );
wp_pages( 'exclude=' . $page->ID );


Which of the following is a quick way to move a Wordpress website from one server to another?
Ans:b. Copying wordpress files and database from source to destination server


Which of the following codes will return the current plugin directory is Wordpress?
Ans:a. <?php plugin_basename($file);   ?>


How can the upload media panel in a Wordpress template/plugin?
Ans:a. By using function wp_enqueue_script(‘media_upload’)


What should be done if a fatal error message “Out of Memory” is received while adding a new
post in
 WordPress?
Answer:c) Add define(‘…’); to your wp-config.php file.


Which of the following code snippets best protects a system from SQL injections?
Ans: Sql_real_escape_string()