Programming Languages and OOP Concepts

Quiz covering Object-Oriented Programming concepts, ASP.NET web development, Java programming, and SQL queries.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

System.out.format("Pi is approximately %d.", Math.PI); What is the result?

  1. Compilation fails
  2. Pi is approximately 3
  3. Pi is approximately 3.141593
  4. An exception is thrown at runtime
Question 2 Multiple Choice (Single Answer)

NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); nf.setMinimumFractionDigits(2); String a = nf.format(3.1415926); String b = nf.format(2); Which statement is true about the result?

  1. The value of b is 2
  2. The value of b is 2.00
  3. The value of a is 3.141
  4. The value of a is 3.1415
Question 3 Multiple Choice (Single Answer)

public class Yippee2 { static public void main(String [] yahoo) { for(int x = 1; x < yahoo.length; x++) { System.out.print(yahoo[x] + " "); } } } and the command line invocation: java Yippee2 a b c What is the result?

  1. a b
  2. b c
  3. a b c
  4. Compilation fails
Question 4 Multiple Choice (Single Answer)

public static void main(String[] args) { String str = "null"; if (str == null) { System.out.println("null"); } else (str.length() == 0) { System.out.println("zero"); } else { System.out.println("some"); } } What is the result?

  1. null
  2. zero
  3. some
  4. Compilation fails
Question 5 Multiple Choice (Single Answer)

SELECT address1||','||address2||','||address2 "Adress" FROM employee;

  1. 1
  2. 2
  3. 3
  4. 0
Question 6 Multiple Choice (Single Answer)

Which of the following languages can be used to write server side scripting in ASP.NET?

  1. c#
  2. VB
  3. C++
  4. A & B
Question 7 Multiple Choice (Single Answer)

When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.

  1. HTML
  2. XML
  3. WML
  4. JSP
Question 8 Multiple Choice (Single Answer)

To add a custom control to a Web form we have to register with.

  1. TagPrefix
  2. Name space of the dll that is referenced
  3. Assemblyname
  4. All of the above
Question 9 Multiple Choice (Single Answer)

What's the difference between Response.Write() andResponse.Output.Write()?

  1. Response.Output.Write() allows you to flush output
  2. Response.Output.Write() allows you to buffer output
  3. Response.Output.Write() allows you to write formatted output
  4. Response.Output.Write() allows you to stream output
Question 10 Multiple Choice (Single Answer)

The number of forms that can be added to a aspx page is.

  1. 1
  2. 2
  3. 3
  4. more than 3
Question 11 Multiple Choice (Single Answer)

How do you manage states in asp.net application

  1. Session object
  2. Application object
  3. View state
  4. All of the above
Question 12 Multiple Choice (Single Answer)

What is the program design method we learned in order to write Object Oriented Programs?

  1. Declare - Define - Use
  2. Public functions and private variables
  3. Top - Down programming
  4. Bottom - Up programming
Question 13 Multiple Choice (Single Answer)

Which is a logical abstract base class for a class called "footballPlayer"?

  1. Salary
  2. Sport
  3. Athlete
  4. Team
Question 14 Multiple Choice (Single Answer)

A recursive function would result in infinite recursion, if the following were left out:

  1. Base case
  2. Recursive call
  3. Subtraction
  4. Local variable declarations
Question 15 Multiple Choice (Single Answer)

Can two classes contain member functions with the same name?

  1. No
  2. Yes, but only if the two classes have the same name
  3. Yes, but only if the main program does not declare both kinds
  4. Yes, this is always allowed
Question 16 Multiple Choice (Single Answer)

A derived class

  1. Inherits data members and member functions from base class
  2. Inherits constructors and destructor
  3. Object can access protected members with the dot operator
  4. Inherits data members and member functions from base class as well as Inherits constructors and destructor
Question 17 Multiple Choice (Single Answer)

_________is a relationship

  1. Polymorphism
  2. Inheritance
  3. Overloading
  4. None of these options
Question 18 Multiple Choice (Single Answer)

Abstract class cannot have ________?

  1. Zero instance
  2. Multiple instance
  3. Both Zero instance & Multiple instance
  4. None of these options
Question 19 Multiple Choice (Single Answer)

Maintaining the state of an object is called____?

  1. Serialization
  2. Persistence
  3. Marshalling
  4. None of these options
Question 20 Multiple Choice (Single Answer)

______ means that both the data and the methods which may access it are defined together in the same unit.

  1. Data hiding
  2. Encapsulation
  3. Data Binding
  4. None of these options