0

programming languages Online Quiz - 50

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

A Table can have unlimited indexes.

  1. True

  2. False


Correct Option: A

A Table can have Unlimited Columns.

  1. True

  2. False


Correct Option: B

Min, Default and Max size of DBMS Output Buffer is ?

  1. 1 - 10,000 - 1,000,000

  2. 1 - 10,000 - 100,000

  3. 1 - 20,000 - 100,000

  4. 1 - 20,000 - 1,000,000


Correct Option: D

The file init.ora is available at the location ?

  1. $Oracle_home/data

  2. $Oracle_home/dbs

  3. $Oracle_home/dba

  4. $Oracle_home/db


Correct Option: B

The Files tnsnames.ora, listener.ora and sqlnet.ora are available at the location ?

  1. $Oracle_home/network/administrator

  2. $Oracle_home/db/administrator

  3. $Oracle_home/network/admin

  4. $Oracle_home/db/admin


Correct Option: C

Maximum number of datafiles per DB are ?

  1. 128,000

  2. 64,000

  3. 32,000

  4. 16,000


Correct Option: B

import java.util.regex.; class Regex2 { public static void main(String[] args) { Pattern p = Pattern.compile(args[0]); Matcher m = p.matcher(args[1]); boolean b = false; while(b = m.find()) { System.out.print(m.start() + m.group()); } } } And the command line: java Regex2 "\d" ab34ef

  1. 234

  2. 334

  3. 2334

  4. 0123456

  5. 01234456

  6. 12334567


Correct Option: E

AI Explanation

To answer this question, let's analyze the given code and the command line arguments.

The code uses regular expressions to search for a pattern in a given input string. The command line argument args[0] is used to define the regular expression pattern, and args[1] is the input string on which the pattern is matched.

In this case, the regular expression pattern is \d*, which matches zero or more consecutive digits.

The input string is "ab34ef".

The code uses a Matcher object m to find matches of the pattern in the input string. The find() method of the Matcher class is used in a while loop to find all occurrences of the pattern.

Inside the while loop, the code prints the start index of each match (m.start()) followed by the matched substring (m.group()).

Let's go through each option to understand why it is correct or incorrect:

Option A) 234 - This option is incorrect because it only includes one occurrence of the pattern. The code will find multiple occurrences of the pattern.

Option B) 334 - This option is incorrect because it only includes one occurrence of the pattern. The code will find multiple occurrences of the pattern.

Option C) 2334 - This option is incorrect because it only includes one occurrence of the pattern. The code will find multiple occurrences of the pattern.

Option D) 0123456 - This option is incorrect because it includes all the digits in the input string, but it doesn't include the non-digit characters. The code will find multiple occurrences of the pattern.

Option E) 01234456 - This option is correct because it includes all the digits in the input string, as well as the non-digit characters. The code will find multiple occurrences of the pattern and print the start index followed by the matched substring for each occurrence.

Option F) 12334567 - This option is incorrect because it doesn't include the non-digit characters in the input string. The code will find multiple occurrences of the pattern.

The correct answer is E. This option is correct because it includes all the digits in the input string, as well as the non-digit characters. The code will find multiple occurrences of the pattern and print the start index followed by the matched substring for each occurrence.

  1. import java.io.*; 4. class Vehicle { } 5. class Wheels { } 6. class Car extends Vehicle implements Serializable { } 7. class Ford extends Car { } 8. class Dodge extends Car { 9. Wheels w = new Wheels(); 10. } Instances of which class(es) can be serialized? (Choose all that apply.)
  1. Car

  2. Ford

  3. Dodge

  4. Wheels

  5. Vehicle


Correct Option: A,B

AI Explanation

To answer this question, let's analyze each class and determine whether instances of these classes can be serialized:

Option A) Car - This option is correct because the class Car extends Vehicle and implements Serializable. When a class implements the Serializable interface, it indicates that instances of that class can be serialized.

Option B) Ford - This option is correct because the class Ford extends Car. Since Car can be serialized, any subclass of Car, such as Ford, can also be serialized.

Option C) Dodge - This option is incorrect because the class Dodge extends Car, which can be serialized. Therefore, instances of the Dodge class can also be serialized.

Option D) Wheels - This option is incorrect because the class Wheels does not implement the Serializable interface. Therefore, instances of the Wheels class cannot be serialized.

Option E) Vehicle - This option is incorrect because the class Vehicle does not implement the Serializable interface. Therefore, instances of the Vehicle class cannot be serialized.

The correct answers are options A (Car) and B (Ford) because instances of these classes can be serialized.

public static void main(String[] args) { // INSERT DECLARATION HERE for (int i = 0; i <= 10; i++) { List row = new ArrayList(); for (int j = 0; j <= 10; j++) row.add(i * j); table.add(row); } for (List row : table) System.out.println(row); } Which statements could be inserted at // INSERT DECLARATION HERE to allow this code to compile and run? (Choose all that apply.)

  1. List> table = new List>();

  2. List> table = new ArrayList>();

  3. List> table = new ArrayList>();

  4. List table = new List();

  5. List table = new ArrayList();

  6. List table = new ArrayList();


Correct Option: B

public static void before() { Set set = new TreeSet(); set.add("2"); set.add(3); set.add("1"); Iterator it = set.iterator(); while (it.hasNext()) System.out.print(it.next() + " "); }

  1. The before() method will print 1 2

  2. The before() method will print 1 2 3

  3. The before() method will print three numbers, but the order cannot be determined

  4. The before() method will not compile

  5. The before() method will throw an exception at runtime


Correct Option: E
  1. import java.util.*; 4. class Dog { int size; Dog(int s) { size = s; } } 5. public class FirstGrade { 6. public static void main(String[] args) { 7. TreeSet i = new TreeSet(); 8. TreeSet d = new TreeSet(); 9. 10. d.add(new Dog(1)); d.add(new Dog(2)); d.add(new Dog(1)); 11. i.add(1); i.add(2); i.add(1); 12. System.out.println(d.size() + " " + i.size()); 13. } 14. }
  1. 1 2

  2. 2 2

  3. 2 3

  4. Compilation fails

  5. Exception occurs at runtime


Correct Option: E

How do you design a website with multilingual support in ASP.NET?

  1. True

  2. False


Correct Option: A

How many sections are there in data division

  1. 4

  2. 6

  3. 3

  4. 2


Correct Option: B

which of the following is mandatory for cobol program.

  1. identification division and program id

  2. identification division and data division

  3. identification division and report section

  4. identification division linkage section and program id


Correct Option: A

close with lock statement closes an opened file and it prevents the file from further being opened by the same program.

  1. True

  2. False


Correct Option: A

SEARCH can be applied to a table which does not have an INDEX defined.

  1. True

  2. False


Correct Option: B

Which is responsible for dot net framework language interoperability

  1. JIT

  2. Language Specific Compiler

  3. MSIL

  4. CTS


Correct Option: C

The above code compiles in __ language?

  1. JAVA

  2. C#

  3. works in java but not in C#

  4. works in C# but not in JAVA

  5. works in both languages


Correct Option: C

Create table temp (name varchar2 (20) , empid integer) ; insert into temp ('abc',100) ; savepoint a; insert into temp ('def' , 100); delete from temp; rollback to a; commit;

  1. 0

  2. 2

  3. error

  4. 1


Correct Option: D

AI Explanation

To answer this question, let's go through each statement and understand its effect on the table:

  1. create table temp (name varchar2(20), empid integer); - This statement creates a table called "temp" with two columns: "name" of type varchar2 with a maximum length of 20 characters, and "empid" of type integer.

  2. insert into temp ('abc', 100); - This statement attempts to insert a row into the "temp" table with the values 'abc' for the "name" column and 100 for the "empid" column. However, the syntax of the insert statement is incorrect. The correct syntax should be insert into temp (name, empid) values ('abc', 100);.

  3. savepoint a; - This statement creates a savepoint named "a" in the current transaction. A savepoint allows you to roll back the transaction to a specific point in time.

  4. insert into temp ('def', 100); - This statement attempts to insert another row into the "temp" table with the values 'def' for the "name" column and 100 for the "empid" column. However, since the previous insert statement had a syntax error, it would have resulted in an error and no rows would have been inserted.

  5. delete from temp; - This statement deletes all rows from the "temp" table.

  6. rollback to a; - This statement rolls back the transaction to the savepoint "a", which was created after the first incorrect insert statement. This means that any changes made after the savepoint will be undone.

  7. commit; - This statement commits the transaction, making all changes permanent. However, since the rollback statement was executed before the commit statement, the changes made after the savepoint "a" were rolled back. Therefore, no rows are inserted into the "temp" table.

Based on the above analysis, the correct answer is D. 1, as only one row was successfully inserted into the "temp" table before the rollback statement.

Which of the following statements is true :

  1. inner join and intersect are same

  2. left join and union are same

  3. inner join when used with distinct can simulate intersect

  4. inner join and union are same


Correct Option: C
- Hide questions