Programming Languages and OOP Concepts
Quiz covering Object-Oriented Programming concepts, ASP.NET web development, Java programming, and SQL queries.
Questions
System.out.format("Pi is approximately %d.", Math.PI); What is the result?
- Compilation fails
- Pi is approximately 3
- Pi is approximately 3.141593
- An exception is thrown at runtime
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?
- The value of b is 2
- The value of b is 2.00
- The value of a is 3.141
- The value of a is 3.1415
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?
- a b
- b c
- a b c
- Compilation fails
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?
- null
- zero
- some
- Compilation fails
SELECT address1||','||address2||','||address2 "Adress" FROM employee;
- 1
- 2
- 3
- 0
Which of the following languages can be used to write server side scripting in ASP.NET?
- c#
- VB
- C++
- A & B
When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.
- HTML
- XML
- WML
- JSP
To add a custom control to a Web form we have to register with.
- TagPrefix
- Name space of the dll that is referenced
- Assemblyname
- All of the above
What's the difference between Response.Write() andResponse.Output.Write()?
- Response.Output.Write() allows you to flush output
- Response.Output.Write() allows you to buffer output
- Response.Output.Write() allows you to write formatted output
- Response.Output.Write() allows you to stream output
The number of forms that can be added to a aspx page is.
- 1
- 2
- 3
- more than 3
How do you manage states in asp.net application
- Session object
- Application object
- View state
- All of the above
What is the program design method we learned in order to write Object Oriented Programs?
- Declare - Define - Use
- Public functions and private variables
- Top - Down programming
- Bottom - Up programming
Which is a logical abstract base class for a class called "footballPlayer"?
- Salary
- Sport
- Athlete
- Team
A recursive function would result in infinite recursion, if the following were left out:
- Base case
- Recursive call
- Subtraction
- Local variable declarations
Can two classes contain member functions with the same name?
- No
- Yes, but only if the two classes have the same name
- Yes, but only if the main program does not declare both kinds
- Yes, this is always allowed
A derived class
- Inherits data members and member functions from base class
- Inherits constructors and destructor
- Object can access protected members with the dot operator
- Inherits data members and member functions from base class as well as Inherits constructors and destructor
_________is a relationship
- Polymorphism
- Inheritance
- Overloading
- None of these options
Abstract class cannot have ________?
- Zero instance
- Multiple instance
- Both Zero instance & Multiple instance
- None of these options
Maintaining the state of an object is called____?
- Serialization
- Persistence
- Marshalling
- None of these options
______ means that both the data and the methods which may access it are defined together in the same unit.
- Data hiding
- Encapsulation
- Data Binding
- None of these options