0
Alien head

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

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

  1. True

  2. False


Correct Option: A

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

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

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: int a1 = 5; double a2 = (float)a1;

  1. Compilation error

  2. Runtime error

  3. No errors

  4. Compilation error at statement 2


Correct Option: C

An application can have more than 2 Global.asax files.

  1. True

  2. False


Correct Option: B

The different types of assemblies are private, public, shared, unshared, satellite.

  1. True

  2. False


Correct Option: B

what are the namespace/classes related Database operation?

  1. System.Data

  2. System.Data.Dataset

  3. System.Data.SQLClient

  4. System.Data.Datareader


Correct Option: A,C

Which of the following are said to be assemblies.

  1. .vb

  2. .dll

  3. .aspx

  4. .exe


Correct Option: B,D

Select the events available for a gridview/datagrid

  1. RowDataBound

  2. ItemDataBound

  3. RowClick

  4. ItemClick


Correct Option: A,B

What will be the output ? my $pattern = '.*'; $str =~ /(\Q$pattern\E)/;

  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

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

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

What will be the value of $str ? my $str = '112133'; $str =~ s/(.)\1/$1/g;

  1. 112133

  2. 1233

  3. 1213

  4. 12133


Correct Option: C

What will be the output ? my $str = 'a\b\n'; print $str;

  1. ab(newline)

  2. a\b\n

  3. a\b(newline)

  4. a\b\n


Correct Option: D

What will be the value of $keys ? my $var; if (exists $var->{key1}->{key2}) { $var->{key1}->{key2} = 1; } my $keys = keys(%{$var});

  1. code will fail

  2. 2

  3. 1

  4. undef


Correct Option: C

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 be the size of the @data array ? my $var = ':x:y:z:'; my @data = split(':', $var, -1);

  1. 0

  2. 3

  3. 1

  4. 5


Correct Option: D

What will be the output ? my $val = bless {}, 'MyClass'; print ref($val);

  1. TRUE

  2. MyClass

  3. 1

  4. Object Reference


Correct Option: B

What will be output ? my $val = 'x'; print ref($val);

  1. STRING

  2. SCALAR

  3. Empty Value

  4. Not a Reference


Correct Option: C
+ View questions