To expand upon my comment:
Top-level page? (q.1)
global $post;
$x = get_ancestors( $post->ID, 'page' );
if( ! $x ) {
// there are no ancestors, therefore this is a top-level page
}
Childless page? (q.2)
global $post;
$args = array(
'post_parent' => $post->ID,
'post_type' => 'page',
);
$x = get_children( $args );
if( ! $x ) {
// there are no children
}
References
NB — this assumes that you’re after WordPress’s page
s. If you want a different post type, replace page
in the code samples with your chose post type’s name.