Programming Languages and Database Concepts

Test your knowledge of programming languages including Java, C#, and COBOL, along with .NET framework, SQL queries, and database concepts.

14 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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
Question 2 Multiple Choice (Multiple Answers)
  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
Question 3 Multiple Choice (Single Answer)

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<List<Integer>> table = new List<List<Integer>>();
  2. List<List<Integer>> table = new ArrayList<List<Integer>>();
  3. List<List<Integer>> table = new ArrayList<ArrayList<Integer>>();
  4. List<List, Integer> table = new List<List, Integer>();
  5. List<List, Integer> table = new ArrayList<List, Integer>();
  6. List<List, Integer> table = new ArrayList<ArrayList, Integer>();
Question 4 Multiple Choice (Single Answer)

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
Question 5 Multiple Choice (Single Answer)
  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
Question 6 True/False

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

  1. True
  2. False
Question 7 Multiple Choice (Single Answer)

How many sections are there in data division

  1. 4
  2. 6
  3. 3
  4. 2
Question 8 Multiple Choice (Multiple Answers)

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
Question 9 True/False

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
Question 10 True/False

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

  1. True
  2. False
Question 11 Multiple Choice (Single Answer)

Which is responsible for dot net framework language interoperability

  1. JIT
  2. Language Specific Compiler
  3. MSIL
  4. CTS
Question 12 Multiple Choice (Single Answer)

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
Question 13 Multiple Choice (Single Answer)

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
Question 14 Multiple Choice (Single Answer)

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