Perl and C++ Programming Quiz
Quiz covering Perl programming concepts including object destruction, string handling, regular expressions, and C++/Java language comparisons
Questions
C++ provides facility to specify that the compiler should match function calls with the correct definition at the run time. This process is called as
- Static binding
- Dynamic binding
- -
- --
In Java, to copy the contents of a to a new Foo object b
- Foo b = a;
- Foo b = a.clone();
- Foo b;b=a;
- -
In C++, this pointer is used by the symbol___
- . (dot)
- ,
- ->
- >
C++ is normally compiled directly to machine code which is then executed directly by the operating system
- True
- False
In Java ,the statement Foo d = c; binds d to reference the same object as c, what will be equivalent statement in C++
- Foo d = c;
- Foo *d = c;
- Foo d; d=c;
- --
/de{0,3}/ matches
- df
- def
- deef
- deeef
- all the above
To copy entire matched sequence
- $&
- $%
- $_
- $@
- $^
$input = “abdce” =~ tr/abc/123 print $input;
- 123
- 123ce
- Cant modify constant item in translation
- 12d3e
- None of the above
$string = “\uhello world!”; print $string; $string = “\Uhello world!”; print $string;
- Hello world HELLO WORLD.
- Hello World HELLO WORLD.
- Hello world HELLO world.
- hello world HELLO WORLD.
package A; sub new { return bless {}, shift; } sub DESTROY { print ref(shift); } package B; use base 'A'; sub DESTROY { my $self = shift; print ref($self); bless $self, 'A'; } package main; my $obj = B->new();
- BA
- AB
- Compilation Error
- Null point reference error