nerdexam
CompTIA

LX0-102 · Question #162

The following excerpt is from a Perl script that reads a LDAP database and writes a LDIF file: $ldap =Net::LDAP->new( 'ldap.server.com' ); $mesg = $ldap->bind( 'cn=incadmin,o=inc', password =>…

The correct answer is C. $mesg = $ldap->search( base => 'o=inc', scope => 'sub', filter => '(objectclass=*)'). See the full explanation below for the reasoning.

Question

The following excerpt is from a Perl script that reads a LDAP database and writes a LDIF file:

$ldap =Net::LDAP->new( 'ldap.server.com' ); $mesg = $ldap->bind( 'cn=incadmin,o=inc', password => 'secret'); [YOUR ANSWER GOES HERE] Net::LDAP::LDIF->new( *STDOUT,"w" )- >write( $mesg->entries ); $mesg=$ldap->unbind; Which code snippet contains the correct query?

Options

  • A$mesg = $ldap->search(base => 'o=inc',);
  • B$mesg = $ldap->search( base => 'cn=incadmin,o=inc', scope => 'one', filter => '(objectclass=*)' );
  • C$mesg = $ldap->search( base => 'o=inc', scope => 'sub', filter => '(objectclass=*)');
  • D$mesg = $ldap->search( base => 'o=inc', recursive => 'yes', filter => '(*)' );

How the community answered

(15 responses)
  • A
    13% (2)
  • B
    7% (1)
  • C
    73% (11)
  • D
    7% (1)

Community Discussion

No community discussion yet for this question.

Full LX0-102 Practice