Monday 21 March 2016

WordPress Upwork test answers of 2015-16

30  Questions  Answered  of  Upwork  Test 

 

1. Which of the following will hash a string/password to its md5
 equivalent?
Answers:
• md5()
• wp_generate_password()
• wp_generate_md5()
• password_md5()
2. Which conditional tag checks if the dashboard or the administ-
ration 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).
Answers:
• my_admin()
• view_admin()
• is_admin()
• root_admin()
3. Which of the following functions are used to add administrat-
ion menu item in WordPress ?
Answers:
add_menu_page();
• add_admin_item();
• add_admin_page();
• add_admin_option();
4. Which of the following WordPress Multisite functions allows 
for getting content from one blog and display it on another?
Answers:
• switch_blog()
• switch_to_blog()
• restore_current_blog()
• restore_to_current_blog()
5. What is the BEST way to get last inserted row ID from Word-
press database ?
Answers:
• Use the following code snippet $lastid->$wpdb=$last->get_row;
• The call to mysql_insert_id() inside a transaction should be added: mysql_query('BEGIN'); // Whatever code that does the insert here. $id = mysql_insert_id(); mysql_query('COMMIT'); // Stuff with $id.
• The following code snippet should be added $last = $wpdb->get_row("SHOW TABLE STATUS LIKE 'table_name'"); $lastid = $last->Auto_increment;
Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;

6. Which of the following code snippets can be used to create 
custom POST status in wordpress 3.0 +?
Answers:
• register_new_post()
• register_post_status()
• add_new_post_status()
• modify_post_status()
 
7. Which of the following is an example of a WordPress plugin 
that provides multilingual capabilities?
Answers:
• WP Super Cache
• qTranslate
• BuddyPress
• Hotfix
8. Which of the following functions can be used to create a 
WordPress page?
Answers:
• wp_insert_post()
• wp_insert_page()
• wp_create_post()
• wp_create_page()
 
9. User Level 7 converts to _________?
Answers:
• Contributo
• Autho
• Edito
• Subscribe
• Administration
 
10. Which of the following is the correct sequence of steps to 
adapt a WordPress plugin to a multisite?
Answers:
• 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
• 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. IInstall the plugin as Network only 4. Uninstall depends the specific plugin
• 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install other activations except Network 4. Uninstall is the same for all the plugins
• 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install the plugin as Network only 4. Uninstall is same for all the plugins
11. On which of the following databases can WordPress be install-
ed by default?
Answers:
• MySQL
• Oracle Database
• Microsoft SQL Server
• PostgreSQL
12. Meta tags can be added to WordPress pages by ________________.
Answers:
• using plug-ins
• adding them to the header.php file
• updating the database
• a and
• and c
13. Which of the following codes will return the current plugin 
directory in WordPress?
Answers:
• <?php plugin_basename($file); ?>
• <?php plugin_basename('url'); ?>
• <?php bloginfo_plugin('url'); ?>
• <?php content_plugin_url( $path ); ?>
 
14. Can the contents of the wp-content folder be moved or renamed
 without changing any settings?
Answers:
• Yes
• No
15. Which of the following code snippets best protects a system 
from SQL injections?
Answers:
• sql_real_escape_strong()
• mysql_real_escape()
• mysql_real_escape_string()
• mysql_not_real_delete_string()
16. Which of the following role levels has the highest privilege?
Answers:
• Level_0
• Level_10
• Depends on your settings.
• Every role level has the same privilege.
 
17. Which of the following is the correct way to retrieve a feat-
ured image from a post?
Answers:
• <?php echo get_post_thumb($page->ID, 'thumbnail'); ?>
• <?php echo get_featured_image($page->ID, 'thumbnail'); ?>
• <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
• <?php echo get_post_thumbnail($page->ID, 'thumbnail'); ?>
18. Which of the following will call the WordPress media upload-
er form element?
Answers:
• <form enctype="multipart/form-data" method="post" action="<?=bloginfo("siteurl");?>/wp-admin/media-upload.php?inline=&upload-page-form=" class="media-upload-form type-form validate" id="file-form">
• <a onclick="return false;" title="Upload image" class="thickbox" id="add_image" href="media-upload.php?type=image&TB_iframe=true&width=640&height=105">Upload Image</a>
• <a href="media-upload.php?type=image&TB_iframe=true&width=640&height=105">Upload Image</a>
• <form enctype="multipart/form-data" method="post" action="<?=bloginfo("bloginfo");?>/wp-admin/media-upload.php?inline=&upload-page-form=" class="media-upload-form type-form validate" id="file-form">
19. Which of the following code snippets is the correct way to 
get content from Tinymce via javascript ?
Answers:
• document.getElementById('content')
• tinymce.activeEditor.getContent();
• tinymce.element.getContent();
• document.getElement('tinymce_content')
20. What is the first action you need to take for enabling Word-
Press MU feature?
Answers:
• Enable WordPress MU feature on admin panel
• Enable Network feature
• Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );

21. You can limit the number of revisions WordPress stores by _____
Answers:
• adding the following line to your wp-config.php file: define('WP_POST_REVISIONS', 3);
• using a plugin
• changing a setting on admin panel
22. ____________ can publish, edit, and delete posts and pages 
written by any user. They can upload some kinds of files, and 
they can write HTML without restrictions. They can manage links 
and categories, and they can moderate comments. Editors and admini-
strators are also the only users allowed to read private posts and
 pages.
Answers:
• Contributor
• Author
• Editor
• Subscriber
• Administrator
22. Which of the following will show the most recent post (by
 date) from a custom taxonomy?
Answers:
• select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = 'post-series' group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
• select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = 'post-series' group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
• select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
• select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = 'post-series' group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
23. What is the output of the following code?

<ul id="sortable">
    <li id="1">example 1</li>
    <li id="2">example 2</li>
    <li id="3">example 3</li>
    <li id="4">example 4</li>
</ul>

$(document).ready(function(){
    $('#sortable').sortable({
        update: function(event, ui) {
            var newOrder = $(this).sortable('toArray').toString();
            $.get('saveSortable.php', {order:newOrder});
        }
    });
});
Answers:
• Removes positions from data base based on the user input
• Saves sortable positions to data base based on the user input
• Adding new sortable positions from another data base
• Sorting out existing positions without updating the data base with the new user inputs
24. Which of the following commands can change the ownership 
of WordPress directory to www-data (for Apache)?
Answers:
• sudo chown -Rf www-data *
• chown -Rf www-data *
• sudo crown -Df www-data *
• Alldo chown -Rf www-data *
25. How can a post ID be retrieved from the permalink?
Answers:
• Its not possible to retrieve the post ID from a permalink due to its structure.
• It can be retrieved by using a Regular Expression.
• wp_get_post_id($permalink)
• url_to_postid($permalink)
26. Which of the following is the correct way to redirect 
the default login and registration page URL to a custom login
 and registration page URL?
Answers:
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { return('Your custom url'); exit(); } }
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_redirect('Your custom url'); exit(); } }
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { redirect('Your custom url'); exit(); } }
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_return('Your custom url'); exit(); } }
27. What is the first action you need to take for enabling 
the WordPress multisite (MS) feature?
Answers:
• Enable the WordPress multisite feature on admin panel
• Enable the Network feature
• Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );
28. Which of the functions below is required to create a
 new taxonomy?
Answers:
• add_taxonomy
• register_taxonomy
• create_taxonomy
29. ____________ can manage their own profiles, but can do
 virtually nothing else in the administration area.
Answers:
• Contributor
• Author
• Editor
• Subscriber
• Administrator
30. Which of the following functions are used when adding CSS
 and jQuery codes on a WordPress plugin?
Answers:
• wp_register_style
• wp_enqueue_style
• wp_enqueue_script
• None of these.

No comments:

Post a Comment