Java and .NET Programming Fundamentals
A quiz covering fundamental concepts in Java programming (9 questions on syntax, operators, collections, and OOP) and .NET/ASP.NET development (11 questions on web forms, configuration, server-side programming, and page lifecycle)
Questions
What type is a div in asp.net?
- System.Web.UI.HtmlControls.HtmlMeta
- System.Web.UI.HtmlControls.HtmlInputText
- System.Web.UI.HtmlControls.HtmlControl
- System.Web.UI.HtmlControls.HtmlGenericControl
Which two methods are defined by IHttpHandler Interface?
- ProcessRequest and IsReusable
- ProcessResponse and IsReusable
- GenerateRequest and ProcessResponse
- GenerateResponse and ProcessRequest
Both the Page_Load and Page_PreRender events happen with each page Request.What is the difference between these two events?
- The Page_PreRender event is not executed for downlevel browsers.
- The Page_Load event happens before the page has been rendered and the Page_PreRender event happens after the page has been rendered.
- The Page_PreRender event happens after the Page_Load event and after any control events.
- The Page_PreRender event and Page_Load event can be used interchangeably.
You need to write a code segment that transfers the first 80 bytes from a stream variable named stream1 into a new byte array named byteArray. You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named bytesTransferred. Which code segment should you use?
- for (int i = 0; i < 80; i++) { stream1.WriteByte(byteArray[i]); bytesTransferred = i; if (!stream1.CanWrite) { break; }}
- bytesTransferred = stream1.Read(byteArray, 0, 80);
- while (bytesTransferred < 80) { stream1.Seek(1, SeekOrigin.Current); byteArray[bytesTransferred++] = Convert.ToByte(stream1.ReadByte());}
- stream1.Write(byteArray, 0, 80);bytesTransferred = byteArray.Length;
You have determined that your company's website is housed on a web server that cannot handle ASP. What would you do?
- Contact the ISP and have them switch the website to have ASP capability.
- Develop a transition plan first that includes a step-by-step plan on every detail prior to contacting the ISP.
- Have your ISP install the Microsoft FrontPage extensions
- All the above
You want to add ASP capability to your company's website. What is the first thing you would check?
- That all pages are saved in .asp extensions.
- Check that the web server has Microsoft FrontPage extensions installed
- Make sure the web server is capable of hosting ASP pages
- Check the coding and be sure the ASP code is surrounded with
- All of the above
Abandon is an ASP ________ object method.
- server
- request
- session
- response
Which of these page extensions WILL NOT recognize and execute an include file?
- .shtml
- .shtm
- .stm
- .html
What is the transport protocol you use to call a Web service?
- TCP/IP
- UDP
- SOAP
- HTTP
What base class do all Web Forms inherit from?
- Web class
- Page class
- Data class
- Html classs
Which is the best place to store connectionstring in .NET projects ?
- Session
- Cookie
- Web.config
- Variable
Can you call one constructor from another if a class has multiple constructors?
- True
- False
Which of the following lines will compile without warning or error.
- float f=1.3;
- char c="a";
- byte b=257;
- int i=10;
A byte can be of what size?
- -128 to 127
- (-2 power 8 )-1 to 2 power 8
- -255 to 256
- depends on the particular implementation of the Java Virtual machine
What will be printed out if this code is run with the following command line? java myprog good morning public class myprog{ public static void main(String argv[]) { System.out.println(argv[2]); } }
- myprog
- good
- morning
- Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"
Which of the following are keywords or reserved words in Java?
- if
- then
- goto
- case
What will be printed out if you attempt to compile and run the following code ? int i=1; switch (i) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println("default"); }
- one
- one, default
- one, two, default
- default
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?
- s3=s1 + s2;
- s3=s1-s2;
- s3=s1 & s2;
- s3=s1 && s2
You need to create a class that will store unique object elements. You do not need to sort these elements but they must be unique. What interface might be most suitable to meet this need?
- Set
- List
- Map
- Vector
What is the result of the following operation? System.out.println(4 | 3);
- 6
- 0
- 1
- 7