0

programming languages Online Quiz - 83

Description: programming languages Online Quiz - 83
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

What will be the output ? package A; sub new { my $class = shift; return bless {}, $class; } package B; use base 'A'; sub foo { return 'blah'; } package main; my $obj = B->new(); print $obj->foo(), "\n";

  1. blah

  2. Empty String

  3. Can't locate object method "new" via package "B"

  4. None of the above


Correct Option: A

What will the contents of @b array ? my @a = (10, 5, 1); my @b = sort @a;

  1. (1, 5, 10)

  2. (1, 10, 5)

  3. (10, 5, 1)

  4. (5, 10, 1)


Correct Option: B

Sample Code Code: INSERT INTO names VALUES ('John') How do you use the DBI module to execute the above SQL statement? Assume $dbh is the return value from DBI->connect.

  1. my $statement = $dbh->execute("INSERT INTO names VALUES ('John')");

  2. my $statement = $dbh->run("INSERT INTO names VALUES ('John')");

  3. my $statement = $dbh->prepare("INSERT INTO names VALUES ('John')"); $statement->execute;

  4. my $statement = $dbh->sql("INSERT INTO names VALUES ('John')"); $statement->execute;


Correct Option: C
  1. any number of any characters

  2. any number of any characters surrounded by Q and E

  3. literally \Q.*\E

  4. literally .*


Correct Option: D

Select the events available for a gridview/datagrid

  1. RowDataBound

  2. ItemDataBound

  3. RowClick

  4. ItemClick


Correct Option: A,B
  1. System.Data

  2. System.Data.Dataset

  3. System.Data.SQLClient

  4. System.Data.Datareader


Correct Option: A,C
  1. Compilation error

  2. Runtime error

  3. No errors

  4. Compilation error at statement 2


Correct Option: C

Following code will result in: class A { int b = 1; public static void main(String [] args) { System.out.println("b is " + b); }}

  1. Compilation error

  2. Runtime Error

  3. Runtime Exception

  4. Output of b is 1


Correct Option: A

Following code will result in: class A { public static void main(String [] args) {B b = new A(); }} class B extends A {}

  1. Compile error

  2. Runtime Exception

  3. No error

  4. Compile error. Type mismatch: cannot convert from A to B


Correct Option: D

Integer a = new Integer(2); Integer b = new Integer(2); What happens when you do if (a==b)?

  1. Compiler error

  2. Runtime Exception

  3. True

  4. False


Correct Option: D

Methods that are marked protected can be called in any subclass of that class.

  1. True

  2. False


Correct Option: A
- Hide questions