WordPress categories can be displayed in a drop down using wp_dropdown_categories. The categories can be displayed in hierarchy which shows the parent and child categories. Dynamic child categories can be displayed using Ajax.
The WordPress Category Dropdown plugin gives this functionality. The plugin gives you a shortcode that will let you display all the categories in a dropdown. You can select the parent category and the child categories for that parent will be displayed in another dropdown.
This feature will come in handy when you want to give your users an option to navigate easily through the number of categories you have on your site. You can also set the shortcode to display categories from a custom post type.
The plugin can differentiate between the categories that do and do not have child categories. If the category does not have a child, it automatically will redirect you to the selected category page. If it has child categories, you will see a second dropdown.
If you are using the shortcode, you can use ‘include” to display only the categories with children. If you only have a few categories without children, you can use “exclude” to hide these categories from the dropdown.
The plugin can be downloaded from the WordPress plugins page – https://wordpress.org/plugins/wp-category-dropdown/. Plugin documentation can be found here.
Here is a quick demo of the how the plugin works.