C# and Java Programming Concepts

Quiz covering fundamental programming concepts in C#/.NET and Java, including reflection, collections, OOP principles, bit operations, and JSP tag libraries

13 Questions Published

Questions

Question 1 Multiple Choice (Multiple Answers)

Which of the elements defined within the taglib element of taglib descriptor file are required. Select the two correct answers.

  1. tlib-version
  2. short-name
  3. uri
  4. display-name
Question 2 Multiple Choice (Multiple Answers)

Which of the elements defined within the taglib element of taglib descriptor file are required. Select the two correct answers.

  1. name
  2. description
  3. validator
  4. tag-class
  5. display-name
Question 3 Multiple Choice (Multiple Answers)

Name the element within the tag element that defines the name of the class that implements the functionality of tag. Select the one correct answer.

  1. class-name
  2. tag
  3. class
  4. tag-class
  5. tei-class
Question 4 Multiple Choice (Multiple Answers)

Which of the following will compile without error.

  1. import java.awt.*;package Mypackage;class Myclass {}
  2. package MyPackage;import java.awt.*;class MyClass{}
  3. /*This is a comment /package MyPackage;import java.awt.;class MyClass{}
  4. class Myclass {};import java.awt.*;package Mypackage;
Question 5 Multiple Choice (Multiple Answers)

Which of the following are legal identifiers.

  1. 2variable
  2. variable2
  3. _whatavariable
  4. 3
  5. $anothervar
  6. #myvar
Question 6 Multiple Choice (Single Answer)

What will happen if you try to compile and run the following code? public class Q { public static void main(String argv[]){ int anar[]=new int[]{1,2,3}; System.out.println(anar[1]); }}

  1. 1
  2. Error anar is referenced before it is initialized.
  3. 2
  4. Error: size of array must be defined.
Question 7 Multiple Choice (Multiple Answers)

Which of the following statements are true?

  1. System.out.println( -1 >>> 2);will output a result larger than 10
  2. System.out.println( -1 >>> 2); will output a positive number
  3. System.out.println( 2 >> 1); will output the number 1
  4. System.out.println( 1 <<< 2); will output the number 4
Question 8 Multiple Choice (Single Answer)

Given the following declarations String s1=new String("Hello")String s2=new String("there");String s3=new String(); Which of the following are legal operations?

  1. s3=s1 + s2;
  2. s3=s1-s2;
  3. s3=s1 & s2;
  4. s3=s1 && s2
Question 9 Multiple Choice (Single Answer)

If you want to use USER32.DLL in your program, which namespace you should use:

  1. System.Collections.Generic
  2. System.Reflection
  3. Microsoft.Office.Interop
  4. None of the above
Question 10 Multiple Choice (Single Answer)

When you need to perform complex calculations or access external resources in SQL Server 2005, which one of the following programming methods do you use?

  1. SQL Server Management Studio
  2. CLR User Defined Type
  3. CLR Stored Procedure
  4. T-SQL View
Question 11 Multiple Choice (Single Answer)

Consider following statements: 1. System.Collections.ArrayList can store values of only single data type 2. System.Collections.ArrayList can store values of multiple data types 3. System.Collections.Generic.List can store values of multiple datatypes 4. System.Collections.Generic.List can store values of only single data type Which of the above is false:

  1. Only 2
  2. Both 1 and 3
  3. 4
  4. Both 2 and 4
Question 12 Multiple Choice (Single Answer)

Which of the following is true:

  1. It is possible for a single class to implement multiple interfaces
  2. It is possible for a class to inherit from multiple classes
  3. It is possible for a class to inherit from a Sealed class
  4. All of above
Question 13 Multiple Choice (Single Answer)

Which of the following is not true about Reflection (System.Reflection and inherited classes):

  1. To get information about event-handler
  2. To get or set property values
  3. Classes in other namespace can use reflection to access data and to determine which fields to persist
  4. None of the above