Você está na página 1de 391

Which of the following are not core feature of .

NET framework: answer:Wrap a sane subset of the raw Win32 API behind a number of classes, magic macros, and numerous code-generation tools. Building Blocks of the .NET Platform includes: answer:[3]:[1]Common Language Runtime (CLR)[2]Common Type System (CTS)[3]Common Language Specification (CLS). .NET-Aware Programming Languages are: answer:[3]:[1]C#[2]VB.NET[3]Managed Extensions for C++ Select correct statements about Common Intermediate Language (CIL): answer:[2]:[1]CIL is a CPU-independent language[2]CIL is converted to CPU-specif ic code by a just-in-time (JIT) compiler. System.Byte is: answer:Intrinsic CTS Data Type ..are the .NET equivalents of a type-safe C-style function pointer. answer:Delegates public class Calc { public int Add(int x, int y) { return x + y; } } The above code snippet declares: answer:CTS Class Type is a set of rules that describe in vivid detail the minimal and complete set of featu a given .NET-aware compiler must support to produce code that can be hosted by the CLR. answer: Common Language Specification Which tool provides dozens of options that allow you to debug your assembly? answer:vbc.exe Select correct statements about Integrated Development Environments (IDEs): answer:[2]:[1]Visual Studio 2005 and SharpDevelop provide Windows Forms Designer s.[2]Visual C# 2005 Express offers tools to simplify access to XML web services What is output if the below code snippet is executed: answer:$99,989.99 Which of the following statements about visibility are true: answer:[2]:[1]PublicMethod() is accessible anywhere.[2]ProtectedMethod() is acce ssible from SomeClass and any descendent. C# Parameter Modifiers include: answer:[3]:[1]in[2]ref[3]param ..statement is used to iterate through the collection to get the information that you want answer:foreach Which of the following features are right to Value Types: answer:[2]:[1]Allocated on the stack.[2]Variables of reference type die when the y fall out of the defining scope. Data encapsulation can be implemented using: answer:All of the others. Select correct statements about Inheritance in C#: answer:[2]:[1]An interface can derive from multiple interfaces.[2]A class can im plement multiple interfaces. In C#, it is possible to define a type (enum, class, interface, struct, or deleg ate) directly within the scope of a class or structure. answer: True If a base class wishes to define a method that may be overridden by a subclass, it must specify the method as .: answer:virtual Which of the following statements about casting are correct: answer:None of the others. A .NET assembly contains the following elements: answer:[3]:[1]Type metadata.[2]An assembly manifest.[3]CIL code.

The documents each module within the assembly, establishes the version of the assemb ly, and also documents any external assemblies referenced by the current assembl y answer:manifest An assembly contains that completely describes the format of the contained types as well as the format of external types referenced by this assembly. answer:metadata are required to be located within the same directory as the client application (term the application directory) or a subdirectory thereof. answer:Private assemblies Which assemblies can be configured using client *.config file. answer:[2]:[1]Private assemblies[2]Shared Assemblies Select right statements: answer:[2]:[1]A .NET process hosts one to many application domains.[2]Each AppDo main is able to host any number of related .NET assemblies A delegate type maintains three important pieces of information: answer:All of the otherss abstract modifier can be used with answer:[3]:[1]Classes[2]Methods[3]Properties The above code snippet can cause: answer:Compile time error. Abstract classes have the following features: answer:[2]:[1]An abstract class cannot be instantiated.[2]An abstract class may contain abstract methods Which format can be used to serialize Objects: answer:[3]:[1]BinaryFormatter[2]SoapFormatter[3]XmlSerializer .NET Remoting can be applied to two objects communicating in any of the followin g manners: answer:All of the others. In .NET Remoting, Clients and server objects do not communicate via a direct con nection, but rather through the use of an intermediary termed a . answer:proxy Which of the following types are of control? answer:[2]:[1]Button[2]Textbox Which of the following type is different from the others? answer:[1]Form[2]TextBox[3]Data Set When the user close the Form, which of the following events will occur? answer:[2]:[1]Closing[2]Closed Which method is designed specifically for singleton queries (such as result of a ggregate functions). answer:ExecuteScalar() Which method help protect against SQL injection attacks: answer:All of the others. Which of the following options is Server-Side State Management: answer:[2]:[1]Application State[2]Session State Which of the following features are advantages of single-file page model: answer:[3]:[1]Easier to deploy...[2]Easier to rename because ...[3]Managing file s in a... An instance of the HttpRequest class type can be used to: answer:[3]:[1]get a collection of cookies ...[2]get a collection of Form ..[3]ge t the collection of HTTP query string variables. Cookies can be accessed through answer:[2]:[1]The Response property of the Page class.[2]The Request property of the Page class. Buttons, Textboxes, Listboxes are .. answer:Simple controls Which control is used to determine a given value is in a predetermined range. answer:RangeValidator Which class enables you to share global information across all users (and all pa ges)?

answer:HttpApplicationState Which of the following server-side methods can be used on the HttpServerUtility to navigate to a different Web page without requiring a round trip to the client ? answer:Transfer You need to store a users user name and password as he or she navigates to differ ent pages on your site so that you can pass those credentials to back-end server s. Which type of state management should you use? answer:Server-side state management You need to write data to a database before a users session times out. Which even t should you respond to? answer:Session_End When the OleDbConnection object should be used? answer:[2]:[1]When connecting to an Office Access database[2]When connecting to SQL Server 6.x. What is the minimal information needed by a connection string to open a connecti on to a SQL Server 2000 or SQL Server 2005 database? answer:[2]:[1]A valid data source[2]Appropriate credentials or Integrated Securi ty settings What happens when you call the Close method of a connection object? answer:[2]:[1]The connection is returned to the connection pool.[2]The StateChan ge event is fired.[3]All non-committed pending transactions are rolled back. How do you execute multiple SQL statements using a DataReader? answer:Set the Command.CommandText property to multiple SQL statements delimited by a semicolon. What is a DataSet? banswer:[2]:[1]A collection of DataTable and DataRelation objects[2]An in-memory cache of data What are the three main objects when working with a DataSet? answer:DataTable, DataColumn, and DataRelation What object would you set the properties on to create a primary key for a DataTa ble? answer:DataColumn How do you configure a DataAdapter to save changes back to a database? answer:[2]:[1]Instantiate a CommandBuilder[2]Assign a valid Command object What DataTable event would you handle to validate for an acceptable value in a c olumn? answer:[2]:[1]ColumnChanging[2]RowChanging What are the main objects that make up a DataAdapter? answer:[2]:[1]Connection[2]Command Which statement that is used to replace multiple if statements is called? answer:The case statement. Which of the following is not a C# keyword? answer:implements Hiding the implementation and exposing the interface is a concept of OOP called: answer:Encapsulation Which of the following statements is true? answer:An object is the instantiation of a class. Which is a definition of a static method? answer:public static void MethodA() Which of the following keyword is used to extend or modify the abstract or virtu al implementation of an inherited method, property, indexer, or event? answer:override Given the following program, what is the outcome when you try to compile and run it? answer:ConsoleApplication1.Program.Main () : not all code paths return a value. What is the output when compiling and running the following code? answer:504 Which of the following statements are true? answer:Default value of reference type is null

Which of the following statements are false? answer:A readonly field can be initialized only at compile time. The main features of a static class are: answer:They only contain static members. Which of the following modifier cause arguments to need not be initialized prior to being passed? answer:out What type of object is required when starting a thread that requires a single pa rameter: answer:ParameterizedThreadStart delegate What method terminates a running thread? answer:Thread.Abort The switch expression can be of these types: answer:All of the others. Which of the following properties are of struct? answer:structs are value types. Interfaces can be declared as: answer:public or internal types Classes can be declared as: answer:public or internal types Select the reasons why you would use Windows Forms over Web Forms: answer:[3]:[1]You need the processing to occur on the client[2]You need access t o local resources[3]You need a consistent graphical interface. You want to add a control to your form that allows you to set a particular optio n on or off. Which control would you choose? answer:RadioButton///////CheckBox Which of the following are not events of a System.Windows.Forms.Control? answer:MousePress What causes the following Load event to fire? answer:The user starts the application if the form is the... Which controls is appropriate to dipsplay a list of suggested choices and allows multiseletion? answer:Listbox Which control allows typing in when choice is not in list of suggested choices? answer:Combobox What ASP.NET object encapsulates the users data as it is sent from a form in a pa ge? answer:The Request object. What important standard is used to connect client browsers with web servers? answer:HTTP//////TCP/IP What definition correctly defines a label server control with the name set to lb lHoop? answer:<asp:label id="lblHoop" runat="server"/> What ASP.NET object encapsulates the state of the client and the browser? answer:The Session object. What event would be used to capture the selection of a new item in a DropDownLis t control? answer:The SelectedIndexChanged event. When a browser requests an .aspx file and the file is displayed, what is actuall y returned to the browser from the server? answer:HTML Which code segment will populate a DataSet? answer:sqlDataAdapter.Fill(dsUsers1); Which of the following object types allow you to view read-only, forward-only da ta? answer:DataReader Which data adapter would be used to access to a database that is stored on a ser ver running Microsoft Access 2002? answer:OleDbDataAdapter How do you execute multiple SQL statements using a Datareader?

answerSet the Command.CommandText property to multiple SQL statements delimited by a semicolon. What is a DataSet? answer:All of the others. What are the main objects that make up a DataAdapter? answer:Connection and Command objects Which line causes a compile error in the following code? answer:Line 3 What is the outcome of compiling this program? answer:Lines 12 and 20 are in error. Given the following code segment, what is the content of the string s in line 4? answer:Hello What is the outcome of the following code? answer:The code will be compiled and displays Some error occurred. How is the delegate for Method42() in the following snippet code declared? answer:Delegate int Met42(int i); You are building an event handler for the SendFax event from the sFax component, and you have written the following code. When you test the event handler, you find that it never runs. What code must you add to your application to make the event execute in response to the SendFax ev ent? answer:this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); What is the outcome of the following code? answer:There is a runtime error. The following SQL INSERT statement fails. What is the most probable reason for t he failure? INSERT INTO Employees VALUES (42, Bob , Carol , 12) answer:The columns in the Employees table are not in the indicated order (int, c har, char, int). What is the purpose of the following code segment? answer:To populate the DataSet the first time the web page is displayed. You are using the try... catch block seen in the following code segment, but no exceptions are ever caught by the catch block. What is the problem? answer:The exception class is wrong; it should be SqlExceptions. Select the line of code that will create a new form. answer:D What is the output from the following code segment? answer:Program is not compiled. Which segment of code will set the selected text in a RichTextBox to bold? answer:B myFont = newFont.... Which of the following Main() functions does not the C# compiler accept: answer:None of the others The first character of an identifier (variable) can not be answer:A digit What is output of the following code:byte[] TestScoresForStudents;TestScoresForS tudents = new [25]; answer:Compiler error What is output of the following code: long[] TestScoresForStudents; TestScoresForStudents = new int[25]; answer:Compiler error What is output of the following code: int[]TestArray; TestArray = new int[25]; for (int i = 1; i <= 25; i++) { TestArray [i] = i; } answer:Runtime error

Which of the following lines cause compiler error: /* line 1 */ byte b = 2; /* line 2 */ int c = b; /* line 3 */ byte d = c; answer:Line 3 The expression used in the switch statement can not be one of the following type s: answer:None of the others. What is output of the following code: int MyVariable = 123; switch (MyVariable){ case 123:MyVariable = 123;case 124:MyVariable = 124; case 125:MyVariable = 125break:default:break;} Console.Write(MyVariable); answer: Compiler error What is output when calling CallingMethod() method? public void CallingMethod(){ int MyInteger = 7; CalledMethod(out MyInteger); System.Console.WriteLine(MyInteger);} void CalledMethod(out int Integer1) { return; } answer:Compiler error C# allows to define multiple methods with the same name in the same class, as lo ng as those methods have: answer:Different parameter lists. Select incorrect statements: answer:An abstract class does not contain implementation of method. Select correct statements: answer:The purpose of an abstract class is to provide a common definition of a b ase class that multiple derived classes can share. Select correct statements: answer:[3][1]A sealed class cannot be used as a base class[2]A sealed class cann ot also be an abstract class[3]Sealed classes are used to prevent derivation. Which of the following properties do Events have? answer:[3]:[1]Events can call anonymous methods in place of delegates[2]Events a re usually declared using delegate event handlers[3]The most common use for even ts is in graphical user interfaces. Which of the following properties are not true about Delegates? answer:Delegates cannot be used to call methods asynchronously. Which method allows creating new threads within the current AppDomain, as well a s to suspend, stop, and destroy a particular thread? answer:Using classes in the System.Threading namespace. Which type allows a thread to call methods that take any number of arguments? answer:ParameterizedThreadStart Which of the following control is Text Display control? answer:Label Which of the following control is Text Edit control? answer:Textbox Which of the following control allows specifying a format for text or user input ? answer:Masked Textbox Which of the following control allows displaying list of items in a hierarchical format? answer:TreeView Which of the following method can be used to add one or more items to the Items collection of a ComboBox, ListBox or CheckedListBox control? answer:Item.AddRange

Which of the following property can be used to find gets or sets currently selec ted item in the ComboBox? answer:ListBox.SelectedItem What is the minimal information needed by a connection string to open a connecti on to a SQL Server 2005 database? answer:A valid data source[2]Appropriate credentials or Integrated Security sett ings[3]The name of the database Which of the following method of Command object can be used to performing operat ions such as Insert, Update and Delete statements? answer:ExecuteNonQuery What is a DataTable? answer:Represents one table of in-memory data. What object would you use to set the properties for columns? answer:dataColumn What methods store data in memory on the server? answer:Using Session object What method does ASP.NET page framework use by default to preserve page and cont rol values between round trips? answer:Using ViewState What property can be used to determine whether the page is being accessed for th e first time? answer:IsPostBack Which of the following control is used to verify that the data is within a speci fied range of values? answer:RangeValidator control What object can be used to get information of client such as IP Address, browser type, Cookies, HTTP information sent by the client, answer:Request Under which of the following environments does your programs execution code run? aanswer:CLR What is the compiler called that converts IL code into platform-specific code? answer:JIT Which of the following languages is not part of the current .NET languages? answer:[1]FoxPro[2]VBScript What is the correct way of creating a DataTable in a DataSet? answer:ds.Tables.Add("Orders"); To create a class file that can be added to a library, you would select which pr oject type? answer:Class Library You want to see all the methods of a particular class that you are using in your application. Which tool would you use? answer:Object Browser In C#, the . keyword is the de facto way to create an object. answer:new Which class encapsulates input, output, and error stream manipulations for conso le-based applications? answer:System.Console In C# the const keyword cannot be used to qualify: answer:[2]:[1]Parameters[2]Return values. The statement that is used to replace multiple if statements is called: answer:The case statement Select correct statements: answer:[2]Boxing....[2]Unboxing is ... Which of the following statements is false? answer:None of the others. Which of the following statemnents is true: answer:All of the others. What kind of delegate will be created for the following method? public void Method12(object sender, System.EventArgs e) {

} answer:Multicast delegate The following code segment creates an event handler. What text must be inserted in place of <<replace text here>> for the event to work? // declare the delegate for the event public delegate void SendFaxEventHandler(); public class Fax { // declare the SendFax event public <<replace text here>> event SendFaxHandler SendFax; // } answer:static Select correct statements about the Thread: answer:[2]:[1]To perform work concurrently, use the Thread class[2]To wait on th reads to complete, use the Thread classs Join method. Which of the following can be used to synchronize threads across AppDomain and p rocess boundaries? answer:[2]:[1]Mutex class[2]Semaphore class Which of the following are valid reasons to create an application domain? answer:[2]:[1]You can remove the application domain to free up resources.[2]Appl ication domains provide a layer of separation and security. Which of the following are valid ways to run an assembly within an application d omain? answer:[2]:[1]AppDomain.ExecuteAssembly[2]AppDomain.ExecuteAssemblyByName Which command would you use to close the application domain in the following cod e samples? AppDomain d = AppDomain.CreateDomain(New Domain); d.ExecuteAssemblyByName(MyAssembly); answer:AppDomain.Unload(d) What is the minimum number of assemblies a .NET application can have? answer:1 What tool is used to manage the assemblies in the Global Assembly Cache? answer:gacutil.exe When will the garbage collector run? answer:When the application is low on memory. Which of the following is not a C# keyword? answer:implements Which of the following formatters can be used over an HTTP channel: answer:SOAP formatter. Which of the following code samples demonstrates the correct way to add a Button control to a form named Form1 at run time? answer:Button aButton = new Button();Form1.Controls.Add(aButton); Which of the following code snippets demonstrates how to add a new instance of a Windows Form named Form1 at run time? answer:Form1 myForm;myForm = new Form1(); The property allows you to define a constant distance between one or more edges of a control and one or more edges of a form or other container. answer:Anchor The . property enables you to attach your control to the edge of a parent control. answer:Dock Which of the following is the correct way to add a control to a form at design t ime? answer:All of the others. Which of the following properties and methods can be used to find the index of a selected item in a ListBox control? answer:[2]:[1]ListBox.SelectedIndex[2]ListBox.SelectedIndices Which of the following are possible values for the Checked property of a Check-

Box control? answer:[2]:[1]False[2]True When would you typically use an Input parameter? answer:[2]:[1]When the parameter is used to send data from the application to th e database.[2]When the parameter value is passed to an Insert statement. How do you determine the actual SQL datatype of a SqlParameter (the type expecte d by the SQL Server)? answer:It is the type of column or data in SQL Server that the command expects. If you want to separate your server-side code from your client-side code on a We b page, what programming model should you implement? answer:Code-Behind model You want to make a configuration setting change that will be global to all Web a nd Windows applications on the current computer. Which file do you change? answer:Machine.config You want to make a configuration setting change that will affect only the curren t Web application. Which file will you change? answer:Web.config in the root of the Web application You are interested in examining the data that is posted to the Web server. What trace result section can you use to see this information? answer:Form Collection How do you make the CheckBox cause a PostBack? answer:Set the AutoPostBack property to true. You want to display a list of suppliers on a Web page. The supplier list display s 10 suppliers at a time, and you require the ability to edit the suppliers. Whi ch Web control is the best choice for this scenario? answer:The GridView control You need to write data to a database before a users session times out. Which even t should you respond to? answer:Session_End Which of the following can you use to catch unhandled exceptions in a Web applic ation? answer:[2]:[1]Page_Error[2]Application_Error Which of the following can you determine from the Request.Browser object? answer:[2]:[1]Whether the browser supports ActiveX[2]Whether the browser support s JavaScript Which of the following statements about referencing master page members is true? answer:[3]:[1]... public properties [2]public methods [3]controls in the master page. Given the following program, what is the outcome when you try to compile and run it? answr:It will fail to compile with an error CS0161: Test.Main( ) : not all code paths return a value. Given the following code segment, what will the value returned from the method b e? answer:504 Determine the output of the following code segment: answer:85 Which line causes a compile error in the following code? answer:Line 3 Which of the following array declarations will produce a compiler error? answer:int I = 4;int[] Integers = new int[I] {1,2,3,4}; In the following code, what will be printed by the Console.WriteLine() method[re verse]? answer:World In the following code, what will be printed by the Console.WriteLine() method[So rt]? answer:! What is the outcome of the following code? answer:[1]:[1]The code will compile and displays Some error occurred.[2]The code w ill compile and will abort upon execution and then display This is executed

You have created an array of Project objects named aProjects. Each Project objec t has a Name property and a Number property. You want to display all the Name va lues in a ListBox Web server control named lbProjects. Which code snippet should you use for this purpose? answer:lbProjects.DataSource = aProjects;lbProjects.DataTextField = "Name";lbPro jects.DataBind(); You are developing a Visual C# ASP.NET Web application to query product informat ion from a SQL Server database. The application specification requires that the users of your application be able to search for a product just by entering the f irst few characters. You store the characters entered by the user in a variable named ProdName. Which of the following SQL statements should you use to retrieve the data from the database? answer: sqlStatement = "SELECT Name, Description, Price FROM " + "Product WHE RE Name LIKE " + ProdName + "% "; You need to define a delegate for the following method: How is the delegate for Method42() declared? answer:delegate int Met42(int i); What will happen on line 24? answer:It prints Goodbye. What is the outcome of compiling this program? answer:[2]:[1]Line 12 is an error.[2]Line 20 is the error. What is the output format of the file the C# compiler produces? answer:IL Which of the following is the correct way to declare the method GetPayCheck()? answer:public int GetPayCheck() In order to compile a C# program from the command line, what command would you use? answer: csc Choose the correct method for declaring a namespace answer: namespace Osborne.Chapter5; Given the following code, what will the compiler do? Class Test1 { sealed abstract void MyMethod1A() { System.Console.WriteLine ("This is MyMethod1"); } } answer: MyMethod1() is not properly declared. What is the result of the following code? class Test5{public Test5 ( ){System.Console.WriteLine ("Test5 1"); }public Test5 (int num){System.Console.WriteLine ("Test5 2"); }}class Test5a{public Test5a (): base(5){}public Test5a(int numb): base() {}}class Test5b{public static void Main(){Test5a t = new Test5a(12);}} answer:It prints Test5 1. You want to change the color of the text in the code window. Which menu item wou ld you select? answer: Tools | Options Which key combination will allow you to compile your console application and lea ve the console window open? answer:CTRL-F5 What is the name given to the type of assembly that contains localized resources ? answer:Satellite What is the correct name for a resource file with images for the English culture , in the United States subculture? answer:images.en-US.resources How is the metadata for an assembly stored? answer:As XML in the manifest.

What is the code for the German language? answer: de What namespace contains the ResourceManager/CultureInfo class? answer:System.Resources/System.Globalization What is the process called that converts a primitive to a class? answer: Boxing Which of the following code segments will correctly display the string resource txtHello? (All objects are correctly created.) answer: Console.Write(rm.GetString("txtHello")); What does the following command do? csc /res:strings.resources HelloGlobalWorld. cs answer: Builds the HelloGlobalWorld and links the fallback resource. When localizing a web application, you find that you need to encode Unicode char acters that are sent to the client. What attribute would you set? answer: ResponseEncoding="UTF-8" What happens when the Resource Manager fails to find the localized resource for a locale? answer: It uses the fallback resource. In the following code segment, what is the significance of the "Strings" literal ? static ResourceManager rm = new ResourceManager("Strings", Assembly.GetExecuti ngAssembly()); answer:The base name of the resource to be loaded. Where in the object model is the information relating to the date format stored for a specific locale? answer:CultureInfo Your application is called AccountingOne.exe. What must the name of the French s tring resource be? answer:strings.fr.resources What does the attribute dir="rtf" stand for? answer:The direction for the display of characters. Your application is called AccountingOne.exe. What must the name of the satellit e assemblies be? answer:AccountingOne.resources.dll Which command will cause an XML file to be generated from documentation comments ? answer: csc MyClass.cs /doc:MyClass.xml Which line causes the following XML to be not well-formed?<VideoList><tape><name >XML is cool!</name></VideoList></tape> answer:</VideoList> Which XML rule does the following break?<employees><Employee><name>Kenneth S. Li nd</name></Employee><employee><name>Marj Rempel</employee></employees> answer:There must be matching opening and closing tags. Which XML rule does the following break?<employees><employee><name id=123>Kennet h S. Lind</name></employee><employee><name id=456>Marj Rempel</name></employee>< /employees> answer:[3]:[1]There must be a single root element.[2]There must be matching open ing and closing tags.[3]C. XML is case-sensitive. Visual Studio .NET provides a tool to generate HTML from the XML documentation f ile. It is found where? answer:Tools | Build Comment Web Pages Which of the following lines is an XML declaration? answer: <?xml version="1.0"?> Visual Studio .NET provides a tool to generate HTML from the XML documentation f ile. It is found where? answer:Tools | Build Comment Web Pages Why will the following XML code not be rendered by a browser?<name><lastname>Dow dy</lastname><firstname>Howdy</firstname></lastname> answer: The root element is not closed properly. Assess the following XML. Which answer correctly describes the code? answer:Nothingthis is well-formed XML.

Which of the following documentation comments is correct? answer:summary This is a summary comment You want to examine and change the value of a variable in your C# application. Y ou are developing using Visual Studio .NET. What window will allow you to change the value during execution? answer: Immediate window You have been asked to debug a Web-based ASP.NET application. For some reason, t he debugging information is not presented. What could be missing? answer:<%@ Page Debug="true" %> You want to compile a console-based program at the command line. What is the cor rect syntax of the command-line compiler that will allow you to see debugging in formation? answer: csc MyApp.cs /b:debug Trace switches can be set using which class? answer: System.Diagnostics.TraceSwitches The correct syntax for adding a trace listener to the Listeners collection is: answer:Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); To debug an ASP.NET application, you need to attach to which process? answer: aspnet_wp.exe How would you create a breakpoint in your code within Visual Studio .NET? answer:[3]:[1]Press F9.[2]Right-click in the margin and select Insert Breakpoint .[3]Choose Debug | New Breakpoint from the menu system. What is a transaction? answer: A combination of DML steps that must succeed or the data is returned to its initial state. What object is used to encapsulate a data source? answer:XxxConnection What object is used to encapsulate a rowset? answer: DataTable What is a DiffGram? answer: An XML file containing both the original and current values for the data . How is the data represented in an XmlDataDocument? answer:Hierarchical When would you not use the OleDbConnection object? answer:To connect to an SQL 7.0 database. What connection is used in ADO.NET to connect to an SQL Server 6.0? answer:Use the OleDbConnection class. On what object is the transaction in ADO.NET focused on? answer:The connection object What is the SQL argument that sorts the data returned by an SQL SELECT statement ? answer:ORDER BY What combination of methods are used to improve the speed of the Fill() method o f the DataAdapter? answer: BeginLoadData() and EndLoadData() In the following code, what is the result of compilation?uusing System;using Sys tem.Data;using System.Xml;class question14{public static void Main(){DataSet dsN w = new DataSet();string strCn = "data source=(local);user id=sa;" +"initial cat alog=northwind;";SqlConnection cnNw = new SqlConnection(strCn);string strSQL = " SELECT * FROM Employees";SqlDataAdapter daNw = new SqlDataAdapter(strSQL, cnNw); daNw.Fill(dsNw, "Employees");XmlDataDocument doc = new XmlDataDocument(dsNw);doc .Save(Console.Out);}} answer:Three errors. What is the result of the following SQL statement?USE NorthwindDELETE Employees answer:The Employees table is emptied. What definition correctly defines a label server control with the name set to lb lHoop? answer:<asp:label id="lblHoop" runat="server" /> What ASP.NET object is used to get information about the web servershostname?

answer:The Server object. When writing server-side code, what marks are used to indicate the code block? answer: <% %> What computer language is installed with the .NET Framework, by default? answer:JavaScript What is the name of the process the browser uses to find the address of answer:DNS How many rules are there regarding a well formed XML document? answer:Six What line in the following XML document will generate an error? 1 <?xml version="1.0"> 2 <employees> 3 <employee> 4 <name>Bob Andcarrol</Name> 5 </employee> 6 <employee> 7 <Name>Robert Burns</Name> 8 </employee> 9 </employees> answer:4 What language is the standard web script language ECMAScript based on? answer:JavaScript What is the behavior of a web browser when it receives an invalid element? answer:The browser will ignore the invalid section What object would you use if you need to support Netscape Navigator and Microsof t Internet Explorer? answer:Java applet What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time? answer: Lock() and UnLock() What ASP.NET object encapsulates the web site? answer:The Application object. When working with ASP.NET server controls, it is important to use the right even t handlers to capture the event for the application to function properly.What ev ent would you use to capture the selection of a new item in a DropDownList contr ol? answer:The SelectedIndexChanged event What code segment represents the event handler registration for the click event of the btnA Button control? answer:this.btnA.Click += new System.EventHandler(this.setList); When an ASP.NET server control is added to a Web Form, Visual Studio .NET adds o ne item to the class for the form. What item is added? answer:A protected class member for the control. What is the function of the CustomValidator? answer:It uses scripted client-side code to validate the entry in a control. What attribute must be set on a validator control for the validation to work? answer:ControlToValidate The Items property of a ListBox is a reference to what kind of object? answer: ListItem What is the use of the WebForm.aspx.cs file? answer: Holds the C# code for the codebehind module. Given an ASP.NET Web Form called WebForm1, what class does the WebForm1 class in herit from by default? answer: System.Web.UI.Page What layout mode is the default when a new Web Form is created? answer: GridLayout When does the DropDownListBox control reload its list? answer:Every time the server-side codebehind module is called. What is the Web.config file used for? answer: To store the global information and variable definitions for the applica

tion. What happens if an ASP.NET server control with event-handling routines is missin g the runat="server" attribute from its definition? answer:The compilation of the application will fail. What happens if an ASP.NET server control with no event-handling routines is mis sing the runat="server" attribute from its definition? answer: The control will not function; the default is runat="client". After capturing the SelectedIndexChanged event for a ListBox control, you find t hat the event handler doesnt execute. What could the problem be? answer:The AutomaticPostBack attribute is set to False. What must be done before you can consume a web service? answer: Build a proxy library by using the wsdl.exe utility. You need to use the web service TempConvService. Where should you place the prox y file? answer:In the bin directory off the root directory of the application. You need to use the web service TempConvService. What page directives correctly expose the web service? answer: <%@ Page Language="c#" Debug="true" %><%@ Import namespace="TempConvServ ice" %> You need to call a function that is located in a library named MyLibrary.dll, an d this is the function signature: answer:[DllImport("MyLibrary.dll", EntryPoint = "MyFunc")]public static extern i nt Func42 (int intAction, int intOption, uint uValue); You need to call a method located in a web service named TService that has been correctly registered in your application. The method is in the class Tconv and i s named CtoF() with the following signature: answer:TService.Tconv tc = new TService.Tconv();int x = tc.CtoF(42.12); You have been given the task of designing a web service to expose the data that is stored in a database on the server. In order to successfully build the web se rvices, you need to import some namespaces. What is the minimum namespace you ne ed to import? answer:System.Web.Services You have designed an event for the class you are working on, and the event is de clared as follows:// declare the delegate for the eventpublic delegate int MugEm ptyHandler(int RefillVolume);// declare the event answer: Change the declaration of the delegate to have a void return type. Your manager has asked you to describe what you would use application variables for. What statement best describes the use of application variables? answer: Application variables are used to keep state for the web site. You are using Visual Studio .NET to set up a reference to a COM component, but t he reference operation fails. What is one possible solution? answer: Register the COM component in the Registry using Regsvr32.exe. What information do you need to have in order to successfully reference a web se rvice using the Add Reference dialog box? answer: The URL for the web services .asmx file. You have defined some web service methods, but when you test the web service, yo u do not have the methods available. The web service is defined as follows:[WebM ethod]What will you do to solve the problem? answer: Make the method public. What HTML element is the asp:Label control rendered as when the target is Intern et Explorer? answer:<label> What HTML element is the asp:Label control rendered as when the target is Netsca pe Communicator? answer:<span> What is the result when a Web Form containing the following line is compiled and executed?<asp:Button id="theButton" onClick="theEvent" /> answer:Compiler error; onClick is not a valid attribute. What HTML element is the asp:panel control rendered as? answer: <div>

How do you specify the parameters for the ads in the AdRotator control? answer: By using an initialization file in .xml format. What of the following best describes a user control? answer: A collection of server controls gathered in a web file with the <%@ Cont rol %> directive. Which of the following is valid after adding the following directive to a Web Fo rm?<%@ Register TagPrefix="WWW" TagName"WWWControl" Src="WWWControl1.ascx" %> answer:<WWW:WWWControl id="WWWContr" runat="server" /> You have correctly added the <%@ Register %> directive and the user-control defi nition in the <asp:Form> tag, but when you run the application it fails. What is the most likely cause of the failure? answer:The protected class variable for the control is missing from the codebehi nd module. After building a custom control, you test it by adding an ASP.NET web applicatio n to the solution. You add a correct <%@ Register %> directive and a proper decl aration of the control in the <asp:Form> tag to the Web Form, but when you execu te the application you get an error. What is the most likely reason for the prob lem? answer: The assembly from the custom control is not in the applications bin direc tory. You have successfully created a custom control and a web application project to test the control. The application runs with no problems, but when you look at th e Design view of the Web Form, the control is displayed using an error display.W hat is the most efficient way to resolve the error display? amswer: Add a reference to the control to the web application What method must be overridden in a custom control? answer:The Render() method. Your manager has asked you if ASP.NET can be used with dynamic control creation, and if it requires any extra software to make dynamic controls possible. What w ould you answer your manager? answer:Yes, dynamic controls are possible using the standard control containers from ASP.NET. What property is used to control how the user can press ALT-F to set the focus t o answer: AccessKey You have created a localized web application that supports English, French,Germa n, and Spanish.What will you do? answer:Add code to change the current threads culture to the users culture. What is used to validate complex string patterns like an e-mail address? answer: Regular expressions. What is the default language for the fallback culture? answer:Neutral What namespace is needed for Event Log support? answer: System.Diagnostics What property controls whether the text in a TextBox control is displayed in cle ar text or as a collection of * characters? answer:TextMode You need to customize the error messages from your web application. What file wi ll you modify to customize the error messages? answer: Web.config What property is set in order to display the text in reverse flow order? answer:dir You have configured custom error pages for your application. When you test the p ages from a co-workers computer, they display properly, but when displayed in you r browser on the development computer, they display incorrectly. What will you d o to correct the display of the error pages on your computer? answer: Change the mode attribute to On in the Web.config file. after adding messages to the trace log, you need to locate the output. What sect ion contains the messages a developer has added to the trace log? answer:Trace Information.

What file would you modify to implement application-wide error processing for al l unhandled errors? answer: global.asax What property is used to control the order in which the controls are accessed? answer:TabIndex How do you enable tracing? answer:Set the Trace property of the Web Form to True. What control is used to validate that two fields are equal? answer:CompareValidator What method is used to insert a highlighted entry in the trace output? answer:Trace.Warn() What is the SQL equivalent of the DataSet relation object? answer:INNER JOIN Why should you close all database objects and set them to NULL before leaving th e method where the objects were created? answer:To ensure that the connection to the database is closed as soon as possib le. Where are stored procedures saved? answer:The database server. What is the root exception for the ADO.NET objects? answer:DataException What best describes the xxxDataReader? answer:A connected, read-only, forward-only representation of the data source. You are the developer of a Web Form, and you need to display data from a Microso ft SQL Server 6.5 in a DataGrid on your form. What DataAdapter is the most appro priate? answer:oleDbDataAdapter What is the purpose of the last string ("{0}") in the following code segment?Dat aBinder.Eval(dS1, "Tables[SP_SelUsers].DefaultView.[0].LastName", "{0}"); answer:It is the formatting string for the bound data. What is the correct namespace for use with the SQL .NET Data Provider objects? answer:System.Data.SqlClient What is the correct statement to use for declaring that an xxxCommand object is used with a table? answer: aCmd.CommandType = CommandType.Table; How many sqlDataReader objects can be open on one Connection at one time? answer: 1 What is the SQL wildcard character? answer:% You need to connect to a Microsoft SQL Server version 6.5. What Connection objec t is the best choice? answer: oleDbConnection You are designing a Web Form that needs to have data available for as long as ei ght hours at a time. Your manager has raised some concern that the database serv er will be unable to provide services to a large number of connected users. What object in the ADO.NET architecture will you bring to your managers attention as a possible solution? answer:oleDbDataSet You are the developer of a web application that is retrieving historical sports information from a database server and displays it to the users of your applicat ion. What cache strategy will give you the best performance? answer:Use the output cache. You are the developer of a web application and have decided to use the output ca che in ASP.NET. Which of the following statements correctly defines the Web Form if you want to use the output cache, cache all items for 14 minutes, and store different versions of the cached objects for each customer ID? answer: <%@ OutputCache Duration="840" VaryByParam="Customer ID" %> The following Machine.config file is installed on the server (http://www.x3.xxx) that will host your web application: answer:Add an <appsettings> section to the applications Web.config file, and add

the following to the <appsettings> section: <add key = "Home" value = "/smallsit e" />III What should be added to basic authentication? answer: SSL You are deploying a web application using the XCOPY method, and you are now sele cting the files that should be included in the deployment. What file extensions must be included in the deployment? Select all that apply. answer: .aspx What is required in order to be able to install and use SSL on a web server? answer: Server certificate. You have been asked to describe what authentication and authorization are.What s tatements best describe the two terms? Select two answers. answer:[2]:[1]Authentication is the process of validating security credentials.[ 2]Authorization is the process of validating permissions for resources. True or false. The Web.config file can be used to store configuration data for p roperties of some controls. answer: True. What tool is used to manage the GAC? answer: GacUtil.exe What is the effect of the following code snippet from the Web.config file?...<sy stem.web><authorization><deny users="?" /></authorization></system.web>III answer:Anonymous access is denied. The GAC cannot store multiple versions of the same assembly. answer: False. You are configuring your web application to require digest-based authentication. What must you have in place before you can use digest-based authentication? answer: Active Directory. Which of the following methods are ways to create a Windows Form? answer:[4]:[1]Visual inheritance[2]Building a derived class from System.Windows. Forms.Form[3] Extending a prebuilt form.[4]Selecting a form class from the Inher itance Picker. When you set the Localization property of a form to True, which of the following happens? answer: You allow the application to accept localization resources. By setting the Text property on the form, you will cause the value of the Text p roperty to display on which part of the form? nswer:Title bar What causes the following Load event to fire? Assume that the form is the only f orm in the application.private void Form1_Load (object sender, System.EventArgs e) {Form1.Hide();} answer:[2]:[1] The Show() method is called.[2]The user starts the application. What would the outcome of an application that contained this code be?private voi d Form1_Load (object sender, System.EventArgs e){Form1.Hide();} answer:The application would not compile. What would the outcome of an application that contained this code be?private voi d Form1_Load (object sender, System.EventArgs e){this.Hide();} answer: The program would run and display the form. What is the outcome of the following lines of code?button1.Left = 50;button1.Top = 100; answer: The button will display 50 pixels from the left of the form and 100 spac es from the top. Which of the following are not methods of a System.Windows.Forms.Form object? answer: Deactive() In which namespace would you find the class Application? answer: System.Windows.Forms If you want to ask the user to select between two or more mutually exclusive opt ions, you would employ which of the following controls? answer: RadioButton You want to validate the user input that is retrieved in a text box. Which contr

ol will assist you in displaying the error message without moving off the form? answer: ErrorProvider You want to validate the user input that is retrieved in a text box. Which event will assist you in the validation of the data? answer:Validating Which of the following lines of code will produce a message box for the user? answer: MessageBox.Show ("This is your message); To dynamically add a context menu to your application, which section of code sho uld be used? answer: MenuItem m = new MenuItem();contextMenu1.MenuItems.Add (m); To produce a dialog box similar to the Windows Print dialog box, which of the fo llowing controls would you use? answer:PrintDialog Which property of the CheckedListBox allows you to preset the maximum number of items that can be selected? answer: SelectionMode What is wrong with the following piece of code? Assume no other code has been wr itten and you are creating the status bar dynamically.this.sbMyStatusBar.Panels[ 1].Text = "Panel 1";this.sbMyStatusBar.Panels[2].Text = "Panel 2";this.sbMyStatu sBar.Panels[3].Text = "Panel 3"; answer:It will cause a runtime error. Which line of code must be added in order to show a StatusBar? answer: sbMyStatusBar.Show = true; Which line of code will set the Link data for a LinkLabel? answer:None of the above. Which segment of code will set the selected text in a RichTextBox to bold? answer: myFont = new Font (oldFont, FontStyle.Bold);this.rtfTest1.SelectionFont = myFont; Which property will allow the user to enter more than one line in a text box? answer: MultiLine Which control would you use to group a lot of controls together? answer:GroupBox What type of commands can you create? answer: Text, stored procedures, and TableDirect. Data access exceptions all derive from which base class? answer: DataException You need to get access to a database that is stored on a server running Microsof t SQL Server 2000. Which data adapter would you use? answer: SqlDataAdapter You want to return XML data from a Microsoft SQL Server 7.0 database. Which meth od would you execute? answer: ExecuteXmlReader() The Parse event is triggered after which of these occurrences? answer:Data is returned to the data source. The Format event is triggered after which occurrences? answer:[4]:[1]Data is sorted[2]Data is filtered[3]Data is bound to a control[4]D ata is returned to the data source. Which of the following statements is correct? answer:The DataSource property refers to the dataset object, and the DisplayMemb er refers to the field. Why does the data not display using the following code?studentConnection.Open(); answer: The dataset has not been populated. What have you forgotten to do if you see the following dialog box when running y our program? answer:Handle data exceptions. Where should a web service proxy file be located? answer: In the \bin directory of the application. Which code segment would correctly expose the Convert() method of a web service? answer: public int Convert() Which command-line tool will create a web service proxy?

answer: wsdl.exe Which command-line tool will allow you to view an assembly? answer: ildasm.exe Which command-line tool will generate the proxy for a COM component? answer: wsdl.exe What must be done to be ready to consume a web service? answer: Build a proxy library using wsdl.exe. Which namespace is added to a program that calls a web service? answer: using System.Web.Services; A discovery file used to locate Web Services would have which extension? answer: .vdisco When you test a web service, what do you expect to see as output? answer: The XML of the web proxy. Which attribute must be added to create an exposed web service method? answer: [System.Web.Services.WebMethod] Which file must be included in the assembly in order to provide a list of licens ed controls within the application? answer: xxxx.LICX Which name is given to the controls that make up part of a composite control? answer: Constituents You are planning to create a control that will display two text boxes, ask the u ser to enter a value in each box, and compare the contents for equality. Which t ype of control would you build? answer: Derived control from the Control class. Why would you use properties instead of variables to expose attributes for your new control? answer: Properties can be displayed in the Property Explorer. The main feature of static classes is: answer:They only contain static members. Which ofthe following modifier causes arguments to need not be initialized prior to being passed? answer: out Which of the following statements is true? answer: Default value of reference type is null You want to add a control to your form that allows user to set a particular opti on in a group on or off. Which control would you choose? answer: CheckBox Which of the following statements is false? answer: A read-only field can be initialized only at compile time. it is possible use LINQ query expressions to iterate over data contained within colle ctions using the generic Sequence.OfType<T>() method. answer: ongeneric LINQ query expressions can be used to iterate over data containers that implemen t the generic .interface. answer: IEnumerable<T> Which activities can be used in Sequential Workflows answer:[2]:[1]IfElseActivity[2]ParallelActivity A executes activities in a sequential manner until the last activity finishes answer:Sequential The or .that implement them are termed service types. answer:[2]:[1] Classes[2]Structures ..that represent a WCF contract are termed service contracts. answer: Interfaces Windows Communication Foundation (WCF) integrates a number of existing distribut ed technologies such as.. into a streamlined API. answer:[3]:[1]COM+, Microsoft Message Queuing service [MSMQ][2]NET remoting[3]XM L web services WPF includes several layout controls answer:[3]:[1]Canvas, DockPanel[2]Grid, StackPanel[3]StackPanel, VirtualizingSta ckPanel

XAML is typically used to create: answer:[2]:[1]Windows, dialog boxes[2] Pages, user control Which language is used to implement the appearance of an application in WPF answer: XAML UDDI server can be used to: answer:[2]:[1] Register an XML web service.[2]To find a list of all web services that match some search criteria. An XML web service consumer can be: answer:[4]:[1]Web pages.[2] Console-based clients.[3] Windows Formsbased clients. [4] Other XML web services. Data in http://www.contoso.com/listwidgets.aspx?category=basic&price=100 is sent to web server using method: answer: GET Which of the following options is Client-Side State Management: answer:[3]:[1]View state[2]Cookies[3]Control state Select incorrect statements: answer: None of the others. ch of the following languages can not be used in ASP.NET server-side code: answer:[2]:[1] VBscript[2] Javascript Scripting languages that can be used to author client-side script code: answer:[2]:[1] VBscript[2] Javascript Which of the following are benefits of classic ASP: answer: None of the others. Which states was the row assigned when executing the following code snippet:row = table.NewRow(); answer:[3]:[1]Added[2]Detached[3] Unchanged Which of the following statements are false: answer: All of the others

Select wrong statements about Data Readers: answer:[2]:[1]They are suitable to submit INSERT, UPDATE, DELETE statements to t he underlying data store.[2]They are suitable to cache data locally in your appl ication so that you can manipulate it Connection String can be specified in answer:All of the others. The SqlDataAdapters method changes the data in the data source to match the data in t he. answer: Update, DataSet The SqlDataAdapters . method changes the data in the to match the data in the data s ce. answer:Fill, DataSet Which of following types can be used regardless of the underlying data store? answer:[2]:[1] DataSet[2]DataTable Which of following controls allow multiselection: answer:[3]:[1]Listbox[2] CheckListBox[3] CheckBoxes in a goup. Which of following control are Container answer:[3]:[1] GroupBox[2] TabControl[3]Panel Which of the following statements about multithreaded application are true: answer:By default, every thread is created via the Thread.Start() method is auto matically a foreground thread. Which of the following statements about multithreaded application are true: answer:All of the others Which class controls access to objects by granting a lock for an object to a sin gle thread? answer: The Monitor Which of the following statements about .NET assemblies are true: answer:[2]:[1]Shared assemblies are installed into the GAC.[2]Shared assemblies can be configured using a client *.config file Select correct statements about .NET assemblies: answer:Assembly al = Assembly.Load("AnimalLibrary") will request an explicit ass

embly load. Assume that vehicles.dll file contains: .assembly extern mscorlib answer:[2]:[1]vehicles.dll is primary module[2]In this assembly, there is at lea st a class derived from Van class. Which of the following sentences about .NET Assembly are true: answer: In a multifile assembly every module can be built using multiple differ ent .NET programming languages. Interface references can not be obtained by: answer: using new operator to create object from interface Consider the following code snippet: public void method1(ref int a, int b) answer: a =11, b =2 Which of the following statements are true : answer: Polymorphism is ability to treat related objects the same way Which of the following types are reference type: answer:[2]:[1]Delegate[2] Array Assume that Student be a class. Select valid statements: answer:[2]:[1]public readonly Student john = new Student();[2]private readonly S tudent john = new Student(); Which of the following statement about multithreaded application is true: answer:All of the others. Which of the following statement about multithreaded application is true: answer: All of the others. Which class controls access to objects by granting a lock for an object to a sin gle thread? answer:The Monitor Which of the following sentences about .NET Assembly are true: answer: The .NET runtime resolves the location of private assemblies using probi ng technique. Which of the following statements are true : answer:[2]:[1]Garbage collection takes place on managed heap.[2].NET objects are allocated onto the managed heap, Which of the following statements are true : answer:[2]:[1]private static readonly String str;[2]static internal void method1 (){} Which of the following statements define field as static member : answer:[3]:[1] static int y = 5;[2]public const int c1 = 5;[3]public static int NumberOfWheels; Which the following statements about Visual Studio 2005 are true: answer: Object Test Bench is used to to test a specific method, but no need to write many lines of code . [2]Refactoring helps for changing the internal struct ure of the code without changing the external behavior of the code. We can edit C# code using: answer:[2]:[1]Notepad and save as .cs file [2]Textpad but no need configuration. Some roles of the .are memory management and performing security checks. answer: CLR Which the following statements about C# are true: answer:[2]:[1] C# programs typically have no need for direct pointer manipulatio n[2] Generic classes can be built by C#.2005 or later. Which the following statements about .NET plattform are true: answer:All of the others. Which the following statements are true: answer:[2]:[1] IL code is conceptually similar to Java bytecode.[2] Manifest is metadata which is used to describe assemblies themselves. Which the following statements about .NET framework are true: answer:[2]:[1]Automatic memory management. [2].NET supports cross-language for i nheritance, exception handling and debugging. Select correct statement about .NET: answer:[2]:[1].NET code can use C-based library or COM.[2].NET allows multiple v

ersions of the same *.dll to exist on a single machine. 1111. the initial designed GUI? answer: 1 1112. How many buttons are shown on the GUI? answer: 0 1113. Code for Mouse event handlers: answer: User receives the message "Hm" when he/she clicks the combobox 1114. (1) The java.io...class makes it easier to write platform-independent code that examines and manipulates files (2) The java.io...class makes it easier to write platform-independent c ode that examines and manipulates foders answer: file, file 1115: public class Hello answer: The output is -107 1116. public static void main (string[] args) { answer: An error is thrown when it is compiled. 1117. With respect to the java.sql.statement interface (1) When we need retrieving data (2) When we need update data answer: executeQuery(...), executeUpdate(...) 1118. The top interface of the Java Collection Framework is..... answer: All of the others 1119. If we want to store a group of different elements in ascending order, the java.util... class should be used. answer: SortedSet 1120. Select correct statement(s) (1) 12 buttons can not be added to a container which is assigned to a gr id layout 2x5 (2) If 2 components are added to the center region of a border-l ayout container, they will be seen by user as side-by-side components answer: 1 1121: If the following code is executed. What is the output int[] a= {1,2,3,4} answer: A compile-time exception because they must be put in the try catch block . 1122: Select correct statement(s) (1) A process has a self-contained execution environment (2) A sub-thread has a self-contained execution environment (3) Programmers can schedule sub-threads of a program answer: (1) (3) 1123. Study the following class developed in Netbeans? answer: It will show a clock in the jlabel1 1124: Select correct statement(s) (1)The Swing s list component (Jlist) can display text only (2)The Swing s button (JButton) (3)The Swing s label (JLabel) answer: (3) 1125. With respect to networking and the client-server model. (1) A socket is one endpoint (2) TCP(Transmission Control Protocol) (3) UDP(User Datagram Protocol) answer: None of the others. 1126: Two sub-threads of a program may not need synchronized if.... answer: A thread waits alock that is held by another 1127: Study the following Java program import java.util.*; answer: The code line 33 causes an error when the program is compiled 1128: The correct order in which database -accessing objects should be created: answer: Connection-Statement-ResultSet-ResultSetMetaData 1129: With respect to JDBC, (1) In the two-tier model (2) In the three-tier model

(3) The JDBC API supports two-tier processing answer: true,true,false 1130: If a Java source code contains an assert as an identifier and it will be c ompiled with JDK version 1.4 or higher,... answer: The option "-enableassertion" must be specified when it is run. 1131. Select incorrect Java program entry point declarations (1) public static void main() (2) public static void main(String [] args) (3) public static void main(String args[]) (4) public static void main(string [] args) (5) public static void main(String args) answer: (1) (4) (5) 1132. With respect to networking and the client-server moldel. (1) A server runs on a specific computer and has a socket that is bound to a spe cific port number. The server just waits, listening to the socket for a client t o make a connection request. (2) To connect to the server, the client must know the hostname o. IP of the mac hine on which the server is running and the port number on which the server Is l istening answer: True True 1133. abstract class A { void m1() {} answer:The output is m2m2 1134. import java.util.date; import java.text.dateformat; answer: The code line 24 causes an error when the program is compiled 1135. Select correct statement(s): (1) A thread can be an Instance of the java.lang.Thread class. (2) A thread can be an Instance of a subdass of the Java.lang.Thread class. (3) An Instance of a class WhICh Implements the java.lang.Runnable can supply th e executable code for a thread object. answer: (1) (2) (3) 1136. import java.until.*; class A { int x; answer: The code causes (an) error(s) 1137. Select correct statements. (1) A public member of a class can be accessed in all dasses. (2) A default member of a class can be accessed in all dasses. (3) A protected member of a class can be accessed In the package containing this dass. (4) A private member of a class can be accessed In the package containing this d ass. answer: (1),(4) 1138. class A { public static int N=10; answer: The output is AA9Hic10 1139. In Windows systems, the .... program helps creating the Stub of a RMI serv er and the.... program will work as a RMI container (RMI registry). answer: rmic.exe, rmiregistry.exe 1140. To read data from a text file using the line-by-line accessing. the right order of object creations is answer: File-FileReader - BufferedReader 1141. (1) An object having synchronized methods is call a(an0.... (2) The ..... technique can be applied with a hope that a deadlock situa tion (3) The sleep (...) method of the java.lang answer: Monitor, wait-notify,specific period of time 1142. An instance of the java.util.Scanner class can read data from the keyboard (1) answer: True True true 1143. (1) is applied in a class (2) is applied in a class hierarchy answer: method overloading, method overriding 1144. The java language supports

answer: All of the others 1145. public class Exam1 { answer: An error is thrown when the program is compiled 1146. Which of the following java operations cause compile-time errors? answer: 3,4 1147. To write objects to an object file. The right order of object creations is ? answer: File -ObjectOutputStream-Writer 1148. class B extends A { answer: The output program is 12 1149. With respect to steps in RMI implementation. (1) Create the remote interface (2) Create the remote object answer: 1 2 4 3 1150. class A implement I1 answer: The program causes errors when it is compiled 1151. Select correct statement(s) (1) All byte stream classes are descended (2) All character stream classes are descended answer: 1, 2 1152. Study the following code was implemented in the Hello class? answer: Wrapping, un-wrapping 1153. Suppose that the class A contains an inner class, named b answer: The B object must be referred by a reference 1154. A java source code will be compiled to... answer: Java bytecode 1155. An abstract class.... answer: Must contain at least one abstract method 1156. abstract void print (); answer: The output is Hello 1157. Select correct statement(s) (1) Swing is part of the Java Foundation Classes (2) Before you think about what your GUI will look like answer: 1 2 1158. An interface can contain... answer: All of the other 1159. Which og the following layout manager will present component with the same size answer: java.awt.Gridlayout 1160. Study the following java code int[] a= {1,2,3,4}; int b=1 answer: {1,3,3,4}

1. a. b. c. d.

______ is a set of java API for executing SQL statements. ODBC JDBC JAVADB None of the others

Answer: JDBC

2. a. b. c.

______ method is used to wait for a client to initiate communications. wait() accept() listen()

Answer: Accept() 3. ___________ drivers that are written partly in the Java programming language and partly in native code. These drivers use a native client library specific to the data source to which they connect. Again, because of the nativ e code, their portability is limited. a. Type 2 b. Type 3 c. Type 1 d. Type 4 Answer: Type 2 4. ____________ drivers that are pure Java and implement the network protocol fo r a specific data source. The client connects directly to the data source. a. Type 4 b. Type 3 c. Type 2 d. Type 1 Answer: type 4 5. ____________ drivers that use a pure Java client and communicate with a middl eware server using a database-independent protocol. The middleware server then communicates the client s requests to the data source. a. Type 3 b. Type 2 c. Type 1 d. Type 4 Answer: type 3 6. ______________ drivers that implement the JDBC API as a mapping to another da ta access API, such as ODBC. Drivers of this type are generally dependent on a native library, which limits their portability. a. Type 1 b. Type 2 c. Type 3 d. Type 4 Answer: type 1 7. 1. public class A { 2. public String doit(int x, int y) { 3. return a; 4. } 5. 6. public String doit(int... vals) { 7. return b; 8. } 9. }

Given: 25. A a=new A(); 26. System.out.println(a.doit(4, 5)); What is the result? (Choose one.) a. Line 26 prints a to System.out. b. Line 26 prints b to System.out. c. An exception is thrown at line 26 at runtime. d. Compilation of class A will fail due to an error in line 6. Answer: line 26 prints "a" to System.out 8. 1. public class A { (1525) 2. public void method1() { 3. B b=new B(); 4. b.method2(); ----------------------- Page 4----------------------5. // more code here 6. } 7.} 1. public class B { 2. public void method2() { 3. C c=new C(); 4. c.method3(); 5. // more code here 6. } 7.} 1. public class C { 2. public void method3() { 3. // more code here 4. } 5.} 25. try { 26. A a=new A(); 27. a.method1(); 28. }catch (Exception e) { 29. System.out.print(an error occurred); 30. } Which two are true if a NullPointerException is thrown on line 3 of class C? (Choose two.) a. The application will crash. b. The code on line 29 will be executed. c. The code on line 5 of class A will execute. d. The code on line 5 of class B will execute. e. The exception will be propagated back to line 27. f. Answer: the code on line 29 will be excuted + the exception will be propagated back to line 27. QN=9 (152) 3. 4. 5. 1. try { 2. // assume s is previously defined URL u = new URL(s); // in is an ObjectInputStream Object o = in.readObject();

6. System.out.println("Success"); ----------------------- Page 5----------------------7. } 8. catch (MalformedURLException e) { 9. System.out.println("Bad URL"); 10. } 11. catch (StreamCorruptedException e) { 12. System.out.println("Bad file contents"); 13. } 14. catch (Exception e) { 15. System.out.println("General exception"); 16. } 17. finally { 18. System.out.println("Doing finally part"); 19. } 20. System.out.println("Carrying on"); Where: IOException extends Exception StreamCorruptedException extends IOException MalformedURLException extends IOException What lines are output if the constructor at line 3 throws a MalformedURLException? (Choose three.) a. Success b. Bad URL c. Bad file contents d. General exception e. Doing finally part f. Carrying on Answer: Bad URL + Doing finally part + Carrying on MARK: 2 CHAPTER: MIX Yes CHOICES: QN=10 1. try { (153) 2. // assume s is previously defined 3. URL u = new URL(s); 4. // in is an ObjectInputStream 5. Object o = in.readObject(); 6. System.out.println("Success"); 7. } 8. catch (MalformedURLException e) { 9. System.out.println("Bad URL"); 10. } ----------------------- Page 6----------------------11. 12. 13. 14. 15. 16. 17. 18. 19. catch (StreamCorruptedException e) { System.out.println("Bad file contents"); } catch (Exception e) { System.out.println("General exception"); } finally { System.out.println("Doing finally part"); }

20. System.out.println("Carrying on"); What lines are output if the methods at lines 3 and 5 complete successfully without throwing any exceptions? (Choose three.) a. Success b. Bad URL c. Bad file contents d. General exception e. Doing finally part f. Carrying on Answer: Success + Doing finally part + Carrying on MARK: 2 CHAPTER: MIX Yes CHOICES: QN=11 10. interface Foo { (1417) 11. int bar(); 12. } 13. 14. public class Beta { 15. 16. class A implements Foo { 17. public int bar() { return 1; } 18. } 19. 20. public int fubar( Foo foo) { return foo.bar(); } 21. 22. public void testFoo() { 23. 24. class A implements Foo { 25. public int bar() { return 2; } 26. } 27. 28. System.out.println( fubar( new A())); 29. } ----------------------- Page 7----------------------30. 31. public static void main( String[] argv) { 32. new Beta().testFoo(); 33. } 34. } Which three statements are true? (Choose three.) a. Compilation fails. b. The code compiles and the output is 2. c. If lines 16, 17 and 18 were removed, compilation would fail. d. If lines 24, 25 and 26 were removed, compilation would fail. e. If lines 16, 17 and 18 were removed, the code would compile and the output would be 2. f. If lines 24, 25 and 26 were removed, the code would compile and the output would be 1. Answer: The code compiles and the output is 2 + If lines 16, 17 and 18 were remo ved, the code would compile and the output would be 2 + If lines 24, 25 and 26 w ere removed, the code would compile and the. MARK: 2 CHAPTER: MIX Yes

CHOICES: QN=12 10. public class ClassA { (1527) 11. public void methodA() { 12. ClassB classB = new ClassB(); 13. classB.getValue(); 14. } 15.} And: 20. class ClassB { 21. public ClassC classC; 22. 23. public String getValue() { 24. return classC.getValue(); 25. } 26.} And: 30. class ClassC { 31. public String value; 32. 33. public String getValue() { 34. value = ClassB; ----------------------- Page 8----------------------35. return value; 36. } 37.} ClassA a = new ClassA(); a.methodA(); What is the result? (Choose one.) a. Compilation fails. b. ClassC is displayed. c. The code runs with no output. d. An exception is thrown at runtime. e. f. Answer: An exception is thrown at runtime MARK: 2 CHAPTER: MIX Yes CHOICES: QN=13 11. public class Bootchy { (1515) 12. int bootch; 13. String snootch; 14. 15. public Bootchy() { 16. this(snootchy); 17. System.out.print(first ); 18. } 19. 20. public Bootchy(String snootch) { 21. this(420, snootchy);

22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. }

System.out.print(second ); } public Bootchy(int bootch, String snootch) { this.bootch = bootch; this.snootch = snootch; System.out.print(third ); } public static void main(String[] args) { Bootchy b = new Bootchy(); System.out.print(b.snootch + + b.bootch); }

----------------------- Page 9----------------------What is the result? a. snootchy 420 third b. snootchy 420 first c. first second third d. third second first e. third first second f. first second first Answer: third second MARK: 1 CHAPTER: MIX Yes CHOICES: QN=14 (Choose one.) second first second third snootchy 420 snootchy 420 snootchy 420 third snootchy 420 first snootchy 420

A _____ dialog prevents user input to other windows in the application

(306) unitl the dialog is closed. a. Modal b. Non-Modal c. Unmodel d. None of the above e. f. Answer: Modal MARK: 0.5 CHAPTER: MIX No CHOICES: QN=15 A file is created with the following code: (239) 1. FileOutputStream fos = new FileOutputStream("datafile"); 2. DataOutputStream dos = new DataOutputStream(fos); 3. for (int i=0; i<500; i++) 4. dos.writeInt(i); You would like to write code to read back the data from this file. Which solutions will work? (Choose two.) a. Construct a FileInputStream, passing the name of the file. Onto the FileInputStream, chain a DataInputStream, and call its readInt() method. b. Construct a FileReader, passing the name of the file. Call the file readers readInt() method. c. Construct a RandomAccessFile, passing the name of the file. Call the random access files readInt() method.

----------------------- Page 10----------------------d. Construct a FileReader, passing the name of the file. Onto chain a DataInputStream, and call its readInt() method. e. f. Answer: Construct a FileInputStream, passing the name of the eInputStream, chain a DataInputStream, and call its readInt() ct a RandomAccessFile, passing the name of the file. Call the readInt() method. MARK: 1 CHAPTER: MIX Yes CHOICES: the FileReader,

file. Onto the Fil method. + Constru random access files

QN=16 A Java monitor must either extend Thread or implement Runnable. (198) a. True b. False c. d. e. f. Answer: False MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=17 A monitor called mon has 10 threads in its waiting pool; all these wai ting (196) threads have the same priority. One of the threads is thr1. How can yo u notify thr1 so that it alone moves from the Waiting state to the Ready state? (Choose one.) a. Execute notify(thr1); from within synchronized code of mon. b. Execute mon.notify(thr1); from synchronized code of any object. c. Execute thr1.notify(); from synchronized code of any object. d. Execute thr1.notify(); from any code (synchronized or not) of any object. e. You cannot specify which thread will get notified. f. Answer: You cannot specify which thread will get notified. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=18 (1426) A programmer needs to create a logging method that can accept an arbitrary number of arguments. For example, it may be called in these

----------------------- Page 11----------------------ways: logIt(log message 1 ); logIt(log message2,log message3); logIt(log message4, log message5, log message6); Which declaration satisfies this requirement? (Choose one.)

a. public void logIt(String * msgs) b. public void logIt(String [] msgs) c. public void logIt(String... msgs) d. public void logIt(String msg1, String msg2, String msg3) e. f. Answer: public void logIt(String... msgs) MARK: 1 CHAPTER: MIX Yes CHOICES: QN=19 A signed data type has an equal number of non-zero positive and negative (45) values available. a. True b. False c. d. e. f. Answer: False MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=20 A thread wants to make a second thread ineligible for execution. To do (194) this, the first thread can call the yield() method on the second thread. a. True b. False c. d. e. f. Answer: False MARK: 0.5 ----------------------- Page 12----------------------CHAPTER: MIX Yes CHOICES: QN=21 A threads run() method includes the following lines: (195) 1. try { 2. sleep(100); 3. } catch (InterruptedException e) { } Assuming the thread is not interrupted, which one of the statements is correct? a. The code will not compile, because exceptions cannot be threads run() method. b. At line 2, the thread will stop running. Execution will 100 milliseconds. c. At line 2, the thread will stop running. It will resume 100 milliseconds. d. At line 2, the thread will stop running. It will resume after 100 milliseconds have elapsed. e. following caught in a resume in, at most, running in exactly running some time

f. Answer: At line 2, the thread will stop running. It will resume running some ti me after 100 milliseconds have elapsed. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=22 A(n) ___ object is used to submit a query to a database (7264) a. Command b. Connection c. Statement d. DriverManager e. f. Answer: Statement MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 13----------------------QN=23 A(n) ___ object is uses to obtain a Connection to a Database (7263) a. ConnectionManager b. DatabaseManager c. DriverManager d. JDBCManager e. f. Answer: DriverManager MARK: 1 CHAPTER: MIX Yes CHOICES: QN=24 After execution of the following code fragment, what are the values of the (66) variables x, a, and b? 1. int x, a = 6, b = 7; 2. x = a++ + b++; a. x = 15, a = 7, b = 8 b. x = 15, a = 6, b = 7 c. x = 13, a = 7, b = 8 d. x = 13, a = 6, b = 7 e. f. Answer: x = 13, a = 7, b = 8 MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=25 (1410) Assume that country is set for each class. Given:

10. public class Money { 11. private String country, name;

12. public String getCountry() { return country; } 13.} and: 24. class Yen extends Money { 25. public String getCountry() { return super.country; } 26. } 28. class Euro extends Money { 29. public String getCountry(String timeZone) { 30. return super.getCountry(); ----------------------- Page 14----------------------31. } 32. } Which two are correct? (Choose two.) a. Yen returns correct Country value. b. Euro returns correct Country value. c. An exception is thrown at runtime. d. Yen and Euro both return correct Country value. e. Compilation fails because of an error at line 25. f. Compilation fails because of an error at line 30. Answer: Euro returns correct Country value. + Compilation fails because of an e rror at line 25. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=26 Choose the valid identifiers from those listed here. (Choose all that apply.) (46) a. BigOlLongStringWithMeaninglessName b. $int c. bytes d. $1 e. finalist f. Answer: ABCDE MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=27 (1520) 2. } Class SomeException: 1. public class SomeException {

Class A: 1. public class A { 2. public void doSomething() { } 3. } Class B: 1. public class B extends A { 2. public void doSomething() throws SomeException { } 3. } ----------------------- Page 15-----------------------

Which is true about the two classes? (Choose one.) a. Compilation of both classes will fail. b. Compilation of both classes will succeed. c. Compilation of class A will fail. Compilation of class B will succeed. d. Compilation of class B will fail. Compilation of class A will succeed. e. f. Answer: Compilation of class B will fail. Compilation of class A will succeed. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=28 Class TestException: (1521) 1. public class TestException extends Exception { 2. } Class A: 1. public class A { 2. 3. public String sayHello(String name) throws TestException { 4. 5. if(name == null) { 6. throw new TestException(); 7. } 8. 9. return Hello + name; 10. } 11. 12. } A programmer wants to use this code in an application: 45. A a=new A(); 46. System.out.println(a.sayHello(John)); a. b. c. d. e. Which two are true? (Choose two.) Class A will not compile. Line 46 can throw the unchecked exception TestException. Line 45 can throw the unchecked exception TestException. Line 46 will compile if the enclosing method throws a TestException. Line 46 will compile if enclosed in a try block, where TestException is caught.

f. Answer: Line 46 will compile if the enclosing method throws a TestException. + Line 46 will compile if enclosed in a try block, where TestException is caught. MARK: 2 CHAPTER: ----------------------- Page 16----------------------MIX Yes CHOICES: QN=29 (50) 2. 3. 4. 5. 6. Consider the following application: 1. class Q6 { public static void main(String args[]) { Holder h = new Holder(); h.held = 100; h.bump(h); System.out.println(h.held);

a. b. c. d. e. f. Answer: 101 MARK: 1 CHAPTER: MIX Yes CHOICES:

7. } 8. } 9. 10. class Holder { 11. public int held; 12. public void bump(Holder theHolder) { 13. theHolder.held++; 14 } 15. } 15. } What value is printed out at line 6? 0 1 100 101

QN=30 Consider the following application: (51) 1. class Q7 { 2. public static void main(String args[]) { 3. double d = 12.3; 4. Decrementer dec = new Decrementer(); 5. dec.decrement(d); 6. System.out.println(d); 7. } 8. } 9. 10. class Decrementer { ----------------------- Page 17----------------------11. public void decrement(double decMe) { 12. decMe = decMe - 1.0; 13. } 14. } What value is printed out at line 6? 0.0 1.0 12.3 11.3

a. b. c. d. e. f. Answer: 12.3 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=31 (173) 2. 3. 4. 5.

Consider the following class definition: 1. public class Test extends Base { public Test(int j) { } public Test(int j, int k) { super(j, k);

a. b. c. d. e. f. Answer: Test t = new Test(1) + Test t = new Test(1, 2); MARK: 1 CHAPTER: MIX Yes CHOICES: QN=32 (174) 2. 3. 4. Consider the following class definition: 1. public class Test extends Base { public Test(int j) { } public Test(int j, int k) {

6. } 7. } Which of the following are legitimate calls to construct instances of the Test class? (Choose two.) Test t = new Test(); Test t = new Test(1); Test t = new Test(1, 2); Test t = new Test(1, 2, 3); Test t = (new Base()).new Test(1);

----------------------- Page 18----------------------5. super(j, k); 6. } 7. } Which of the following forms of constructor must exist explicitly in the definition of the Base class? Assume Test and Base are in the same package. (Choose two.) Base() { } Base(int j) { } Base(int j, int k) { } Base(int j, int k, int l) { }

a. b. c. d. e. f. Answer: Base() { } + Base(int j, int k) { } MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=33 Consider the following class: (131) 1. class Cruncher { 2. void crunch(int i) { 3. System.out.println("int version"); 4. } 5. void crunch(String s) { 6. System.out.println("String version"); 7. } 8. 9. public static void main(String args[]) { 10. Cruncher crun = new Cruncher(); 11. char ch = "p"; 12. crun.crunch(ch); 13. } 14. } Which of the following statements is true? (Choose one.) a. Line 5 will not compile, because void methods cannot be overridden. b. Line 12 will not compile, because no version of crunch() takes a char

argument. c. The code will compile but will throw an exception at line 12. d. The code will compile and produce the following output: int version. e. The code will compile and produce the following output: String version. f. Answer: The code will compile and produce the following output: int version. MARK: 2 CHAPTER: MIX Yes ----------------------- Page 19----------------------CHOICES: QN=34 Consider the following classes, declared in separate source files: (172) 1. public class Base { 2. public void method(int i) { 3. System.out.print(Value is + i); 4. } 5. } 1. public class Sub extends Base { 2. public void method(int j) { 3. System.out.print(This value is + j); 4. } 5. public void method(String s) { 6. System.out.print(I was passed + s); 7. } 8. public static void main(String args[]) { 9. Base b1 = new Base(); 10. Base b2 = new Sub(); 11. b1.method(5); 12. b2.method(6); 13. } 14. } What output results when the main method of the class Sub is run?(Choose one.) Value is 5Value is 6 This value is 5This value is 6 Value is 5This value is 6 This value is 5Value is 6 I was passed 5I was passed 6

a. b. c. d. e. f. Answer: Value is 5This value is 6 MARK: 2 CHAPTER: MIX Yes CHOICES: QN=35 (133) 1. 2. 3. 4.

Consider the following code. Which line will not compile? (Choose one.) Object ob = new Object(); String[] stringarr = new String[50]; Float floater = new Float(3.14f); ob = stringarr;

----------------------- Page 20----------------------5. ob = stringarr[5];

a. b. c. d. e. f. Answer: Line 6 MARK: 1 CHAPTER: MIX Yes CHOICES:

6. floater = ob; 7. ob = floater; Line 4 Line 5 Line 6 Line 7

QN=36 Consider the following code: (156) 1. public class Assertification { 2. public static void main(String[] args) { 3. assert args.length == 0; 4 } 5. } Which of the following conditions must be true in order for the code to throw an AssertionError? Assume you are using release 5.0. (Choose two.) a. The source code must be compiled with the -source 1.5 flag. b. The application must be run with the -enableassertions flag or another assertionenabling flag. c. The args array must have exactly zero elements. d. The args array must have one or more elements. e. f. Answer: The application must be run with the -enableassertions flag or another assertionenabling flag. + The args array must have one or more elements. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=37 (64) 1. 2. 3. Consider the following code: StringBuffer sbuf = new StringBuffer(); sbuf = null; System.gc();

----------------------- Page 21----------------------Choose true statement. (Choose one.) a. After line 2 executes, the StringBuffer object is garbage collected. b. After line 3 executes, the StringBuffer object is garbage collected. c. After line 2 executes, the StringBuffer object is eligible for garbage collection. d. After line 3 executes, the StringBuffer object is eligible for garbage collection. e. f. Answer: After line 2 executes, the StringBuffer object is eligible for garbage collection. MARK: 1 CHAPTER:

MIX Yes CHOICES: QN=38 Consider the following code: (135) 1. Cat sunflower; 2. Washer wawa; 3. SwampThing pogo; 4. 5. sunflower = new Cat(); 6. wawa = sunflower; 7. pogo = (SwampThing)wawa; Which of the following statements is true? (Choose one.) Where: Mammal extends Animal Cat, SwampThing extends Mammal Cat implements Washer a. Line 6 will not compile; an explicit cast is required to convert a Cat to a Washer. b. Line 7 will not compile, because you cannot cast an interface to a class. c. The code will compile and run, but the cast in line 7 is not required and can be eliminated. d. The code will compile but will throw an exception at line 7, because runtime conversion from an interface to a class is not permitted. e. The code will compile but will throw an exception at line 7, because the runtime class of wawa cannot be converted to type SwampThing. f. Answer: The code will compile but will throw an exception at line 7, because th e runtime class of wawa cannot be converted to type SwampThing. MARK: 2 CHAPTER: MIX Yes ----------------------- Page 22----------------------CHOICES: QN=39 (134) 2. 3. 4. 5. 6. Consider the following code: 1. Dog rover, fido; Animal anim; rover = new Dog(); anim = rover; fido = (Dog)anim;

Where: Mammal extends Animal Dog extends Mammal a. b. c. d. e. n Which of the following statements is true? (Choose one.) Line 5 will not compile. Line 6 will not compile. The code will compile but will throw an exception at line 6. The code will compile and run. The code will compile and run, but the cast in line 6 is not required and ca be eliminated.

f. Answer: The code will compile and run. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=40 Consider the following code: (147) 1. for (int i = 0; i < 2; i++) { 2. for (int j = 0; j < 3; j++) { 3. if (i == j) { 4. continue; 5. } 6. System.out.println("i = " + i + " j = " + j); 7. } 8. } Which lines would be part of the output? (Choose four.) a. i = 0 j = 0 b. i = 0 j = 1 c. i = 0 j = 2 d. i = 1 j = 0 e. i = 1 j = 1 f. i = 1 j = 2 ----------------------- Page 23----------------------Answer: {i = 0 j = 1} {i = 0 j = 2} + {i = 1 j = 0} + {i = 1 j = 2} MARK: 1 CHAPTER: MIX Yes CHOICES: QN=41 Consider the following code: (148) 1. outer: for (int i = 0; i < 2; i++) { 2. for (int j = 0; j < 3; j++) { 3. if (i == j) { 4. continue outer; 5. } 6. System.out.println("i = " + i + " j = " + j); 7. } 8. } Which lines would be part of the output? (Choose one.) a. i = 0 j = 0 b. i = 0 j = 1 c. i = 0 j = 2 d. i = 1 j = 0 e. i = 1 j = 1 f. i = 1 j = 2 Answer: i = 1 j = 0 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=42 Consider the following code: (136) 1. Raccoon rocky; 2. SwampThing pogo; 3. Washer w; 4.

5. rocky = new Raccoon(); 6. w = rocky; 7. pogo = w; Which of the following statements is true? (Choose one.) Where: Mammal extends Animal Dog, Raccoon, Swamp Thing extends Mammal Raccoon implements Washer a. Line 6 will not compile; an explicit cast is required to convert a Raccoon to ----------------------- Page 24----------------------a Washer. b. Line 7 will not compile; an explicit cast is required to convert a Washer to a SwampThing. c. The code will compile and run. d. The code will compile but will throw an exception at line 7, because runtime conversion from an interface to a class is not permitted. e. The code will compile but will throw an exception at line 7, because the runtime class of w cannot be converted to type SwampThing. f. Answer: Line 7 will not compile; an explicit cast is required to convert a Was her to a SwampThing. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=43 Consider the following definition: (175) 1. public class Outer { 2. public int a = 1; 3. private int b = 2; 4. public void method(final int c) { 5. int d = 3, f=10; 6. class Inner { 7. private void iMethod(int e) { 8. 9. } 10. } 11. } 12. } Which variables can be referenced at line 8? (Choose four.) a. a b. b c. c d. d e. e f. f Answer: ABCE MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=44 Consider the following line of code: ----------------------- Page 25----------------------(49) int[] x = new int[25]; After execution, which statements are true? (Choose two.) a. x[24] is 0 b. x[24] is undefined c. x[25] is 0 d. x[0] is null e. x.length is 25 f. Answer: x[24] is 0 + x.length is 25 MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=45 (169) 1. 2. 3. Consider these classes, defined in separate source files: public class Test1 { public float aMethod(float a, float b) throws IOException {.. } }

1. public class Test2 extends Test1 { 2. 3.} Which of the following methods would be legal (individually) at line 2 in class Test2? (Choose two) float aMethod(float a, float b) {...} public int aMethod(int a, int b) throws Exception {...} public float aMethod(float a, float b) throws Exception {...} public float aMethod(float p, float q) {...}

a. b. c. d. e. f. Answer: public int aMethod(int a, int b) throws Exception {...} + public float aMethod(float p, float q) {...} MARK: 1 CHAPTER: MIX Yes CHOICES: QN=46 Consider this class: (167) 1. public class Test1 { 2. public float aMethod(float a, float b) { ----------------------- Page 26----------------------3. } 4. 5. } Which of the following methods would be legal if added (individually) at line 4? (Choose three.) a. public int aMethod(int a, int b) { } b. public float aMethod(float a, float b) { }

c. public float aMethod(float a, float b, int c) throws Exception { } d. public float aMethod(float c, float d) { } e. private float aMethod(int a, int b, int c) { } f. Answer: public int aMethod(int a, int b) { } + public float aMethod(float a, f loat b, int c) throws Exception { } + private float aMethod(int a, int b, int c) { } MARK: 1 CHAPTER: MIX Yes CHOICES: QN=47 Give: (1517) 11. public static Iterator reverse(List list) { 12. Collections.reverse(list); 13. return list.iterator(); 14. } 15. public static void main(String[] args) { 16. List list = new ArrayList(); 17. list.add( 1); list.add(2); list.add(3); 18. for (Object obj: reverse(list)) 19. System.out.print(obj + ,); 20. } What is the result? (Choose one.) a. 3, 2, 1, b. 1, 2, 3, c. Compilation fails. d. The code runs with no output. e. An exception is thrown at runtime. f. Answer: Compilation fails. MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 27----------------------QN=48 Given a string constructed by calling s = new String("xyzzy"), which of th e (212) calls modifies the string? (Choose one.) a. s.append("aaa"); b. s.trim(); c. s.substring(3); d. s.replace(z, a); e. s.concat(s); f. None of the above Answer: None of the above MARK: 1 CHAPTER: MIX No CHOICES: QN=49 Given arrays a1 and a2, which call returns true if a1 and a2 have the same (231) length, and a1[i].equals(a2[i]) for every legal index i? (Choose one.) a. java.util.Arrays.equals(a1, a2); b. java.util.Arrays.compare(a1, a2);

c. java.util.List.compare(a1, a2); d. e. f. Answer: java.util.Arrays.equals(a1, a2); MARK: 1 CHAPTER: MIX Yes CHOICES: QN=50 Given the following class: (248) public class Xyz implements java.io.Serializable { public int iAmPublic; private int iAmPrivate; static int iAmStatic; trAnswerient int iAmTrAnswerient; volatile int iAmVolatile; } Assuming the class does not perform custom serialization, which fields are written when an instance of Xyz is serialized? (Choose three.) a. iAmPublic b. iAmPrivate c. iAmStatic d. iAmTrAnswerient ----------------------- Page 28----------------------e. iAmVolatile f. Answer: iAmPublic + iAmPrivate + iAmVolatile MARK: 1 CHAPTER: MIX Yes CHOICES: QN=51 Given the following code, and making no other changes, which (113) combination of access modifiers (public, protected, or private) can legall y be placed before aMethod() on line 3 and be placed before aMethod() on line 8? (Choose one.) 1. class SuperDuper 2. { 3. void aMethod() { } 4. } 5. 6. class Sub extends SuperDuper 7. { 8. void aMethod() { } 9. } a. line 3: public; line 8: private b. line 3: protected; line 8: private c. line 3: default; line 8: private d. line 3: private; line 8: protected e. line 3: public; line 8: protected f. Answer: line 3: private; line 8: protected MARK: 1 CHAPTER: MIX Yes

CHOICES: QN=52 Given the following code, which of the following will compile? (Choose (187) three.) a. b. c. d. e. f. enum Spice { NUTMEG, CINNAMON, CORIANDER, ROSEMARY; } Spice sp = Spice.NUTMEG; Object ob = sp; Spice sp = Spice.NUTMEG; Object ob = (Object)sp; Object ob = new Object(); Spice sp = ob Object ob = new Object(); Spice sp = (Spice)ob; String ob = new String(); Spice sp = ob;

----------------------- Page 29----------------------Answer: Spice sp = Spice.NUTMEG; Object ob = sp; + Spice sp = Spice.NUTMEG; Obj ect ob = (Object)sp; + Object ob = new Object(); Spice sp = (Spice)ob; MARK: 1 CHAPTER: MIX Yes CHOICES: QN=53 Given the following: (224) List<String> names = new ArrayList<String>(); which of the following are legal? (Choose two.) a. Iterator<String> iter = names.iterator(); b. for (String s:names) c. while (String s:names) d. e. f. Answer: Iterator<String> iter = names.iterator(); + for (String s:names) MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=54 Given: (1524) 11. static class A { 12. void process() throws Exception { throw new Exception(); } 13. } 14. static class B extends A { 15. void process() { System.out.println(B ); } 16. } 17.public static void main(String[] args) { 18. A a=new B(); 19. a.process(); 20. } What is the result? (Choose one.) a. B b. The code runs with no output. c. An exception is thrown at runtime. d. Compilation fails because of an error e. Compilation fails because of an error f. Compilation fails because of an error Answer: Compilation fails because of an

in line 15. in line 18. in line 19. error in line 19.

----------------------- Page 30----------------------MARK: 2 CHAPTER: MIX Yes CHOICES: QN=55 Given: (1407) public class Bar { public static void main(String [] args) { int x =5; boolean b1 = true; boolean b2 = false; if((x==4) && !b2) System.out.print("l "); System.out.print("2 "); if ((b2 = true) && b1) System.out.print("3"); } } What is the result? (Choose one.) a. 2 b. 3 c. 1 2 d. 2 3 e. 1 2 3 f. Compilation fails. Answer: 2 3 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=56 Given: (1418) 1. public interface A { 2. String DEFAULT_GREETING = Hello World; 3. public void method1(); 4. } A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct? (Choose one.) a. public interface B extends A { } b. public interface B implements A {} ----------------------- Page 31----------------------c. public interface B instanceOf A {} d. public interface B inheritsFrom A { } e. f. Answer: public interface B extends A { } MARK: 0.5 CHAPTER: MIX Yes CHOICES:

QN=57 Given: (1420) 10. abstract public class Employee { 11. protected abstract double getSalesAmount(); 12. public double getCommision() { 13. return getSalesAmount() * 0.15; 14. } 15. } 16. class Sales extends Employee { 17. // insert method here 18. } Which two methods, inserted independently at line 17, correctly complete the Sales class? (Choose two.) a. double getSalesAmount() { return 1230.45; } b. public double getSalesAmount() { return 1230.45; } c. private double getSalesAmount() { return 1230.45; } d. protected double getSalesAmount() { return 1230.45; } e. f. Answer: public double getSalesAmount() { return 1230.45; } + protected double g etSalesAmount() { return 1230.45; } MARK: 1 CHAPTER: MIX Yes CHOICES: QN=58 Given: (1530) 10. class MakeFile { 11. public static void main(String[] args) { 12. try { 13. File directory = new File(d); 14. File file = new File(directory,f); 15. if(!file.exists()) { ----------------------- Page 32----------------------16. file.createNewFile(); 17. } 18. }catch (IOException e) { 19. e.printStackTrace (); 20. } 21. } 22. } The current directory does NOT contain a directory named d. Which three are true? (Choose three.) a. Line 16 is never executed. b. An exception is thrown at runtime. c. Line 13 creates a File object named d. d. Line 14 creates a File object named f. e. Line 13 creates a directory named d in the file system. f. Line 16 creates a directory named d and a file f within it in the file system. Answer: An exception is thrown at runtime. + Line 13 creates a File object name d d. + Line 14 creates a File object named f. MARK: 2 CHAPTER: MIX Yes

CHOICES: QN=59 Given: (1415) 10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile? (Choose one.) a. Direction d = NORTH; b. Nav.Direction d = NORTH; c. Direction d = Direction.NORTH; d. Nav.Direction d = Nav.Direction.NORTH; e. f. Answer: Nav.Direction d = Nav.Direction.NORTH; MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 33----------------------QN=60 (1416) 10. 11. 12. 13. 14. 15. 16. 17. 18. Given: interface Foo { int bar(); } public class Sprite { public int fubar( Foo foo) { return foo.bar(); } public void testFoo() { fubar( // insert code here ); } }

Which code, inserted at line 15, allows the class Sprite to compile? (Choose one.) a. Foo { public int bar() { return 1; } } b. new Foo { public int bar() { return 1; } } c. new Foo() { public int bar(){return 1; } } d. new class Foo { public int bar() { return 1; } } e. f. Answer: new Foo() { public int bar(){return 1; } } MARK: 1 CHAPTER: MIX Yes CHOICES: QN=61 Given: (1528) 10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. }

And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine? (Choose one.) a. StackOverflowError b. NullPointerException ----------------------- Page 34----------------------c. NumberFormatException d. IllegalArgumentException e. ExceptionlnlnitializerError f. Answer: StackOverflowError MARK: 1 CHAPTER: MIX Yes CHOICES: QN=62 Given: (1419) 11. public abstract class Shape { 12. int x; 13. int y; 14. public abstract void draw(); 15. public void setAnchor(int x, int y) { 16. this.x = x; 17. this.y = y; 18. } 19. } and a class Circle that extends and fully implements the Shape class. Which is correct? (Choose one.) a. Shape s = new Shape(); s.setAnchor(10,10); s.draw(); b. Circle c = new Shape(); c.setAnchor(10,10); c.draw(); c. Shape s = new Circle(); s.setAnchor(10,10); s.draw(); d. Shape s = new Circle(); s->setAnchor(10,10); s->draw(); e. Circle c = new Circle(); c.Shape.setAnchor(10,10); c.Shape.draw(); f. Answer: Shape s = new Circle(); s.setAnchor(10,10); s.draw(); MARK: 1 CHAPTER: MIX Yes CHOICES: QN=63 Given: (1425) 11. public static void main(String[] args) { 12. Object obj =new int[] { 1,2,3 }; 13. int[] someArray = (int[])obj; 14. for (int i: someArray) System.out.print(i +" "); 15. } ----------------------- Page 35-----------------------

What is the result? (Choose one.) a. 1 2 3 b. Compilation fails because of an error in line 12. c. Compilation fails because of an error in line 13. d. Compilation fails because of an error in line 14. e. A ClassCastException is thrown at runtime. f. Answer: 1 2 3 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=64 Given: (1526) 11. public static void main(String[] args) { 12. try { 13. args=null; 14. args[0] = test; 15. System.out.println(args[0]); 16. }catch (Exception ex) { 17. System.out.println(Exception); 18. }catch (NullPointerException npe) { 19. System.out.println(NullPointerException); 20. } 21. } What is the result? (Choose one.) a. test b. Exception c. Compilation fails. d. NullPointerException e. f. Answer: Compilation fails. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=65 Given: (1421) 11. public static void parse(String str) { ----------------------- Page 36----------------------12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. try { float f= Float.parseFloat(str); } catch (NumberFormatException nfe) { f = 0; } finally { System.out.println(f); } } public static void main(String[] args) { parse("invalid"); }

What is the result? (Choose one.) a. 0.0

b. Compilation fails. c. A ParseException is thrown by the parse method at runtime. d. A NumberFormatException is thrown by the parse method at runtime. e. f. Answer: Compilation fails. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=66 Given: (1532) 11. String test = This is a test; 12. String[] tokens = test.split(\s); 13. System.out.println(tokens.length); What is the result? (Choose one.) a. 0 b. 1 c. 4 d. Compilation fails. e. An exception is thrown at runtime. f. Answer: Compilation fails. MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 37----------------------QN=67 Given: (1519) 12. public class AssertStuff { 14. public static void main(String [] args) { 15. int x= 5; 16. int y= 7; 18. assert (x > y): stuff; 19. System.out.println(passed); 20. } 21. } And these command line invocations: java AssertStuff java -ea AssertStuff What is the result? (Choose one.) a. passed stuff b. stuff passed c. passed An AssertionError is thrown with the word stuff added to the stack trace. d. passed An AssertionError is thrown without the word stuff added to the stack trace. e. passed An AssertionException is thrown with the word stuff added to the stack

trace. f. passed An AssertionException is thrown without the word stuff added to the stack trace. Answer: passed .An AssertionError is thrown with the word stuff added to the sta ck trace. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=68 Given: (1516) 12. public class Test { 13. public enum Dogs {collie, harrier}; 14. public static void main(String [] args) { 15. Dogs myDog = Dogs.collie; 16. switch (myDog) { ----------------------- Page 38----------------------17. 18. 19. 20. 21. 22. 23. case collie: System.out.print(collie ); case harrier: System.out.print(harrier ); } } }

What is the result? (Choose one.) a. collie b. harrier c. Compilation fails. d. collie harrier e. An exception is thrown at runtime. f. Answer: collie harrier MARK: 1 CHAPTER: MIX Yes CHOICES: QN=69 Given: (1414) 13. public class Pass { 14. public static void main(String [] args) { 15. int x = 5; 16. Pass p = new Pass(); 17. p.doStuff(x); 18. System.out.print(" main x = "+ x); 19. } 20. 21. void doStuff(int x) { 22. System.out.print("doStuff x = "+ x++); 23. } 24. } a. b. What is the result? (Choose one.) Compilation fails. An exception is thrown at runtime.

c. doStuff x = 6 main x = 6 d. doStuff x = 5 main x = 5 e. doStuff x = 5 main x = 6 f. doStuff x = 6 main x = 5 Answer: doStuff x = 5 main x = 5 MARK: 1 ----------------------- Page 39----------------------CHAPTER: MIX Yes CHOICES: QN=70 Given: (1413) 13. public class Pass { 14. public static void main(String [] args) { 15. int x = 5; 16. Pass p = new Pass(); 17. p.doStuff(x); 18. System.out.print(" main x = "+ x); 19. } 20. 21. void doStuff(int x) { 22. System.out.print("doStuffx = "+ x++); 23. } 24. } What is the result? (Choose one.) a. Compilation fails. b. An exception is thrown at runtime. c. doStuffx = 6 main x = 6 d. doStuffx = 5 main x = 5 e. doStuffx = 5 main x = 6 f. doStuffx = 6 main x = 5 Answer: doStuffx = 5 main x = 5 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=71 Given: (1409) 20. public class CreditCard { 22. private String cardlD; 23. private Integer limit; 24. public String ownerName; 26. public void setCardlnformation(String cardlD, 27. String ownerName, 28. Integer limit) { 29. this.cardlD = cardlD; 30. this.ownerName = ownerName; 31. this.limit = limit; ----------------------- Page 40----------------------32. } 33. } Which is true? (Choose one.)

a. The class is fully encapsulated. b. The code demonstrates polymorphism. c. The ownerName variable breaks encapsulation. d. The cardlD and limit variables break polymorphism. e. The setCardlnformation method breaks encapsulation. f. Answer: The ownerName variable breaks encapsulation MARK: 1 CHAPTER: MIX Yes CHOICES: QN=72 Given: (1412) 23. Object [] myObjects = { 24. new Integer(12), 25. new String(foo), 26. new Integer(5), 27. new Boolean(true) 28. }; 29. java.util.Array.sort(myObjects); 30. for( int i=0; i<myObjects.length; i++) { 31. System.out.print(myObjects[i].toString()); 32. System.out.print( ); 33. } What is the result? (Choose one.) a. Compilation fails due to an error in line 23. b. Compilation fails due to an error in line 29. c. A ClassCastException occurs in line 29. d. A ClassCastException occurs in line 31. e. The value of all four objects prints in natural order. f. Answer: Compilation fails due to an error in line 29. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=73 Given: ----------------------- Page 41----------------------(1408) 31. 32. 33. 34. 35. 36. 37. 38. // some code here try { // some code here } catch (SomeException se) { // some code here } finally { // some code here }

a. b. c. d. e.

Under which three circumstances will the code on line 37 be executed? (Choose three.) The instance gets garbage collected. The code on line 33 throws an exception. The code on line 35 throws an exception. The code on line 31 throws an exception. The code on line 33 executes successfully.

f. Answer: The code on line 33 throws an exception. + The code on line 35 throws an exception. + The code on line 33 executes successfully MARK: 1 CHAPTER: MIX Yes CHOICES: QN=74 Given: (1522) 33. try { 34. // some code here 35. }catch (NullPointerException e1) { 36. System.out.print(a); 37. }catch (RuntimeException e2) { 38. System.out.print(b); 39. } finally { 40. System.out.print(c); 41. } What is the result if a NullPointerException occurs on line 34? (Choose one.) a. c b. a c. ab d. ac e. bc f. abc Answer: ac ----------------------- Page 42----------------------MARK: 1 CHAPTER: MIX Yes CHOICES: QN=75 Given: (1422) 55. int []x= {1, 2,3,4, 5}; 56. int y[] =x; 57. System.out.println(y[2]); Which is true? (Choose one.) a. Line 57 will print the value 2. b. Line 57 will print the value 3. c. Compilation will fail because of an error in line 55. d. Compilation will fail because of an error in line 56. e. f. Answer: Line 57 will print the value 3. MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=76 Given: (1518) 8. public class test { 9. public static void main(String [] a) {

10. assert a.length == 1; 11. } 12.} Which two will produce an AssertionError? (Choose two.) a. java test b. java -ea test c. java test file1 d. java -ea test file1 e. java -ea test file1 file2 f. java -ea:test test file1 Answer: java -ea test + java -ea test file1 file2 MARK: 1 CHAPTER: MIX Yes ----------------------- Page 43----------------------CHOICES: QN=77 Given: (1529) 1. public class TestString3 { 2. public static void main(String[] args) { 3. // insert code here 5. System.out.println(s); 6. } 7. } Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose two.) String s = 123456789; s = (s-123).replace(1,3,24) - 89; StringBuffer s = new StringBuffer(123456789); s.delete(0,3).replace( 1,3, 24).delete(4,6); StringBuffer s = new StringBuffer(123456789); s.substring(3,6).delete( 1 ,3).insert( 1, 24); StringBuilder s = new StringBuilder(123456789); s.substring(3,6).delete( 1 ,2).insert( 1, 24); StringBuilder s = new StringBuilder(123456789); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, 24);

a. b. c. d. e.

f. Answer: StringBuffer s = new StringBuffer(123456789); s.delete(0,3).replace( 1,3 , 24).delete(4,6); + StringBuilder s = new StringBuilder(123456789); s.delete(0,3). delete( 1 ,3).delete(2,5).insert( 1, 24); MARK: 1 CHAPTER: MIX Yes CHOICES: QN=78 Given: (1514) 10. class Line { 11. public static class Point { } 12. } 13. 14. class Triangle { 15. // insert code here 16. } Which code, inserted at line 15, creates an instance of the Point class defined in Line? (Choose one.) a. Point p = new Point();

b. Line.Point p = new Line.Point(); c. The Point class cannot be instatiated at line 15. d. Line l = new Line() ; Point p = new l.Point(); e. ----------------------- Page 44----------------------f. Answer: Line.Point p = new Line.Point(); MARK: 1 CHAPTER: MIX Yes CHOICES: QN=79 Given: (1406) 10. public class Bar { 11. static void foo(int...x) { 12. // insert code here 13. } 14. } Which two code fragments, inserted independently at line 12, will allow the class to compile? (Choose two.) a. foreach(x) System.out.println(z); b. for(int z : x) System.out.println(z); c. while( x.hasNext()) System.out.println( x.next()); d. for( int i=0; i< x.length; i++ ) System.out.println(x[i]); e. f. Answer: for(int z : x) System.out.println(z); + for( int i=0; i< x.length; i++ ) System.out.println(x[i]); MARK: 1 CHAPTER: MIX Yes CHOICES: QN=80 Given: (1405) 11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12? (Choose three.) a. final b. static c. native d. public e. protected f. abstract Answer: final + static + public MARK: 1 CHAPTER: ----------------------- Page 45----------------------MIX Yes CHOICES: QN=81 Given: (1523) class A { public void process() { System.out.print("A "); }

public static void main(String[] args) { try { ((A)new B()).process(); } catch (Exception e) { System.out.print("Exception "); } } class B extends A { public void process() throws RuntimeException { super.process(); if (true) throw new RuntimeException(); System.out.print("B"); } }

What is the result? (Choose one.) Exception A Exception A Exception B A B Exception Compilation fails because of an error in line: public void process() throws RuntimeException f. Compilation fails because of an error in line: try { ((A)new B()).process(); } Answer: A Exception MARK: 2 CHAPTER: MIX Yes CHOICES: a. b. c. d. e. QN=82 How can you ensure that multithreaded code does not deadlock? (Choose (209) one.) a. Synchronize access to all shared variables. b. Make sure all threads yield from time to time. c. Vary the priorities of your threads. d. There is no single technique that can guarantee non-deadlocking code. e. f. Answer: There is no single technique that can guarantee non-deadlocking code. MARK: 1 ----------------------- Page 46----------------------CHAPTER: MIX Yes CHOICES: QN=83 How can you force garbage collection of an object? (Choose one.) (52) a. Garbage collection cannot be forced. b. Call System.gc(). c. Call System.gc(), passing in a reference to the object to be garbagecollected. d. Call Runtime.gc(). e. Set all references to the object to new values (null, for example). f. Answer: Garbage collection cannot be forced. MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=84

How do you prevent shared data from being corrupted in a multithreaded

(208) environment? (Choose one.) a. Mark all variables as synchronized. b. Mark all variables as volatile. c. Use only static variables. d. Access the variables only via synchronized methods. e. f. Answer: Access the variables only via synchronized methods. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=85 How do you use the File class to list the contents of a directory? (Ch oose (236) one.) a. String[] contents = myFile.list(); b. File[] contents = myFile.list(); c. StringBuilder[] contents = myFile.list(); d. The File class does not provide a way to list the contents of a directory. e. f. Answer: String[] contents = myFile.list(); ----------------------- Page 47----------------------MARK: 1 CHAPTER: MIX Yes CHOICES: QN=86 How many bytes does the following code write to file dest? (Choose one .) (237) 1. try { 2. FileOutputStream fos = newFileOutputStream("dest"); 3. DataOutputStream dos = new DataOutputStream(fos); 4. dos.writeInt(3); 5. dos.writeFloat(0.0001f); 6. dos.close(); 7. fos.close(); 8. } 9. catch (IOException e) { } a. 2 b. 8 c. 12 d. 16 e. The number of bytes depends on the underlying system. f. Answer: 8 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=87 (204) a. One How many locks does an object have? (Choose one.)

b. One for each method c. One for each synchronized method d. One for each non-static synchronized method e. f. Answer: One MARK: 0.5 CHAPTER: MIX Yes CHOICES: ----------------------- Page 48----------------------QN=88 If all three top-level elements occur in a source file, they must appear i n (48) which order? (Choose one.) a. Imports, package declarations, classes/interfaces/enums b. Classes/interfaces/enums, imports, package declarations c. Package declaration must come first; order for imports and class/interfaces/enum definitions is not significant d. Package declaration, imports, class/interface/enum definitions. e. Imports must come first; order for package declarations and class/interface/enum definitions is not significant f. Answer: Package declaration, imports, class/interface/enum definitions. MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=89 If class Y extends class X, the two classes are in different packages, and (123) class X has a protected method called abby(), then any instance of Y may call the abby() method of any other instance of Y. a. True b. False c. d. e. f. Answer: False MARK: 1 CHAPTER: MIX Yes CHOICES: QN=90 If you attempt to compile and execute the following application, will it (197) ever print out the message In xxx? 1. 2. 3. 4. 5. 6. 7. 8. 9. class TestThread3 extends Thread { public void run() { System.out.println("Running"); System.out.println("Done"); } private void xxx() { System.out.println(In xxx); }

----------------------- Page 49----------------------10. 11. public static void main(String args[]) { 12. TestThread3 ttt = new TestThread3(); 13. ttt.xxx(); 14. ttt.start(); 12. } 13. } a. Yes b. No c. d. e. f. Answer: Yes MARK: 1 CHAPTER: MIX Yes CHOICES: QN=91 If you need a Set implementation that provides value-ordered iteration, (1877) which class should you use? (Choose one.) a. HashSet b. LinkedHashSet c. TreeSet d. e. f. Answer: TreeSet MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=92 In order for objects in a List to be sorted, those objects must implement (1875) which interface and method? (Choose one.) a. Comparable interface and its compareTo method. b. Comparable interface and its compare method c. Compare interface and its compareTo method d. Comparable interface and its equals method e. f. Answer: Comparable interface and its compareTo method. MARK: 1 ----------------------- Page 50----------------------CHAPTER: MIX Yes CHOICES: QN=93 In the following code fragment, after execution of line 1, sbuf refere nces (218) an instance of the StringBuffer class. After execution of line 2, sbuf still references the same instance. 1. StringBuffer sbuf = new StringBuffer("FPT"); 2. sbuf.append("-University");

a. True b. False c. d. e. f. Answer: True MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=94 In the following code fragment, after execution of line 1, sbuf refere nces (217) an instance of the StringBuffer class. After execution of line 2, sbuf still references the same instance. 1. StringBuffer sbuf = new StringBuffer("FPT"); 2. sbuf.insert(3, "-University"); a. True b. False c. d. e. f. Answer: True MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=95 ? (130) In the following code, what are the possible types for variable result (Choose the most complete true Answer.)

----------------------- Page 51----------------------1. byte b = 11; 2. short s = 13; 3. result = b * ++s; byte, short, int, long, float, double boolean, byte, short, char, int, long, float, double byte, short, char, int, long, float, double byte, short, char int, long, float, double

a. b. c. d. e. f. Answer: int, long, float, double MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=96 Interface ____ helps manage the connection between a Java program and a (7266) database. a. ResultSet b. DriverManager c. Statement d. Connection e.

f. Answer: Connection MARK: 1 CHAPTER: MIX Yes CHOICES: QN=97 Is it possible to define a class called Thing so that the following method (76) can return true under certain circumstances? boolean weird(Thing s) { Integer x = new Integer(5); return s.equals(x); } a. Yes b. No c. d. e. f. Answer: Yes MARK: 0.5 ----------------------- Page 52----------------------CHAPTER: MIX Yes CHOICES: QN=98 Is it possible to write code that can execute only if the current thre ad owns (205) multiple locks? a. Yes b. No c. d. e. f. Answer: Yes MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=99 JDBC supports ______ and ______ models. (301) a. Single-tier and two-tier b. Two-tier and three-tier c. Three-tier and four-tier d. None of the others e. f. Answer: Two-tier and three-tier MARK: 1 CHAPTER: MIX No CHOICES: QN=100 (305) MVC is short call of

a. Model-View-Controller b. Multiple-View-Controller c. Metal-View-Controller d. e. f. Answer: Model-View-Controller MARK: 0.5 ----------------------- Page 53----------------------CHAPTER: MIX Yes CHOICES: QN=101 public class Test{ (129) public static void main(String[] args){ byte b = 2; byte b1 = 3; b = b * b1; System.out.println("b="+b); } } What is the output? a. b=6 b. No output because of compile error c. No output because of compile error d. No output because of compile error e. No output because of compile error f. Answer: No output because of compile MARK: 1 CHAPTER: MIX Yes CHOICES:

at at at at

line: b = b * b1; line: System.out.println("b="+b); line: byte b = 2; line: byte b = 3; b = b * b1;

error at line:

QN=102 public class Test{ (77) public static void main(String[] args){ Object ob1= new Object(); Object ob2= new Object(); if(ob1.equals(ob2)) System.out.println("ob1 equals ob2"); if(ob1==ob2) System.out.println("ob1==ob2"); System.out.println("Have a nice day!"); } } What is the output? a. ob1 equals ob2 Have a nice day! b. ob1==ob2 Have a nice day! c. Have a nice day! d. No output ----------------------- Page 54----------------------e. f.

Answer: Have a nice day! MARK: 1 CHAPTER: MIX Yes CHOICES: QN=103 public class Test{ (4924) public static void main(String[] args){ Object ob1= new Object(); Object ob2= ob1; if(ob1.equals(ob2)) System.out.println("ob1 equals ob2"); if(ob1==ob2) System.out.println("ob1==ob2"); System.out.println("Have a nice day!"); } } What is the output? a. ob1 equals ob2 ob1==ob2 Have a nice day! b. ob1 equals ob2 Have a nice day! c. ob1==ob2 Have a nice day! d. None of the above e. f. Answer: ob1 equals ob2 ; ob1==ob2 MARK: 1 CHAPTER: MIX No CHOICES: QN=104 public class Test{ (4925) public static void main(String[] args){ String s1 = "xyz"; String s2 = "xyz"; if (s1 == s2) System.out.println("Line 4"); if (s1.equals(s2)) System.out.println("Line 6"); ----------------------- Page 55----------------------} } a. What is the output? Line 4 Line 6 Line 4 Line 6 No output, compile error No output

b. c. d. e. f. Answer: Line 4 ; Line 6 MARK: 1 CHAPTER: MIX Yes

CHOICES: QN=105 public class Test{ (219) public static void main(String[] args){ String s1 = "xyz"; String s2 = new String("xyz"); if (s1 == s2) System.out.println("Line 4"); if (s1.equals(s2)) System.out.println("Line 6"); } } a. What is the output? Line 4 Line 6 Line 4 Line 6 No output, compile error No output

b. c. d. e. f. Answer: Line 6 MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=106 public class Test{ (4926) public static void main(String[] args){ ----------------------- Page 56----------------------String s1 = "xyz"; String s2 = new String(s1); s2.intern(); if (s1 == s2) System.out.println("Line 4"); if (s1.equals(s2)) System.out.println("Line 6"); } } What is the output? Line 4 Line 6 Line 4 Line 6 d. No output, compile error e. No output f. Answer: Line 6 MARK: 1 CHAPTER: MIX Yes CHOICES: a. b. c. QN=107 public (220) public String s1 = String s2 = class Test{ static void main(String[] args){ "xyz"; new String(s1);

s2=s2.intern(); if (s1 == s2) System.out.println("Line 4"); if (s1.equals(s2)) System.out.println("Line 6"); } } What is the output? (choose 1) Line 4 Line 6 Line 4 Line 6 d. No output, compile error e. No output f. Answer: Line 4 + Line 6 a. b. c. ----------------------- Page 57----------------------MARK: 1 CHAPTER: MIX Yes CHOICES: QN=108 Select correct statement about RMI. (choose 1) (4941) a. allow programmers to develop distributed Java programs with the same syntax and semantics used for non-distributed programs. b. use object serialization to marshal and unmarshal parameters, supporting true object-oriented polymorphism. c. RMI applications are often comprised of two separate programs: a server and a client. d. All the above e. f. Answer: All the above MARK: 1 CHAPTER: MIX No CHOICES: QN=109 Select correct statement(s) about remote class.(choose one) (4943) a. It must extend java.rmi.server.UnicastRemoteObject. b. It must implement the remote interface. c. It is the class whose methods provide services to clients. d. All the others choices e. f. Answer: All the others choices MARK: 1 CHAPTER: MIX Yes CHOICES: QN=110 Select correct statements about remote interface. (choose 1) (4942) a. A remote interface is an interface that describes the remotely accessible methods of a remote object.

b. All remote interfaces must extend java.rmi.Remote. c. All methods in a remote interface must throw java.rmi.RemoteException ----------------------- Page 58----------------------d. The type of a remote reference is a remote interface e. All the others choices f. Answer: All the others choices MARK: 1 CHAPTER: MIX Yes CHOICES: QN=111 Select INCORRECT statement about serialization. (choose 1) (4939) a. The process of writing an object is called serialization. b. To serialize an object, first create an instance of java.io.ObjectOutputStream. c. When an Object Output Stream serializes an object that contains references to another object, every referenced object is not serialized along with the original object. d. When an object is serialized, it will probably be deserialized by a different JVM. e. f. Answer: When an Object Output Stream serializes an object that contains referen ces to another object, every referenced object is not serialized along with the original object. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=112 Select INCORRECT statement about deserialize. (choose 1) (4940) a. Any JVM that tries to deserialize an object must have access to that objects class definition. b. We use readObject() method of ObjectOutputStream class to deserialize. c. The readObject method deserializes the next object in the stream and traverses its references to other objects recursively to deserialize all objec ts that are reachable from it. d. e. f. Answer: We use readObject() method of ObjectOutputStream class to deserialize MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 59----------------------QN=113 Select (4944) a. An RMI server and makes them b. An RMI server incorrect statement about RMI server.(choose 1) is an application that creates one or more remote objects available to clients. performs two tasks:

1. Create an instance of the remote object. 2. Bind the remote object to a name. c. The RMI registry is a program that associates names with RMI services. A server specifies a name for every remote object it provides. d. A client accesses a remote object by specifying only the server name. e. f. Answer: A client accesses a remote object by specifying only the server name. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=114 Select incorrect statement about ServerSocket class. (choose 1) (4938) a. The most useful form of the ServerSocket constructor is public ServerSocket(int portNumber) b. A server socket, on the other hand, makes itself available and then waits for clients to initiate connections. c. To make the new object available for client connections, call its accept() method, which returns an instance of ServerSocket d. There is no way to know how long the accept() call will take. e. f. Answer: To make the new object available for client connections, call its accep t() method, which returns an instance of ServerSocket MARK: 1 CHAPTER: MIX Yes CHOICES: QN=115 Select incorrect statement about Socket class. (choose 1) (4937) a. The java.net.Socket class contains code that knows how to find and communicate with a server through UDP. b. One of its constructors is: public Socket(String servername, int portNumber) ----------------------- Page 60----------------------c. You do not directly read from or write to a socket d. The java.net.Socket class contains code that knows how to find and communicate with a server through TCP. e. f. Answer: The java.net.Socket class contains code that knows how to find and comm unicate with a server through UDP. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=116 Select the correct statement about JDBC two-tier processing model. (7257) a. A user s commands are delivered to the database or other data source, and the results of those statements are sent back to the user. b. Two-tier is referred to as a client/server configuration, with the user s machine as the Server, and the machine housing the data source as the Client. c. User s commands are sent to a "middle tier" of services, which then sends

the commands to the data source. d. e. f. Answer: A user s commands are delivered to the database or other data source, a nd the results of those statements are sent back to the user. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=117 SQL keyword ___ is followed by the selection criteria that specify the

(7265) rows to select in a query a. FROM b. ORDER BY c. HAVING d. WHERE e. f. Answer: WHERE MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 61----------------------QN=118 Statement objects return SQL query results as ___ objects (7262) a. DataSet b. ResultSet c. RecordSet d. RowSet e. f. Answer: ResultSet MARK: 1 CHAPTER: MIX Yes CHOICES: QN=119 Study the statements: (4927) 1)When a JDBC connection is created, it is in auto-commit mode 2)Once auto-commit mode is disabled, no SQL statements will be committed until you call the method commit explicitly a. Only statement 1 is true b. Only statement 2 is true c. Both 1 and 2 are true d. Both 1 and 2 are not true e. f. Answer: Both 1 and 2 are true MARK: 1 CHAPTER: MIX Yes CHOICES: QN=120 ed by a Suppose a method called finallyTest() consists of a try block, follow

(160) catch block, followed by a finally block. Assuming the JVM doesnt crash and the code does not execute a System.exit() call, under what circumstances will the finally block not begin to execute? (Choose one.) a. The try block throws an exception, and the catch block also throws an exception. b. The try block throws an exception that is not handled by the catch block. c. The try block throws an exception, and the catch block calls finallyTest() in a way that causes another exception to be thrown. d. If the JVM doesn t crash and the code does not execute a System.exit() call, the finally block will always execute. e. ----------------------- Page 62----------------------f. Answer: If the JVM doesn t crash and the code does not execute a System.exit() call, the finally block will always execute. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=121 Suppose a source file contains a large number of import statements and one (56) class definition. How do the imports affect the time required to load the class? (Choose one.) a. Class loading takes no additional time. b. Class loading takes slightly more time. c. Class loading takes significantly more time. d. e. f. Answer: Class loading takes no additional time. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=122 Suppose a source file contains a large number of import statements. Ho w (55) do the imports affect the time required to compile the source file? (Choose one.) a. Compilation takes b. Compilation takes c. Compilation takes d. e. f. Answer: Compilation MARK: 1 CHAPTER: MIX Yes CHOICES: QN=123 B. (247) no additional time. slightly more time. significantly more time.

takes slightly more time.

Suppose class A extends Object; Class B extends A; and class C extends Of these, only class C implements java.io.Externalizable. Which of the

following must be true in order to avoid an exception during deserialization of an instance of C? (Choose one.) a. A must have a no-args constructor. ----------------------- Page 63----------------------b. B must have a no-args constructor. c. C must have a no-args constructor. d. There are no restrictions regarding no-args constructors. e. f. Answer: C must have a no-args constructor. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=124 Suppose class A extends Object; class B extends A; and class C extends B. (246) Of these, only class C implements java.io.Serializable. Which of the following must be true in order to avoid an exception during deserialization of an instance of C? (Choose one.) a. A must have a no-args constructor. b. B must have a no-args constructor. c. C must have a no-args constructor. d. There are no restrictions regarding no-args constructors. e. f. Answer: B must have a no-args constructor. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=125 Suppose class A has a method called doSomething(), with default access . (122) Suppose class B extends A and overrides doSomething(). Which access modes may not apply to Bs version of doSomething()? (Choose one) a. public b. private c. protected d. Default e. f. Answer: private MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 64----------------------QN=126 Suppose class Supe, in package packagea, has a method called (117) doSomething(). Suppose class Subby, in package packageb, overrides doSomething(). What access modes may Subbys version of the method have? (Choose two.) a. public b. protected c. Default

d. private e. f. Answer: public + protected MARK: 1 CHAPTER: MIX Yes CHOICES: QN=127 Suppose class X contains the following method: (190) void doSomething(int a, float b) { } Which of the following methods may appear in class Y, which extends X? (Choose one.) public void doSomething(int a, float b) { } private void doSomething(int a, float b) { } public void doSomething(int a, float b) throws java.io.IOException { } private void doSomething(int a, float b) throws java.io.IOException { }

a. b. c. d. e. f. Answer: public void doSomething(int a, float b) { } MARK: 0.5 CHAPTER: MIX Yes CHOICES:

QN=128 Suppose interface Inty defines five methods. Suppose class Classy dec lares (119) that it implements Inty but does not provide implementations for any of th e five interface methods. Which are true? (Choose two.) a. The class will not compile. b. The class will compile if it is declared public. c. The class will compile if it is declared abstract. d. The class may not be instantiated. e. f. ----------------------- Page 65----------------------Answer: The class will compile if it is declared abstract. +The class may not b e instantiated. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=129 Suppose prim is an int and wrapped is an Integer. Which of the followi ng (222) are legal Java statements? (Choose one.) a. prim = wrapped; b. wrapped = prim; c. prim = new Integer(9); d. wrapped = 9; e. All the above f. Answer: All the above MARK: 1 CHAPTER:

MIX No CHOICES: QN=130 are (158) Suppose salaries is an array containing floats. Which of the following valid loop control statements for processing each element of salaries?

(Choose one.) a. for (float f:salaries) b. for (int i:salaries) c. for (float f::salaries) d. for (int i::salaries) e. f. Answer: for (float f:salaries) MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=131 Suppose the declared type of x is a class, and the declared type of y is an (139) interface. When is the assignment x = y; legal? (Choose one.) a. When the type of x is Object b. When the type of x is an array c. Always d. Never e. ----------------------- Page 66----------------------f. Answer: When the type of x is Object MARK: 1 CHAPTER: MIX Yes CHOICES: QN=132 n (140) Suppose the type of xarr is an array of XXX, and the type of yarr is a array of YYY. When is the assignment xarr = yarr; legal? (Choose one.)

a. Sometimes b. Always c. Never d. None of the others choices e. f. Answer: Sometimes MARK: 1 CHAPTER: MIX No CHOICES: QN=133 Suppose x and y are of type TrafficLightState, which is an enum. What is (183) the best way to test whether x and y refer to the same constant? (Choo se one.) a. if (x == y)

b. if (x.equals(y)) c. if (x.toString().equals(y.toString())) d. if (x.hashCode() == y.hashCode()) e. f. Answer: if (x == y) MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=134 Suppose you are writing a class that will provide custom deserializati on. (245) The class implements java.io.Serializable (not java.io.Externalizable) . What access mode should the readObject() method have? (Choose one.) a. public b. protected c. default ----------------------- Page 67----------------------d. private e. f. Answer: private MARK: 1 CHAPTER: MIX Yes CHOICES: QN=135 Suppose you are writing a class that will provide custom serialization . The (243) class implements java.io.Serializable (not java.io.Externalizable). Wh at access mode should the writeObject() method have? (Choose one.) a. public b. protected c. default d. private e. f. Answer: private MARK: 1 CHAPTER: MIX Yes CHOICES: QN=136 Suppose you want to create a custom thread class by extending (211) java.lang.Thread in order to provide some special functionality. Which of the following must you do? (Choose one.) a. Declare that your class implements java.lang.Runnable. b. Override run(). c. Override start(). d. Make sure that all access to all data is via synchronized methods. e. f. Answer: Override run() MARK: 0.5

CHAPTER: MIX Yes CHOICES: QN=137 Suppose you want to write a class that offers static methods to comput e (214) hyperbolic trigonometric functions. You decide to subclass java.lang.M ath and provide the new functionality as a set of static methods. Which one ----------------------- Page 68----------------------statement is true about this strategy? a. The strategy works. b. The strategy works, provided the new methods are public. c. The strategy works, provided the new methods are not private. d. The strategy fails because you cannot subclass java.lang.Math. e. The strategy fails because you cannot add static methods to a subclass. f. Answer: The strategy fails because you cannot subclass java.lang.Math MARK: 1 CHAPTER: MIX Yes CHOICES: QN=138 Swing components cannot be combined with AWT components. (304) a. True b. False c. d. e. f. Answer: True MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=139 The ______ class is the primary class that has the driver information.

(299) a. DriverManager b. Driver c. ODBCDriver d. None of the others e. f. Answer: DriverManager MARK: 1 CHAPTER: MIX No CHOICES: QN=140 a The ______ class is used to implement a pull-down menu that provides

----------------------- Page 69----------------------(307) number of items to select from.

a. MenuBar b. Menu c. MenuItem d. PopUp e. f. Answer: Menu MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=141 The element method alters the contents of a Queue. (1876) a. True b. False c. d. e. Answer: False MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=142 The Swing component classes can be found in the ________________ (303) package. a. javax.swing b. java.swing c. javax.swings d. javax.Swing e. f. Answer: javax.swing MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=143 There are two classes in Java to enable communication using datagrams

----------------------- Page 70----------------------(310) namely. a. DataPacket and DataSocket b. DatagramPacket and DatagramSocket c. DatagramPack and DatagramSock d. e. f. Answer: DataPacket and DataSocket MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=144 This question concerns the following class definition: (115) 1. package abcde; 2.

3. public class Bird { 4. protected static int referenceCount = 0; 5. public Bird() { referenceCount++; } 6. protected void fly() { /* Flap wings, etc. */ } 7. static int getRefCount() { return referenceCount; } 8. } Which statement is true about class Bird and the following class Parrot? (Choose one.) 1. package abcde; 2. 3. class Parrot extends abcde.Bird { 4. public void fly() { 5. /* Parrot-specific flight code. */ 6. } 7. public int getRefCount() { 8. return referenceCount; 9. } 10. } a. Compilation of Parrot.java fails at line 4 because method fly() is protected in the superclass, and classes Bird and Parrot are in the same package. b. Compilation of Parrot.java fails at line 4 because method fly() is protected in the superclass and public in the subclass, and methods may not be overridden to be more public. c. Compilation of Parrot.java fails at line 7 because method getRefCount() is static in the superclass, and static methods may not be overridden to be nonstatic. d. Compilation of Parrot.java succeeds, but a runtime exception is thrown if method fly() is ever called on an instance of class Parrot. e. Compilation of Parrot.java succeeds, but a runtime exception is thrown if ----------------------- Page 71----------------------method getRefCount() is ever called on an instance of class Parrot. f. Answer: Compilation of Parrot.java fails at line 7 because method getRefCount( ) is static in the superclass, and static methods may not be overridden to be no nstatic. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=145 This question concerns the following class definition: (116) 1. package abcde; 2. 3. public class Bird { 4. protected static int referenceCount = 0; 5. public Bird() { referenceCount++; } 6. protected void fly() { /* Flap wings, etc. */ } 7. static int getRefCount() { return referenceCount; } 8. } Which statement is true about class Bird and the following class Nightingale? (Choose one.) 1. package singers; 2. 3. class Nightingale extends abcde.Bird { 4. Nightingale() { referenceCount++; } 5.

a. b. c. d. e.

6. public static void main(String args[]) { 7. System.out.print("Before: " + referenceCount); 8. Nightingale florence = new Nightingale(); 9. System.out.println(" After: " + referenceCount); 10. florence.fly(); 11. } 12. } The program will compile and execute. The output will be Before: 0 After: 2. The program will compile and execute. The output will be Before: 0 After: 1. Compilation of Nightingale will fail at line 4 because static members cannot be overridden. Compilation of Nightingale will fail at line 10 because method fly() is protected in the superclass. Compilation of Nightingale will succeed, but an exception will be thrown at line 10, because method fly() is protected in the superclass.

f. Answer: The program will compile and execute. The output will be Before: 0 Aft er: 2. MARK: 2 CHAPTER: ----------------------- Page 72----------------------MIX Yes CHOICES: QN=146 This question involves IOException, AWTException, and EOFException. (191) They are all checked exception types. IOException and AWTException extend Exception, and EOFException extends OException. Suppose class X contains the following method: void doSomething() throws IOException{ } Which of the following methods may appear in class Y, which extends X? (Choose three.) a. void doSomething() { } b. void doSomething() throws AWTException { } c. void doSomething() throws EOFException { } d. void doSomething() throws IOException, EOFException { } e. f. Answer: void doSomething() { } + void doSomething() throws EOFException { } + vo id doSomething() throws IOException, EOFException { } MARK: 1 CHAPTER: MIX Yes CHOICES: QN=147 URL referring to databases use the form: (4930) a. protocol:subprotocol:datasoursename b. protocol:datasoursename c. jdbc:odbc:datasoursename d. jdbc:datasoursename e. f. Answer: protocol:subprotocol:datasoursename

MARK: 1 CHAPTER: MIX Yes CHOICES: QN=148 What are the legal types for whatsMyType? (Choose one.) (142) short s = 10; ----------------------- Page 73----------------------whatsMyType = !s; a. short b. int c. There are no possible legal types. d. long e. char f. byte Answer: there are no possible legal types. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=149 What does the following code do? (75) Integer i = null; if (i != null & i.intValue() == 5) System.out.println("Value is 5"); a. Prints Value is 5. b. Throws an exception. c. Compile error d. e. f. Answer: Throws an exception. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=150 What does the following code fragment print out at line 9? (Choose on e.) (238) 1. FileOutputStream fos = new FileOutputStream("xx"); 2. for (byte b=10; b<50; b++) 3. fos.write(b); 4. fos.close(); 5. RandomAccessFile raf = new RandomAccessFile("xx", "r"); 6. raf.seek(10); 7. int i = raf.read(); 8. raf.close() 9. System.out.println(i = + i); a. The output is i = 30. b. The output is i = 20. c. The output is i = 10. ----------------------- Page 74----------------------d. There is no output because the code throws an exception at line 1. e. There is no output because the code throws an exception at line 5.

f. Answer: The output is i = 20. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=151 What does the following code print? (126) public class A { static int x; public static void main(String[] args) { A that1 = new A(); A that2 = new A(); that1.x = 5; that2.x = 1000; x = -1; System.out.println(x); } } a. 0 b. 5 c. 1000 d. -1 e. f. Answer: -1 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=152 What happens when you try to compile and run the following applicatio n? (251) (Choose one.) 1. 2. 3. 4. 5. 6. 7. import java.io.*; public class Xxx { public static void main(String[] args) { try { File f = new File("xxx.ser"); FileOutputStream fos = new FileOutputStream(f);

----------------------- Page 75----------------------8. ObjectOutputStream oos = new ObjectOutputStream(fos); 9. oos.writeObject(new Object()); 10. oos.close(); 11. fos.close(); 12. } 13. catch (Exception x) { } 14. } 15. } a. Compiler error at line 9. b. An exception is thrown at line 9. c. An exception is thrown at line 10. d. No compiler error and no exception. e. f.

Answer: An exception is thrown at line 9. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=153 What happens when you try to compile and run the following code? (59) public class Q { static String s; public static void main(String[] args) { System.out.println(">>" + s + "<<"); } } a. The code does not compile b. The code compiles, and prints out >><< c. The code compiles, and prints out >>null<< d. e. f. Answer: The code compiles, and prints out >>null<< MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=154 (230) What happens when you try to compile and run this application? (Choose one.)

1. import java.util.*; 2. ----------------------- Page 76----------------------3. public class Apple { 4. public static void main(String[] a) { 5. Set<Apple> set = new TreeSet<Apple>(); 6. set.add(new Apple()); 7. set.add(new Apple()); 8. set.add(new Apple()); 9. } 10. } Compiler error. An exception is thrown at line 6. An exception is thrown at line 7. An exception is thrown at line 8. No exception is thrown.

a. b. c. d. e. f. Answer: An exception is thrown at line 7. MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=155 What is -50 >> 2 (86) a. A negative number with very large magnitude. b. A positive number with very large magnitude. c. -13 d. -25

e. 13 f. 25 Answer: -13 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=156 (72) a. -3 b. 3 c. -4 d. 4 e. f. Answer: What is 7 % -4?

----------------------- Page 77----------------------MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=157 What is -8 % 5? (71) a. -3 b. 3 c. -2 d. 2 e. f. Answer: -3 MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=158 What is the difference between the rules for method-call conversion an d (146) the rules for assignment conversion? (Choose one.) a. There is no difference; the rules are the same. b. Method-call conversion supports narrowing, assignment conversion does not. c. Assignment conversion supports narrowing, method-call conversion does not. d. Method-call conversion supports narrowing if the method declares that it throws ClassCastException. e. f. Answer: There is no difference; the rules are the same. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=159 What is the minimal modification that will make this code compile (109) correctly? (Choose one.) 1. final class Aaa

2. { 3. int xxx; 4. void yyy() { xxx = 1; } ----------------------- Page 78----------------------5. } 6. 7. 8. class Bbb extends Aaa 9. { 10. final Aaa finalref = new Aaa(); 11. 12. final void yyy() 13. { 14. System.out.println("In method yyy()"); 15. finalref.xxx = 12345; 16. } 17. } a. On line 1, remove the final modifier. b. On line 10, remove the final modifier. c. Remove line 15. d. On lines 1 and 10, remove the final modifier. e. The code will compile as is. No modification is needed. f. Answer: On line 1, remove the final modifier. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=160 What is the range of values that can be assigned to a variable of type byte? (54) (Choose one.) a. Depends on the underlying hardware b. 0 through 2^8 ? 1 c. 0 through 2^16 ? 1 d. ?2^7 through 2^7 ? 1 e. ?2^15 through 2^15 ? 1 f. Answer: ?2^7 through 2^7 ? 1 MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=161 What is the range of values that can be assigned to a variable of type short? (53) (Choose one.) a. Depends on the underlying hardware b. 0 through 2^16 ? 1 ----------------------- Page 79----------------------c. 0 through 2^32 ? 1 d. ?2^15 through 2^15 ? 1 e. ?2^31 through 2^31 ? 1 f. Answer: ?2^15 through 2^15 ? 1 MARK: 0.5

CHAPTER: MIX Yes CHOICES: QN=162 What is the result of attempting to compile and execute the following code (242) fragment? Assume that the code fragment is part of an application that has write permission in the current working directory. Also assume that before execution, the current working directory does not contain a file called datafile. (Choose one.) 1. try { 2. RandomAccessFile raf = new 3. RandomAccessFile("datafile" ,"rw"); 4. BufferedOutputStream bos = new BufferedOutputStream(raf); 5. 6. DataOutputStream dos = new DataOutputStream(bos); 7. 8. dos.writeDouble(Math.PI); 9. dos.close(); 10. bos.close(); 11. raf.close(); 12. } 13. catch (IOException e) { } The code fails to compile. The code compiles but throws an exception at line 4. The code compiles and executes but has no effect on the local file system. The code compiles and executes; afterward, the current working directory contains a file called datafile.

a. b. c. d.

e. f. Answer: The code fails to compile. MARK: 2 CHAPTER: MIX Yes CHOICES: QN=163 (83) What is the return type of the instanceof operator?

----------------------- Page 80----------------------a. A reference b. A class c. An int d. A boolean e. f. Answer: A boolean MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=164 What method of the java.io.File class can create a file on the hard d rive? (249) (Choose one.) a. newFile() b. makeFile()

c. makeNewFile() d. createFile() e. createNewFile() f. Answer: createNewFile() MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=165 What results from attempting to compile and run the following code? (74) 1. public class Conditional { 2. public static void main(String args[]) { 3. int x = 4; 4. System.out.println("value is " + ((x > 4) ? 99.99 : 9)); 5. } 6. } a. The output: value is 99.99 b. The output: value is 9 c. The output: value is 9.0 d. A compiler error at line 4 e. f. Answer: The output: value is 9.0 MARK: 1 CHAPTER: MIX Yes ----------------------- Page 81----------------------CHOICES: QN=166 What results from running the following code? (73) 1. public class Xor { 2. public static void main(String args[]) { 3. byte b = 10; // 00001010 binary 4. byte c = 15; // 00001111 binary 5. b = (byte)(b ^ c); 6. System.out.println("b contains " + b); 7. } 8. } a. The output: b contains 10 b. The output: b contains 5 c. The output: b contains 250 d. The output: b contains 245 e. f. Answer: The output: b contains 5 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=167 What would be the output from this code fragment? (150) 1. int x = 0, y = 4, z = 5; 2. if (x > 2) { 3. if (y < 5) { 4. System.out.println("message one"); 5. }

a. b. c. d.

6. else { 7. System.out.println("message two"); 8. } 9. } 10. else if (z > 5) { 11. System.out.println("message three"); 12. } 13. else { 14. System.out.println("message four"); 15. } message one message two message three message four

----------------------- Page 82----------------------e. f. Answer: message four MARK: 1 CHAPTER: MIX Yes CHOICES: QN=168 When a byte is added to a char, what is the type of the result? (78) a. byte b. char c. int d. short e. You cant add a byte to a char. f. Answer: int MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=169 When a negative byte is cast to a long, what are the possible values of the (144) result? (Choose one.) a. Positive b. Zero c. Negative d. All the above e. f. Answer: Negative MARK: 0.5 CHAPTER: MIX No CHOICES: QN=170 When a negative long is cast to a byte, what are the possible values of the (143) result? (Choose one.) a. Positive b. Zero c. Negative

d. All the above ----------------------- Page 83----------------------e. f. Answer: All the above MARK: 0.5 CHAPTER: MIX No CHOICES: QN=171 When a short is added to a float, what is the type of the result? (79) a. short b. int c. float d. You cant add a short to a float. e. f. Answer: float MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=172 When comparing java.io.BufferedWriter to java.io.FileWriter, which (1531) capability exists as a method in only one of the two? (Choose one.) a. closing the stream b. flushing the stream c. writing to the stream d. marking a location in the stream e. writing a line separator to the stream f. Answer: writing a line separator to the stream MARK: 1 CHAPTER: MIX Yes CHOICES: QN=173 When does an exception s stack trace get recorded in the exception obj ect? (165) (Choose one.) a. When the exception is constructed b. When the exception is thrown c. When the exception is caught d. When the exceptions printStackTrace() method is called ----------------------- Page 84----------------------e. f. Answer: When the exception is constructed MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=174 (163)

When is it appropriate to pass a cause to an exception s constructor? (Choose one.)

a. Always b. When the exception is being exception type c. When the exception is being d. When the exception is being e. f. Answer: When the exception is nt exception type MARK: 1 CHAPTER: MIX Yes CHOICES:

thrown in response to catching of a different thrown from a public method thrown from a private method being thrown in response to catching of a differe

QN=175 When is it appropriate to write code that constructs and throws an err or? (166) (Choose one.) a. When a public methods preconditions are violated b. When a public methods postconditions are violated c. When a nonpublic methods preconditions are violated d. When a nonpublic methods postconditions are violated e. Never f. Answer: Never MARK: 1 CHAPTER: MIX Yes CHOICES: QN=176 When is x & y an int? (Choose one). (141) a. Always b. Sometimes c. When neither x nor y is a float, a long, or a double ----------------------- Page 85----------------------d. None of the others e. f. Answer: Sometimes MARK: 1 CHAPTER: MIX No CHOICES: QN=177 When the user attempts to close the frame window, _______ event in (308) generated. a. window closing b. window resize c. window move d. window close e. window closed f. Answer: window closing MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=178 When the user selects a menu item, _______ event is generated. (312) a. Select event b. Action event c. Item event d. None of the others e. f. Answer: Action event MARK: 1 CHAPTER: MIX No CHOICES: QN=179 When you compile a program written in the Java programming language, (5694) the compiler converts the human-readable source file into platformindependent code that a Java Virtual Machine can understand. What is this platform-independent code called? a. bytecode ----------------------- Page 86----------------------b. binary code c. machine code d. cpu instruction e. f. Answer: bytecode MARK: 1 CHAPTER: MIX Yes CHOICES: QN=180 Whenever a method does not want to handle exceptions using the try (313) block, the ________ is used. a. throws b. throw c. throwable d. nothrows e. f. Answer: throws MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=181 Which are the correct statements used for getting connection object to

(7267) connect to SQL Server database? a. String url ="jdbc:odbc:data_source_name"; Connection con = DriverManager.getConnection (url, user", "password"); b. String url ="odbc:jdbc:data_source_name"; Connection con = DriverManager.getConnection (url, user", "password"); c. String url ="jdbc:data_source_name:odbc"; Connection con = DriverManager.getConnection (url, user", "password"); d. e. f. Answer: String url ="jdbc:odbc:data_source_name"; Connection con = DriverManage

r.getConnection (url, user", "password"); MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 87----------------------QN=182 Which class and static method can you use to convert an array to a Lis t? (1879) (Choose one.) a. Arrays.asList b. Arrays.toList c. Arrays.createList d. Arrays.makeList e. f. Answer: Arrays.asList MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=183 Which is four-step approach to help you organize your GUI thinking. (302) (Choose one.) a. Identify needed components. Isolate regions of behavior. Sketch the GUI. Choose layout managers. b. Choose layout managers. Identify needed components. Isolate regions of behavior. Sketch the GUI. c. Identify needed components. Choose layout managers. Isolate regions of behavior. Sketch the GUI. d. e. f. Answer: Identify needed components. Isolate regions of behavior. Sketch the GUI . Choose layout managers. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=184 Which is the four steps are used in working with JDBC? (4928) a. 1)Connect to the database 2)Create a statement and execute the query 3)Look at the result set 4)Close connection ----------------------- Page 88----------------------b. 1)Load driver 2)Create a statement and execute the query 3)Look at the result set 4)Close connection

c. 1)Create a statement and execute the query 2)Load driver 3)Look at the result set 4)Close connection d. 1)Create a statement and execute the query 2)Create the connection 3)Look at the result set 4)Close connection e. f. Answer: 1)Connect to the database 2)Create a statement and execute the query 3 )Look at the result set 4)Close connection MARK: 1 CHAPTER: MIX Yes CHOICES: QN=185 Which JDBC processing model that requires a JDBC driver that can (7256) communicate with the particular data source being accessed? a. two-tier b. three-tier c. one-tier d. four-tier e. f. Answer: two-tier MARK: 1 CHAPTER: MIX Yes CHOICES: QN=186 Which line of code tells a scanner called sc to use a single digit as a (229) delimiter? (Choose one.) a. sc.useDelimiter("d"); b. sc.useDelimiter("\d"); c. sc.useDelimiter("\\d"); d. sc.useDelimiter("d+"); e. sc.useDelimiter("\d+"); f. sc.useDelimiter("\\d+"); Answer: sc.useDelimiter("\\d"); ----------------------- Page 89----------------------MARK: 1 CHAPTER: MIX Yes CHOICES: QN=187 (1411) a. class b. class c. class d. class e. class f. class Answer: MARK: 1 Which Man class properly represents the relationship "Man has the best friend who is a Dog"? (Choose one.) Man extends Dog { } Man implements Dog { } Man { private BestFriend dog; } Man { private Dog bestFriend; } Man { private Dog<bestFriend> } Man { private BestFriend<dog> } class Man { private Dog bestFriend; }

CHAPTER: MIX Yes CHOICES: QN=188 Which methods return an enum constants name? (Choose two.) (189) a. getName() b. name() c. toString() d. nameString() e. getNameString() f. Answer: name() + toString() MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=189 Which modifier or modifiers should be used to denote a variable that (114) should not be written out as part of its class s persistent state? (Ch oose the shortest possible Answer.) a. private b. protected c. private protected d. trAnsweri ent e. volatile f. ----------------------- Page 90----------------------Answer: trAnswerient MARK: 1 CHAPTER: MIX Yes CHOICES: QN=190 Which of the following are legal argument types for a switch statement?

(162) (Choose three.) a. byte b. int c. long d. float e. char f. String Answer: byte + int + char MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=191 Which of the following are legal enums? (Choose three.) (177) a. enum Animals { LION, TIGER, BEAR } b. enum Animals { int age; LION, TIGER, BEAR; }

c.

enum Animals { LION, TIGER, BEAR; int weight; } d. enum Animals { LION(450), TIGER(450), BEAR; int weight; Animals(int w) { weight = w; } } e. enum Animals { LION(450), TIGER(450), BEAR; int weight; Animals() { } Animals(int w) { weight = w; ----------------------- Page 91----------------------} } f. Answer: enum Animals { LION, TIGER, BEAR } + enum Animals { LION, TIGER, BEAR; int weight; } + enum Animals { LION(450), TIGER(450), BEAR; int weight; Animal s() { } Animals(int w) { weight = w; MARK: 1 CHAPTER: MIX Yes CHOICES: QN=192 Which of the following are legal import statements? (Choose two.) (57) a. import java.util.Vector; b. static import java.util.Vector.*; c. import static java.util.Vector.*; d. import java.util.Vector static; e. f. Answer: import java.util.Vector; + import static java.util.Vector.*; MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=193 Which of the following are legal loop constructions? (Choose one.) (149) a. while (int i<7) { i++; System.out.println("i is " + i); } b. int i = 3; while (i) { System.out.println("i is " + i); } c. int j = 0; for (int k=0, j+k != 10; j++,k++) { System.out.println("j=" + j + ", k=" + k); } d. int j=0;

do { System.out.println("j=" + j++); if (j==3) continue loop; } while (j<10); e. ----------------------- Page 92----------------------f. Answer: int j = 0; for (int k=0, j+k != 10; j++,k++) { System.out.println("j=" + j + ", k=" + k); } MARK: 1 CHAPTER: MIX Yes CHOICES: QN=194 Which of the following are legal loop definitions? (Choose one.) (161) a. while (int a = 0) { /* whatever */ } b. while (int a == 0) { /* whatever */ } c. do { /* whatever */ } while (int a = 0) d. do { /* whatever */ } while (int a == 0) e. for (int a==0; a<100; a++) { /* whatever */ } f. None of the above. Answer: None of the above. MARK: 1 CHAPTER: MIX No CHOICES: QN=195 Which of the following are legal? (Choose three.) (159) a. for (int i=0, j=1; i<10; i++, j++) b. for (int i=0, j=1;; i++, j++) c. for (int i=0, float j=1; ; i++, j++) d. for (String s = ""; s.length()<10; s += ! ) e. while(1) f. Answer: for (int i=0, j=1; i<10; i++, j++) + for (int i=0, j=1;; i++, j++) + fo r (String s = ""; s.length()<10; s += ! ) MARK: 1 CHAPTER: MIX Yes CHOICES: QN=196 (62) a. double b. double c. double d. double e. Which of the following are legal? (Choose two.) d d d d = = = = 1.2d; 1.2D; 1.2d5; 1.2D5;

----------------------- Page 93----------------------f. Answer: double d = 1.2d; + double d = 1.2D; MARK: 0.5 CHAPTER: MIX Yes

CHOICES: QN=197 Which of the following are legal? (Choose two.) (61) a. int a = abcd; b. int b = ABCD; c. int c = 0xabcd; d. int d = 0XABCD; e. int f = 0ABCD; f. Answer: int c = 0xabcd; + int d = 0XABCD; MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=198 Which of the following are legal? (Choose two.) (63) a. char c = 0x1234; b. char c = \u1234; c. char c = \u1234 ; d. e. f. Answer: char c = 0x1234; + char c = \u1234 ; MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=199 Which of the following are legal? (Choose two.) (223) a. List<String> theList = new Vector<String>; b. List<String> theList = new Vector<String>(); c. Vector <String> theVec = new Vector<String>; d. Vector <String> theVec = new Vector<String>(); e. ----------------------- Page 94----------------------f. Answer: List<String> theList = new Vector<String>(); + Vector <String> theVec = new Vector<String>(); MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=200 Which of the following are methods of the java.util.SortedMap interfac e? (228) (Choose three.) a. first b. last c. headMap d. tailMap e. subMap f. Answer: headMap + tailMap + subMap MARK: 1 CHAPTER:

MIX Yes CHOICES: QN=201 Which of the following are methods of the java.util.SortedSet interfac e? (227) (Choose one.) a. first b. last c. headSet d. tailSet e. subSet f. All the above Answer: All the above MARK: 1 CHAPTER: MIX No CHOICES: QN=202 Which of the following are true? (Choose one.) (250) a. System.out has a println() method. b. System.out has a format() method. c. System.err has a println() method. d. System.err has a format () method. e. All the above ----------------------- Page 95----------------------f. Answer: All the above MARK: 0.5 CHAPTER: MIX No CHOICES: QN=203 Which of the following are true? (Choose one.) (207) a. The JVM runs until there is only one daemon thread. b. The JVM runs until there are no daemon threads. c. The JVM runs until there is only one non-daemon thread. d. The JVM runs until there are no non-daemon threads. e. f. Answer: The JVM runs until there are no non-daemon threads. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=204 Which of the following are true? (Choose three.) (206) a. When an application begins running, there is one daemon thread, whose job is to execute main(). b. When an application begins running, there is one non-daemon thread, whose job is to execute main(). c. A thread created by a daemon thread is initially also a daemon thread. d. A thread created by a non-daemon thread is initially also a non-daemon thread. e. f.

Answer: When an application begins running, there is one non-daemon thread, who se job is to execute main(). + A thread created by a daemon thread is initially also a daemon thread. + A thread created by a non-daemon thread is initially als o a non-daemon thread. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=205 Which of the following are true? (Choose two.) (210) a. When you declare a method to be synchronized, the method always synchronizes on the lock of the current object. ----------------------- Page 96----------------------b. When you declare a method to be synchronized, you can specify the object on whose lock the method should synchronize. c. When you declare a block of code inside a method to be synchronized, the block always synchronizes on the lock of the current object. d. When you declare a block of code inside a method to be synchronized, you can specify the object on whose lock the block should synchronize. e. f. Answer: When you declare a method to be synchronized, the method always synchro nizes on the lock of the current object. + When you declare a block of code insi de a method to be synchronized, you can specify the object on whose lock the blo ck should synchronize. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=206 Which of the following are true? (Choose two.) (185) a. An enum definition should declare that it extends java.lang.Enum. b. An enum may be subclassed. c. An enum may contain public method definitions. d. An enum may contain private data. e. f. Answer: An enum may contain public method definitions. + An enum may contain pr ivate data. MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=207 Which of the following are true? (Choose two.) (65) a. Primitives are passed by reference. b. Primitives are passed by value. c. References are passed by reference. d. References are passed by value. e. f. Answer: Primitives are passed by value. + References are passed by value. MARK: 0.5 CHAPTER: MIX Yes

CHOICES: ----------------------- Page 97----------------------QN=208 Which of the following are true? (Choose two.) (188) a. An anonymous inner class may implement at most one interface. b. An anonymous inner class may implement arbitrarily many interfaces. c. An anonymous inner class may extend a parent class other than Object. d. An anonymous inner class that implements one interface may extend a parent class other than Object. e. An anonymous inner class that implements several interfaces may extend a parent class other than Object. f. Answer: An anonymous inner class may implement at most one interface. + An anon ymous inner class may extend a parent class other than Object. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=209 Which of the following are valid arguments to the DataInputStream (253) constructor? (Choose one.) a. File b. FileReader c. FileInputStream d. RandomAccessFile e. f. Answer: FileInputStream MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=210 Which of the following are valid mode strings for the RandomAccessFile

(252) constructor? (Choose one.) a. "r" b. "rw" c. "rws" d. "rwd" e. All the above f. Answer: All the above MARK: 1 CHAPTER: MIX No CHOICES: ----------------------- Page 98----------------------QN=211 Which of the following calls may be made from a non-static synchronize d (203) method? (Choose one.) a. A call to the same method of the current object. b. A call to the same method of a different instance of the current class. c. A call to a different synchronized method of the current object. d. A call to a static synchronized method of the current class. e. All the above

f. Answer: All the above MARK: 1 CHAPTER: MIX No CHOICES: QN=212 Which of the following classes implement java.util.List? (Choose two.)

(226) a. java.util.ArrayList b. java.util.HashMap c. java.util.TreeSet d. java.util.Stack e. f. Answer: java.util.ArrayList + java.util.Stack MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=213 Which of the following classes implements a FIFO Queue? (Choose one.)

(1878) a. HashSet b. LinkedList c. PriorityQueue d. CopyOnWriteArraySet e. f. Answer: LinkedList MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 99----------------------QN=214 Which of the following declarations are illegal? (Choose three.) (107) a. default String s; b. trAnswerient int i = 41; c. public final static native int w(); d. abstract double d; e. abstract final double hyperbolicCosine(); f. Answer: default String s; + abstract double d; + abstract final double hyperbo licCosine(); MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=215 Which of the following expressions are legal? (Choose two.) (68) a. int x = 6; x = !x; b. int x = 6; if (!(x > 3)) {} c. int x = 6; x = ~x; d.

e. f. Answer: int x = 6; if (!(x > 3)) {} + int x = 6; x = ~x; MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=216 Which of the following expressions are legal? (Choose two.) (70) a. String x = "Hello"; int y = 9; x += y; b. String x = "Hello"; int y = 9; if (x == y) {} c. String x = "Hello"; int y = 9; x = x + y; d. String x = "Hello"; int y = 9; y = y + x; e. f. Answer: String x = "Hello"; int y = 9; x += y; + String x = "Hello"; int y = 9 ; x = x + y; MARK: 0.5 CHAPTER: MIX Yes CHOICES: ----------------------- Page 100----------------------QN=217 Which of the following expressions results in a positive value in x? (69) (Choose one.) a. int x = 1; x = x >>> 5; b. int x = 1; x = x >>> 32; c. byte x = 1; x = x >>> 5; d. int x = 1; x = x >> 5; e. f. Answer: int x = 1; x = x >>> 5; MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=218 Which of the following interfaces does not allow duplicate objects? (1874) (Choose one.) a. Queue b. Set c. List d. e. f. Answer: Set MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=219 Which of the following is not appropriate situations for assertions? (155) (Choose one) a. Preconditions of a public method b. Postconditions of a public method c. Preconditions of a private method d. Postconditions of a private method e.

f. Answer: Preconditions of a public method MARK: 1 CHAPTER: MIX Yes CHOICES: ----------------------- Page 101----------------------QN=220 Which of the following is NOTa valid comment: (5695) a. /** comment */ b. /* comment */ c. /* comment d. // comment e. f. Answer: /* comment MARK: 1 CHAPTER: MIX Yes CHOICES: QN=221 Which of the following is the most appropriate way to handle invalid (157) arguments in a public method? a. Throw java.lang.InvalidArgumentException. b. Throw java.lang.IllegalArgumentException. c. Check for argument validity in an assert statement, which throws AssertionError when the arguments are invalid. d. Use non-assert code to check for argument validity. If invalid arguments are detected, explicitly throw AssertionError. e. f. Answer: Throw java.lang.IllegalArgumentException. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=222 Which of the following (240) a. Readers have methods that can b. Readers have methods that can c. Readers have methods that can d. Readers have methods that can e. None of the above f. Answer: None of the above MARK: 1 CHAPTER: is true? (Choose one.) read read read read and and and and return return return return floats and doubles. floats. doubles. ints.

----------------------- Page 102----------------------MIX No CHOICES: QN=223 Which of the following is(are) true? (Choose one.) (184) a. An enum definition may contain the main() method of an application. b. You can call an enums toString() method.

c. You can call an enums wait() method. d. You can call an enums notify() method. e. All the above f. Answer: All the above MARK: 1 CHAPTER: MIX No CHOICES: QN=224 Which of the following may appear on the left-hand side of an instance of (84) operator? a. A reference b. A class c. An interface d. A variable of primitive type e. f. Answer: A reference MARK: 1 CHAPTER: MIX Yes CHOICES: QN=225 Which of the following may appear on the right-hand side of an instanc eof (85) operator? (Choose two.) a. A reference b. A class c. An interface d. A variable of primitive type e. The name of a primitive type f. Answer: A class + An interface MARK: 1 CHAPTER: ----------------------- Page 103----------------------MIX Yes CHOICES: QN=226 Which of the following may be declared final? (Choose two.) (120) a. Classes b. Interfaces c. Methods d. e. f. Answer: Classes + Methods MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=227 Which of the following may be statically imported? (Choose two.) (58) a. Package names

b. Static method names c. Static field names d. Method-local variable names e. f. Answer: Static method names + Static field names MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=228 Which of the following may follow the static keyword? (Choose three.) (121) a. Class definitions b. Data c. Methods d. Code blocks enclosed in curly brackets e. Variables f. Answer: Data + Methods + Code blocks enclosed in curly brackets MARK: 0.5 CHAPTER: ----------------------- Page 104----------------------MIX Yes CHOICES: QN=229 Which of the following may legally appear as the new type (between the

(137) parentheses) in a cast operation? (Choose one.) a. Classes b. Interfaces c. Arrays of classes d. Arrays of interfaces e. All of the others f. Answer: All of the others MARK: 1 CHAPTER: MIX No CHOICES: QN=230 Which of the following may legally appear as the new type (between the

(138) parentheses) in a cast operation? (Choose one.) a. Abstract classes b. Final classes c. Primitives d. All of the above e. f. Answer: All of the above MARK: 1 CHAPTER: MIX No CHOICES: QN=231 (202) Which of the following may not be synchronized? (Choose one.)

a. Blocks within methods b. Static methods c. Blocks within static methods d. Classes e. f. Answer: Classes MARK: 1 CHAPTER: ----------------------- Page 105----------------------MIX Yes CHOICES: QN=232 Which of the following may override a method whose signature is void (186) xyz(float f)? (Choose two.) a. void xyz(float f) b. public void xyz(float f) c. private void xyz(float f) d. public int xyz(float f) e. private int xyz(float f) f. Answer: void xyz(float f) + public void xyz(float f) MARK: 1 CHAPTER: MIX Yes CHOICES: QN=233 Which of the following methods in the Thread class are deprecated? (199) (Choose one.) a. suspend() and resume() b. wait() and notify() c. start() and stop() d. sleep() and yield() e. f. Answer: suspend() and resume() MARK: 1 CHAPTER: MIX Yes CHOICES: QN=234 Which of the following operations might throw an ArithmeticException? (81) (Choose one.) a. >> b. >>> c. << d. None of these e. f. Answer: None of these MARK: 0.5 CHAPTER: ----------------------- Page 106----------------------MIX Yes CHOICES:

QN=235

Which of the following operations might throw an ArithmeticException?

(82) (Choose one.) a. + b. c. * d. / e. None of the others f. Answer: / MARK: 0.5 CHAPTER: MIX No CHOICES: QN=236 Which of the following operators can perform promotion on their (145) operands? (Choose three.) a. + b. c. ++ d. - e. ~ f. ! Answer: {+} {-} {~} MARK: 1 CHAPTER: MIX Yes CHOICES: QN=237 Which of the following restrictions apply to anonymous inner classes?

(182) (Choose one.) a. They must be defined inside a code block. b. They may only read and write final variables of the enclosing class. c. They may only call final methods of the enclosing class. d. They may not call the enclosing class synchronized methods. e. f. Answer: They must be defined inside a code block. MARK: 1 CHAPTER: ----------------------- Page 107----------------------MIX Yes CHOICES: QN=238 Which of the following should always be caught? (Choose one.) (164) a. Runtime exceptions b. Checked exceptions c. Assertion errors d. Errors other than assertion errors e. f. Answer: Checked exceptions MARK: 0.5 CHAPTER: MIX Yes CHOICES:

QN=239 Which of the following signatures are valid for the main() method entr y (47) point of an application? (Choose two.) a. public static void main() b. public static void main(String arg[]) c. public void main(String [] arg) d. public static void main(String[] args) e. public static int main(String [] arg) f. Answer: public static void main(String arg[]) +public static void main(String[] args) MARK: 0.5 CHAPTER: MIX Yes CHOICES: QN=240 Which of the following statements about the wait() and notify() method s is (201) true? (Choose one.) a. The wait() and notify() methods can be called outside synchronized code. b. The programmer can specify which thread should be notified in a notify() method call. c. The thread that calls wait() goes into the monitors pool of waiting threads. d. The thread that calls notify() gives up the lock. e. f. Answer: The thread that calls wait() goes into the monitors pool of waiting thre ads. MARK: 1 ----------------------- Page 108----------------------CHAPTER: MIX Yes CHOICES: QN=241 Which of the following statements about threads is true? (Choose one.)

(200) a. Every thread starts executing with a priority of 5. b. Threads inherit their priority from their parent thread. c. Threads are guaranteed to run with the priority that you set using the setPriority() method. d. Thread priority is an integer ranging from 1 to 100. e. f. Answer: Threads inherit their priority from their parent thread. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=242 Which of the following statements are true? (Choose one.) (125) a. A final class must be instantiated. b. A final class may only contain final methods. c. A final class may not contain non-final data fields. d. A final class may not be extended. e.

f. Answer: A final class may not be extended. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=243 Which of the following statements are true? (Choose one.) (176) a. Given that Inner is a nonstatic class declared inside a public class Outer and that appropriate constructor forms are defined, an instance of Inner can be constructed like this: new Outer().new Inner() b. If an anonymous inner class inside the class Outer is defined to implement the interface ActionListener, it can be constructed like this: new Outer().new ActionListener() c. Given that Inner is a nonstatic class declared inside a public class Outer ----------------------- Page 109----------------------and that appropriate constructor forms are defined, an instance of Inner can be constructed in a static method like this: new Inner() d. An anonymous class instance that implements the interface MyInterface can be constructed and returned from a method like this: 1. return new MyInterface(int x) { 2. int x; 3. public MyInterface(int x) { 4. this.x = x; 5. } 6. }; e. f. Answer: Given that Inner is a nonstatic class declared inside a public class O uter and that appropriate constructor forms are defined, an instance of Inner ca n be constructed like this: new Outer().new Inner() MARK: 1 CHAPTER: MIX Yes CHOICES: QN=244 Which of the following statements are true? (Choose one.) (118) a. An abstract class may be instantiated. b. An abstract class must contain at least one abstract method. c. An abstract class must contain at least one abstract data field. d. An abstract class must be overridden. e. An abstract class must declare that it implements an interface. f. None of the above Answer: None of the above MARK: 1 CHAPTER: MIX No CHOICES: QN=245 Which of the following statements are true? (Choose two.) (232) a. StringBuilder is generally faster than StringBuffer. b. StringBuffer is generally faster than StringBuilder. c. StringBuilder is threadsafe; StringBuffer is not. d. StringBuffer is threadsafe; StringBuilder is not.

e. f. Answer: StringBuilder is generally faster than StringBuffer. + StringBuffer i s threadsafe; StringBuilder is not. MARK: 1 ----------------------- Page 110----------------------CHAPTER: MIX Yes CHOICES: QN=246 Which of the following statements are true? (108) 1)An abstract class may not have any final methods. 2)A final class may not have any abstract methods. a. Only statement 1 b. Only statement 2 c. Both statement 1 and 2 d. e. f. Answer: Only statement 2 MARK: 1 CHAPTER: MIX No CHOICES: QN=247 Which of the following statements is correct? (Choose one.) (127) a. Only primitives are converted automatically; to change the type of an object reference, you have to do a cast. b. Only object references are converted automatically; to change the type of a primitive, you have to do a cast. c. Arithmetic promotion of object references requires explicit casting. d. Both primitives and object references can be both converted and cast. e. Casting of numeric types may require a runtime check. f. Answer: Both primitives and object references can be both converted and cast. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=248 Which (110) a. TrAnswerient b. TrAnswerient c. TrAnswerient d. TrAnswerient e. TrAnswerient of the following statements is true? (Choose one.) methods may not be overridden. methods must be overridden. classes may not be serialized. variables must be static. variables are not serialized.

----------------------- Page 111----------------------f. Answer: TrAnswerient variables are not serialized. MARK: 1 CHAPTER: MIX Yes CHOICES:

QN=249 Which of the following statements is true? (Choose one.) (132) a. Object references can be converted in assignments but not in method calls. b. Object references can be converted in method calls but not in assignments. c. Object references can be converted in both method calls and assignments, but the rules governing these conversions are very different. d. Object references can be converted in both method calls and assignments, and the rules governing these conversions are identical. e. Object references can never be converted. f. Answer: Object references can be converted in both method calls and assignments , and the rules governing these conversions are identical. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=250 Which of the statements below are true? (Choose one.) (233) a. UTF characters are all 8 bits. b. UTF characters are all 16 bits. c. UTF characters are all 24 bits. d. Unicode characters are all 16 bits. e. Bytecode characters are all 16 bits. f. Answer: Unicode characters are all 16 bits. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=251 Which of the statements below are true? (Choose one.) (235) a. To change the current working directory, call the setWorkingDirectory() method of the File class. b. To change the current working directory, call the cd() method of the File ----------------------- Page 112----------------------class. c. To change the current working directory, call the changeWorkingDirectory() method of the File class. d. None of the above e. f. Answer: None of the above MARK: 1 CHAPTER: MIX No CHOICES: QN=252 Which of the statements below are true? (Choose one.) (234) a. When you construct an instance of File, if you do not use the file-naming semantics of the local machine, the constructor will throw an IOException. b. When you construct an instance of File, if the corresponding file does not exist on the local file system, one will be created. c. When an instance of File is garbage collected, the corresponding file on the local file system is deleted.

d. None of the above. e. f. Answer: None of the above. MARK: 1 CHAPTER: MIX No CHOICES: QN=253 Which one line in the following code will not compile? (128) 1. byte b = 5; 2. char c = 5; 3. short s = 55; 4. int i = 555; 5. float f = 555.5f; 6. b = s; 7. i = c; 8. if (f > b) 9. f = i; a. Line 5 b. Line 2 c. Line 3 d. Line 7 ----------------------- Page 113----------------------e. Line 9 f. Line 6 Answer: Line 6 MARK: 1 CHAPTER: MIX Yes CHOICES: QN=254 Which one statement is always true about the following application? (193) 1. class HiPri extends Thread { 2. HiPri() { 3. setPriority(10); 4. } 5. 6. public void run() { 7. System.out.println( 8. "Another thread starting up."); 9. while (true) { } 10. } 11. 12. public static void main(String args[]) { 13. HiPri hp1 = new HiPri(); 14. HiPri hp2 = new HiPri(); 15. HiPri hp3 = new HiPri(); 16. hp1.start(); 17. hp2.start(); 18. hp3.start(); 19. } 20. } a. When the application is run, thread hp1 will execute; threads hp2 and hp3 will never get the CPU. b. When the application is run, thread hp1 will execute to completion, thread hp2 will execute to completion, then thread hp3 will execute to completion.

c. When the application is run, all three threads (hp1, hp2, and hp3) will execute concurrently, taking time-sliced turns in the CPU. d. None of the above scenarios can be guaranteed to happen in all cases. e. f. Answer: one of the above scenarios can be guaranteed to happen in all cases. MARK: 1 CHAPTER: MIX No CHOICES: ----------------------- Page 114----------------------QN=255 Which one statement is true about the following code fragment? (choose 1) (215) 1. import java.lang.Math; 2. Math myMath = new Math(); 3. System.out.println("cosine of 0.123 = " + myMath.cos(0.123)); a. Compilation fails at line 2. b. Compilation fails at line 3 c. Compilation succeeds, although the import on line 1 is not necessary. During execution, an exception is thrown at line 3 d. Compilation succeeds. The import on line 1 is necessary. During execution, an exception is thrown at line 3 e. Compilation succeeds and no exception is thrown during execution. f. Answer: Compilation fails at line 2. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=256 Which one statement is true about the following code fragment? (216) 1. String s = "FPT"; 2. StringBuffer s1 = new StringBuffer("FPT"); 3. if (s.equals(s1)) 4. s1 = null; 5. if (s1.equals(s)) 6. s = null; a. Compilation fails at line 1 because the String constructor must be called explicitly. b. Compilation fails at line 3 because s and s1 have different types. c. Compilation succeeds. During execution, an exception is thrown at line 3. d. Compilation succeeds. During execution, an exception is thrown at line 5. e. Compilation succeeds. No exception is thrown during execution. f. Answer: Compilation succeeds. No exception is thrown during execution. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=257 Which one statement is true about the following code? (213) 1. String s1 = "abc" + "def"; ----------------------- Page 115-----------------------

a. b. c. d. e. f. Answer: Line 6 executes and line 4 does not. MARK: 1 CHAPTER: MIX Yes CHOICES:

2. String s2 = new String(s1); 3. if (s1 == s2) 4. System.out.println("== succeeded"); 5. if (s1.equals(s2)) 6. System.out.println(".equals() succeeded"); Lines 4 and 6 both execute. Line 4 executes and line 6 does not. Line 6 executes and line 4 does not. Neither line 4 nor line 6 executes.

QN=258 Which one statement is true concerning the following code? (192) 1. class Greebo extends java.util.Vector implements Runnable { 2. 3. public void run(String message) { 4. System.out.println("in run() method: " + message); 5. 6. } 7. } 8. 9. class GreeboTest { 10. public static void main(String args[]) { 12. Greebo g = new Greebo(); 13. Thread t = new Thread(g); 14. t.start(); 15. } 16. } a. There will be a compiler error, because class Greebo does not correctly implement the Runnable interface. b. There will be a compiler error at line 13, because you cannot pass a parameter to the constructor of a Thread. c. The code will compile correctly but will crash with an exception at line 13. d. The code will compile correctly but will crash with an exception at line 14. e. The code will compile correctly and will execute without throwing any exceptions. f. Answer: There will be a compiler error, because class Greebo does not correctl y implement the Runnable interface MARK: 2 ----------------------- Page 116----------------------CHAPTER: MIX Yes CHOICES: QN=259 Which statement is true about the following code fragment? (Choose on e.) (151) 1. int j = 2; 2. switch (j) {

a. b. c. d. e.

3. case 2: 4. System.out.println("value is two"); 5. case 2 + 1: 6. System.out.println("value is three"); 7. break; 8. default: 9. System.out.println("value is " + j); 10. break; 11. } The code is illegal because of the expression at line 5. The acceptable types for the variable j, as the argument to the switch() construct, could be any of byte, short, int, or long. The output would be the text value is two. The output would be the text value is two followed by the text value is three. The output would be the text value is two, followed by the text value is three, followed by the text value is 2.

f. Answer: The output would be the text value is two followed by the text value i s three. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=260 Which statement is true about the following method? (80) int selfXor(int i) { return i ^ i; } a. It always returns 0. b. It always returns 1. c. It always an int where every bit is 1. d. The returned value varies depending on the argument. e. f. Answer: It always returns 0. MARK: 1 ----------------------- Page 117----------------------CHAPTER: MIX Yes CHOICES: QN=261 Which statement is true about this application? (Choose one.) (111) 1. class StaticStuff 2 { 3. static int x = 10; 4. 5. static { x += 5; } 6. 7. public static void main(String args[]) 8. { 9. System.out.println("x = " + x); 10. } 11. 12. static {x /= 5; } 13. } a. Lines 5 and 12 will not compile because the method names and return types are missing.

b. Line 12 will not compile because you can only have one static initializer. c. The code compiles and execution produces the output x = 10. d. The code compiles and execution produces the output x = 15. e. The code compiles and execution produces the output x = 3. f. Answer: The code compiles and execution produces the output x = 3. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=262 Which statement is true about this code? (Choose one.) (112) 1. class HasStatic 2. { 3. private static int x = 100; 4. 5. public static void main(String args[]) 6. { 7. HasStatic hs1 = new HasStatic(); 8. hs1.x++; 9. HasStatic hs2 = new HasStatic(); 10. hs2.x++; 11. hs1 = new HasStatic(); 12. hs1.x++; ----------------------- Page 118----------------------13. HasStatic.x++; 14. System.out.println("x = " + x); 15. } 16. } a. Line 8 will not compile because it is a static reference to a private variabl e. b. Line 13 will not compile because it is a static reference to a private variable. c. The program compiles and the output is x = 102. d. The program compiles and the output is x = 103. e. The program compiles and the output is x = 104. f. Answer: The program compiles and the output is x = 104. CHAPTER: MIX Yes CHOICES: QN=263 Which statements about JDBC are NOT true? (choose 2) (4929) a. JDBC is a Java API for executing SQL statements. b. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure Java API. c. It consists of a set of classes and interfaces written in the Java programming language. d. The combination of Java and JDBC lets a programmer write it once and run it anywhere. e. JDBC is a Java database system. f. JDBC is a Java API for connecting to any kind of DBMS Answer: JDBC is a Java database system. + JDBC is a Java API for connecting to any kind of DBMS CHAPTER: MIX Yes CHOICES:

QN=264 Which two code fragments correctly create and initialize a static arra y of (1423) int elements? (Choose two.) a. static final int[] a = { 100,200 }; b. static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; } c. static final int[] a = new int[2] { 100,200 }; d. static final int[] a; static void init() {a=new int[3];a[0]=100; a[1]=200;} e. f. Answer: static final int[] a = { 100,200 }; + static final int[] a; static { a= new int[2]; a[0]=100; a[1]=200; } ----------------------- Page 119----------------------MARK: 1 CHAPTER: MIX Yes CHOICES: QN=265 Which two of the following interfaces are at the top of the hierarchie s in (1873) the Java Collections Framework? (Choose two.) a. Set b. Map c. Queue d. SortedMap e. Collection f. List Answer: Map + Collection MARK: 1 CHAPTER: MIX Yes CHOICES: QN=266 lt? (241) You execute the following code in an empty directory. What is the resu (Choose one.)

1. File f1 = new File("dirname"); 2. File f2 = new File(f1, "filename"); a. A new directory called dirname is created in the current working directory. b. A new directory called dirname is created in the current working directory. A new file called filename is created in directory dirname. c. A new directory called dirname and a new file called filename are created, both in the current working directory. d. A new file called filename is created in the current working directory. e. No directory is created, and no file is created. f. Answer: No directory is created, and no file is created. MARK: 1 CHAPTER: MIX Yes CHOICES: QN=267 You have been given a design document (171) system for implementation in Java. It "A pet has an owner, a registration date, and is a pet that has a flag indicating if it has for a veterinary registration states: a vaccination-due date. A cat been neutered, and a textual

----------------------- Page 120----------------------description of its markings." Given that the Pet class has already been defined and you expect the Cat class to be used freely throughout the application, how would you make the opening declaration of the Cat class, up to but not including the first opening brace? Use only these words and spaces: boolean, Cat, class, Date, extends, Object, Owner, Pet, private, protected, public, String. (Choose one.) a. protected class Cat extends Owner b. public class Cat extends Object c. public class Cat extends Pet d. private class Cat extends Pet e. f. Answer: public class Cat extends Pet MARK: 2 CHAPTER: MIX Yes CHOICES: QN=268 You have been given a design document for a veterinary registration (170) system for implementation in Java. It states: "A pet has an owner, a registration date, and a vaccination-due date. A cat is a pet that has a flag indicating whether it has been neutered, and a textua l description of its markings." Given that the Pet class has already been defined, which of the following fields would be appropriate for inclusion in the Cat class as members? (Choose two.) a. Pet thePet; b. Date registered; c. Date vaccinationDue; d. Cat theCat; e. boolean neutered; f. String markings; Answer: boolean neutered; + String markings; MARK: 2 CHAPTER: MIX Yes CHOICES: ================================================================================ =========== Assessment Test 1. Which of the following are valid declarations? Assume java.util.* is imported. A. Vector<Map> v; B. Set<String> s; C. Map<String> m; D. Map<String, String> m; Answer: Vector<Map> v;B.Set<String> s;D.Map<String, String> m 2.

You can determine all the keys in a Map in which of the following ways? A.By getting a Set object from the Map and iterating through it. B.By iterating through the Iterator of the Map. C.By enumerating through the Enumeration of the Map. D.By getting a List from the Map and enumerating through the List. E. You cannot determine the keys in a Map. Answer:A.By getting a Set object from the Map and iterating through it. 3. What keyword is used to prevent an object from being serialized? A. private B. volatile C. protected D. transient E. None of the above Answer:D.transient 4. An abstract class can contain methods with declared bodies. A. True B. False Answer:A True 5. Select the order of access modifiers from least restrictive to most restrictive. A. public , private , protected , default B. default, protected , private , public C. public , default, protected , private D. default, public , protected , private

E. public , protected , default, private Answer:E public,protected, default,private 6. Which access modifier allows you to access method calls in libraries not created in Java? A. public B. static C. native D. transient E. volatile Answer:C native 7. Which of the following statements are true? (Select all that apply.) A. A final objects data cannot be changed. B. A final class can be subclassed. C. A final method cannot be overloaded. D. A final object cannot be reassigned a new address in memory. E. None of the above. Answer:D: A final object cannot be reassigned a new address in memory. 8. The keyword extends refers to what type of relationship? A. is a B. has a C. was a D. will be a E. None of the above Answer:A is a 9. Which of the following keywords is used to invoke a method in the parent clas s? A. this B. super C. final D. static Answer:B super 10. Given the following code, what will be the outcome? public class Funcs extends java.lang.Math { public int add(int x, int y) { return x + y; } public int sub(int x, int y) { return x - y; } public static void main(String [] a) { Funcs f = new Funcs(); System.out.println("" + f.add(1, 2)); } } A. The code compiles but does not output anything. B. 3 is printed out to the console. C. The code does not compile.

D. None of the above. Answer:C 3 is printed out to the console. 11. Given the following code, what is the expected outcome? public class Test { public static void main(String [] a) { int [] b = [1,2,3,4,5,6,7,8,9,0]; System.out.println("a[2]=" + a[2]); } } A. The code compiles but does not output anything. B. a[2]=3 is printed out to the console. C. a[2]=2 is printed out to the console. D. The code does not compile. E. None of the above. Answer:D The code does not compile. 12. What is the value of x after the following operation is performed? x = 23 % 4; A. 23 B. 4 C. 5.3 D. 3 E. 5 Answer:D 3 13. Given the following code, what keyword must be used at line 4 in order to st op execution of the for loop? 1. boolean b = true; 2. for (;;) { 3. if (b) { 4. <insert code> 5. } 6. // do something 7. } A. stop B. continue C. break D. None of the above Answer:C break 14. What method call is used to tell a thread that it has the opportunity to run ? A. wait() B. notify() C. start() D. run() Answer:B notify() 15. Given the following code, which of the results that follow would you expect? 1. package mail; 2. 3. interface Box { 4. protected void open(); 5. void close(); 6. public void empty(); 7. } A. The code will not compile because of line 4. B. The code will not compile because of line 5.

C. The code will not compile because of line 6. D. The code will compile. Answer:A The code will not compile because of line 4. 16. Assertions are used to enforce all but which of the following? A. Preconditions B. Postconditions C. Exceptions D. Class invariants Answer: C Exceptions 17. The developer can force garbage collection by calling System.gc(). A. True B. False Answer:B False 18. Select the valid primitive data types. (Select all that apply.) A. boolean B. bit C. char D. float E. All of the above Answer:A. boolean C. char D. float 19. How many bits does a float contain? A. 1 B. 8 C. 16 D. 32 E. 64 Answer:D. 32 20. What is the value of x after the following line is executed? x = 32 * (31 - 10 * 3); A. 32 B. 31 C. 3 D. 704 E. None of the above Answer:A. 32 21. A StringBuffer is slower than a StringBuilder, but a StringBuffer is threads afe. A. True B. False Answer:A. True 22. Select the list of primitives ordered in smallest to largest bit size repres entation. A. boolean, char, byte, double B. byte, int, float, char C. char, short, long, float D. char, int, float, long E. None of the above Answer:D. char, int, float, long 23. Which class provides locale-sensitive text formatting for date and time info rmation? A. java.util.TimeFormat B. java.util.DateFormat

C. java.text.TimeFormat D. java.text.DateFormat Answer:D. java.text.DateFormat 24. The following line of code is valid. int x = 9; byte b = x; A. True B. False Answer:B. False 25. Which of the following code snippets compile? A. Integer i = 7; B. Integer i = new Integer(5); int j = i; C. byte b = 7; D. int i = 7; byte b = i; E. None of the above Answer:A. Integer i = 7;B. Integer i = new Integer(5); int j = i;C. byte b = 7; 26. What will be the output of the following code? public class StringTest { public static void main(String [] a) { String s1 = "test string"; String s2 = "test string"; if (s1 == s2) { System.out.println("same"); } else { System.out.println("different"); } } } A. The code will compile but not run. B. The code will not compile. C. different will be printed out to the console. D. same will be printed out to the console. E. None of the above. Answer:d same will be printed out to the console. 27. Java arrays always start at index 1. A. True B. False Answer:B. False 28. Which of the following statements accurately describes how variables are pas sed to methods? A. Arguments are always passed by value. B. Arguments are always passed by reference. C. Arguments that are primitive type are passed by value. D. Arguments that are passed with the & operator are passed by reference Answer:C. Arguments that are primitive type are passed by value. 29. How do you change the value that is encapsulated by a wrapper class after yo u have instantiated it? A. Use the setXXX() method defined for the wrapper class. B. Use the parseXXX() method defined for the wrapper class. C. Use the equals() method defined for the wrapper class. D. None of the above. Answer:D. None of the above. 30. Suppose you are writing a class that provides custom deserialization. The cl

ass implements java.io.Serializable (and not java.io.Externalizable). What method should implem ent the custom deserialization, and what is its access mode? A. private readObject B. public readObject() C. private readExternal() D. public readExternal() Answer:A. private readObject ================================================================================ =============================== CHAPTER 1 ==================== 1. A signed data type has an equal number of non-zero positive and negative values available A. True B. False Answer:False 2. Choose the valid identifiers from those listed here A. Big0LongStringWithMeaninglessName B. $int C. bytes D. $1 E. Finalist Answer:a,b,c,d,e 3. Which of the following signatures are valid for the main() method entry point of an application? A. public static void main() B. public static void main(String arg[]) C. public void main(String [] arg) D. public static void main (String[] args) E. public static int main(String [] arg) Answer:B. public static void main(String arg[]),D. public static vo id main (String[] args) 4. If all three top-level elements occur in a source file, they must appear in which order? A. Imports, package declarations, classes/interfaces/enums B. Classes/interfaces/enums, imports, package declarations C. Package declaration must come first; order for imports and class/interfa ces/enum difinitions is not significant D. Package declaration, imports, class/interface/enum definitions. E. Imports must come first; order for package declarations and class/interf ace/enum definitions is not significant Answer: D.Package declaration, imports, class/interface/enum definitions. 5. Consider the following line of code Int[] x = new int[25]; After execution, which statements are true? A. x[24] is 0; B. x[24] is undefined; C. x[25] is 0; D. x[0] is null; E. x.length is 25; Answer:x[24] is 0;x.length is 25; 6. Consider the following application:

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.

Class Q6{ Public static void main(String args[]) { Holder h = new Holder(); h.held = 100; h.bump(h); System.out.println(h.held); } } Class Holder{ public int held; public void bump(Holder theHolder){ theHolder.held++; } }

What value is printed out at line 6? A. 0 B. 1 C. 100 D. 101 Answer:101 7. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Consider the following application class Q7 public static void main(String args[]) { double d = 12.3; Decrementer dec = new Decrementer(); dec.decrement(d); System.out.println(d); } } Class Decrement { Public void decrement(double decMe) { decMe = decMe 1.0; } }

What value is printed out at line 6? A. 0.0 B. 1.0 C. 12.3 D. 11.3 Answer:12.3 8. How can you force garbage collection of an object? A. Garbage collection cannot be forced B. Call System.gc() C. Call System.gc(), passing in a reference to the object to be garbage-col lected D. Call Runtime.gc() E. Set all references to the object to new values (null, for example) Answer:Garbage collection cannot be forced 9. ort? A. B. C. What is the range of value that can be assigned to a variable of type sh Depends on the underlying hardware 0 through 216 1 0 through 232 1

D. -215 through 215 1 E. -231 through 231 1 Answer:-215 through 215 1 10. What is the range of values that can be assigned to a variable of type b yte? A. Depends on the underlying hardware B. 0 through 28 1 C. 0 through 216 1 D. -27 through 27 1 E. -215 through 215 1 Answer:-27 through 27 1 11. Suppose a source file contains a large number of import statements. How do the imports affect the time required to compile the source file A. Compilation takes no additional time B. Compilation takes slightly more time C. Compilation takes significantly more time Answer:Compilation takes slightly more time 12. Suppose a source file contains a large number of import statements and o ne class definition. How do the imports affect the time required to load the cla ss? A. Class loading takes no additional time B. Class loading takes slightly more time C. Class loading take significantly more time Answer:Class loading takes no additional time 13. Which of the following are legal import statement? A. import java.util.Vector; B. static import java.util.Vector; C. import static java.util.Vector.*; D. import java.util.Vector static; Answer:import java.util.Vector;import static java.util.Vector.*; 14. Which of the following may be statically imported A. Package names B. Static method names C. Static field names D. Method-local variable names Answer:Static method names,Static field names 15. What happens when you try to compiler and run the following code? public class Q15 { static String s; public static void main(String[] args) { System.out.println(>> + s + <<); } } A. The code does not compile B. The code compiles, and prints out >><< C. The code compiles, and prints out >>null<< Answer:The code compiles, and prints out >>null<< 16. A. B. C. D. E. Which int a int b int c int d int e of the following are legal? = abcd; = ABCD; = 0xabcd; = 0XABCD; = 0abcd;

F. int f = 0ABCD; Answer:int c = 0xabcd;int d = 0XABCD; 17. Which of the following are legal? A. double d = 1.2d; B. double d = 1.2D; C. double d = 1.2d5; D. double d = 1.2D5; Answer:double d = 1.2d;double d = 1.2D; 18. Which of the following are legal? A. char c = 0x1234; B. char c = \u1234; C. char c = \u1234; Answer:char c = \u1234; 19. Consider the following code 1. StringBuffer sbuf = new StringBuffer(); 2. Sbuf = null; 3. System.gc(); Choose all true statements: A. After line 2 executes, the StringBuffer object is garbage collected. B. After line 3 executes, the StringBuffer object is garbage collected. C. After line 2 executes, the StringBuffer object is eligible for garbage c ollection D. After line 3 executes, the StringBuffer object is eligible for garbage c ollection Answer:After line 2 executes, the StringBuffer object is garbage collected. 20. Which of the following are true? A. Primitives are passed by reference B. Primitives are passed by value. C. References are passed by reference D. Reference are passed by value Answer:Primitives are passed by value.Reference are passed by value ================================================================================ =============================== CHAPTER 2 /////////// 1. After execution of the following code fragment, what are the values of t he variables x, a, and b 1. int x, a = 6, b = 7; 2. x = a++ + b++; Answer: A. x =15, a = 7, b= 8 B. x = 15, a = 6, b = 7 C. x = 13, a = 7, b = 8 D. x = 13, a = 6, b = 7 Answer:x = 13, a = 7, b = 8 2. Which of the following expressions are legal? A. int x = 6; x = !x; B. int x = 6; if (!(x>3)) {} C. int x = 6; x = ~x; Answer:int x = 6; if (!(x>3)) {},int x = 6; x = ~x; 3. Which of the following expressions results in a positive value in x?

A. int x = -1, x = x >>> 5; B. int x = -1, x = x >>> 32; C. byte x = -1, x = x >>> 5; D. int x = -1; x = x >> 5; Answer:int x = -1, x = x >>> 5; 4. Which of the following expression are legal? A. String x = Hello; int y = 9; x += y; B. String x = Hello; int y = 9; if (x == y) {} C. String x = Hello; int y = 9 ; x = x + y; D. String x = Hello; int y = 9 ; y = y + x; Answer:String x = Hello; int y = 9; x += y;String x = Hello; int y = 9 ; x = x + y; 5. What is -8 % 5? A. -3 B. 3 C. -2 D. 2 Answer:-3 6. What is 7 % -4; A. -3 B. 3 C. -4 D. 4 Answer:3 7. What results from running the following code? 1. Public class Xor { 2. Public static void main (String args[]) { 3. Byte b = 10; 4. Byte c = 10; 5. B = (byte)(b ^ c) 6. System.out.println(b contains +b); 7. } 8. } A. The output: b contains 10 B. The output: b contains 5 C. The output: b contains 250 D. The output: b contains 245 Answer:The output: b contains 5 8. 1. 2. 3. 4. 5. 6. 7. What results from attempting to compile and run the following code? Public class Conditional { Public static void main(String args[]) { Int x = 4; System.out.println(value is + ((x > 4) ? 99.99 : 9)); } }

A. The output: value is 99.99 B. The output: value is 9 C. The output: value is 9.0 D. A compiler error at line 5 Answer:The output: value is 9.0 9 What does the following code do? Integer i = null; If (i != null & i.intValue() == 5)

System.out.println(Value is 5); A. Prints Value is 5 B. Throws an exception Answer:Throws an exception 9. It is possible to define a class called Thing so that the following meth od can return true under certain circumstances? boolean weird(Thing s) { integer x = new Integer(5); return s.equals(x); } A. Yes B. No Answer:Yes 10. Suppose ob1 and ob2 are references to instances of java.lang.Object. If (ob1 == ob2) is false, can ob1.equals(ob2) ever be true? A. Yes B. No Answer:No 11. When a byte is added to a char, what is the type of the result? A. Byte B. Char C. Int D. Short E. You cant add byte to a char Answer:Int 12. When a short is added to a float, what is the type of the result? A. Short B. Int C. Float D. You cant add a short to a float Answer:Float 13. Which statement is true about the following method? int selfXor(int i) { return i ^ i; } A. It always returns 0 B. It always return 1; C. It always an int where every bit is 1 D. The returned value varies depending on the argument. Answer:It always returns 0 14. A. B. C. D. Answer: 15. A. B. C. D. E. Which of the following operations might throw an ArithmeticException? >> >>> << None of these None of these Which of the following operations might throw an ArithmeticException? + * / None of these

Answer:D./ 16. What is the return type of the instanceof operation? A. A reference B. A class C. An int D. A Boolean Answer:A Boolean 17. Which of the following may appear on the left-hand side of an instanceof operation? A. A reference B. A class C. An interface D. A variable of primitive type Answer:A reference 18. Which of the following may appear on the right-hand side of an instanceo f operation? A. A reference B. A class C. An interface D. A variable of primitive type E. The name of a primitive type Answer:A class,An interface 19. What is -50 >> 1? A. A negative number with very large magnitude B. A positive number with very large magnitude C. -100 D. -25 E. 100 F. 25 Answer:-25 ================================================================================ =============================== CHAPTER 3 2. Which of the following statements is true? A. An abstract class may not have any final methods B. A final class may not have any abstract methods. Answer:B. A final class may not have any abstract methods. 4. Which of the following statements is true? A. Transient methods may not be overridden B. Transient methods must be overridden C. Transient classes may not be serialized D. Transient variables must be static E. Transient variable are not serialized Answer:Transient variable are not serialized 8. Which modifier or modifiers should be used to denote a variable that sho uld not be written out as part of its classs persistent state A. Private B. Protected C. Private protected D. Transient E. Volatile

Answer:Transient 14. Which of the following may be declared final? A. Classes B. Data C. Methods Answer:a Classes,b Data,c Methods 16. Suppose class A has a method called doSomething(), with default access. Suppose class B extends A and overrides doSomething(). Which access models may a pply to Bs version of doSomething() A. Public B. Private C. Protected D. Default Answer:Public,Protected,Default 17. True or false: If class Y extends class X, the two classes are in differ ent packages, and class X has a protected method called abby(), then any instanc e of Y may call the abby() method of any other instance of Y A. True B. False Answer:True 18. Which of the following statements are true? A. A final class must be instantiated B. A final class must contain at least one final method C. A final class must contain at least one final data field D. A final class may not be extended E. None of the above Answer:A final class may not be extended ================================================================================ =============================== CHAPTER 4 ///// 3. 1. 2. 3. Will the following code compile? byte b = 2; byte b1 = 3; b = b * b1

A. Yes B. No Answer: NO 12. A. B. C. When is x & y an int? Always Sometimes When neither x nor y is a float, a long, or a double

Answer:Sometimes 14. When a negative long in cast to a byte, what are the possible values of the result? A. Positive B. Zero C. Negative D. All of the above

Answer:All of the above 16. s A. B. C. D. E. F. Answer: Answer: Answer: Answer: Which of the following operations can perform promotion on their operand + ++ - ~ ! +,-,~

================================================================================ =============================== chapter 5 ===================== 1. Consider the following code: 1. for (int i = 0; i < 2; i++) { 2. for (int j = 0; j < 3; j++) { 3. if (i == j) { 4. continue; 5. } 6. System.out.println("i = " + i + " j = " + j); 7. } 8. } Which lines would be part of the output? (Choose all that apply.) A. i = 0 j = 0 B. i = 0 j = 1 C. i = 0 j = 2 D. i = 1 j = 0 E. i = 1 j = 1 F. i = 1 j = 2 Answer:B, C, D, F. 2. Consider the following code: 1. outer: for (int i = 0; i < 2; i++) { 2. for (int j = 0; j < 3; j++) { 3. if (i == j) { 4. continue outer; 5. } 6. System.out.println("i = " + i + " j = " + j); 7. } 8. } Which lines would be part of the output? (Choose all that apply.) A. i = 0 j = 0 B. i = 0 j = 1 C. i = 0 j = 2 D. i = 1 j = 0 E. i = 1 j = 1 F. i = 1 j = 2 Answer:D 3. Which of the following are legal loop constructions? (Choose all that apply.) A. while (int i<7) { i++; System.out.println("i is " + i); }

B. int i = 3; while (i) { System.out.println("i is " + i); } C. int j = 0; for (int k=0, j+k != 10; j++,k++) { System.out.println("j=" + j + ", k=" + k); } D. int j=0; do { System.out.println("j=" + j++); if (j==3) continue loop; } while (j<10); Answer:C 4. What would be the output from this code fragment? 1. int x = 0, y = 4, z = 5; 2. if (x > 2) { 3. if (y < 5) { 4. System.out.println("message one"); 5. } 6. else { 7. System.out.println("message two"); 8. } 9. } 10. else if (z > 5) { 11. System.out.println("message three"); 12. } 13. else { 14. System.out.println("message four"); 15. } A. message one B. message two C. message three D. message four Answer:D 5. Which statement is true about the following code fragment? 1. int j = 2; 2. switch (j) { 3. case 2: 4. System.out.println("value is two"); 5. case 2 + 1: 6. System.out.println("value is three"); 7. break; 8. default: 9. System.out.println("value is " + j); 10. break; 11. } A. The code is illegal because of the expression at line 5. B. The acceptable types for the variable j, as the argument to the switch() cons truct, could be any of byte, short, int, or long. C. The output would be the text value is two. D. The output would be the text value is two followed by the text value is three . E. The output would be the text value is two, followed by the text value is thre

e, followed by the text value is 2. Answer: A+D 6. Consider the following class hierarchy and code fragment: 1. try { 2. // assume s is previously defined 3. URL u = new URL(s); 4. // in is an ObjectInputStream 5. Object o = in.readObject(); 6. System.out.println("Success"); 7. } 8. catch (MalformedURLException e) { 9. System.out.println("Bad URL"); 10. } 11. catch (StreamCorruptedException e) { 12. System.out.println("Bad file contents"); 13. } 14. catch (Exception e) { 15. System.out.println("General exception"); 16. } 17. finally { 18. System.out.println("Doing finally part"); 19. } 20. System.out.println("Carrying on"); What lines are output if the constructor at line 3 throws a MalformedURLExceptio n? (Choose all that apply.) A. Success B. Bad URL C. Bad file contents D. General exception E. Doing finally part F. Carrying on Answer:B Bad URL, E Doing finally part, F Carrying on 7. Consider the following class hierarchy and code fragment: 1. try { 2. // assume s is previously defined 3. URL u = new URL(s); 4. // in is an ObjectInputStream 5. Object o = in.readObject(); 6. System.out.println("Success"); 7. } 8. catch (MalformedURLException e) { 9. System.out.println("Bad URL"); 10. } 11. catch (StreamCorruptedException e) { 12. System.out.println("Bad file contents"); 13. } 14. catch (Exception e) { 15. System.out.println("General exception"); 16. } 17. finally { 18. System.out.println("Doing finally part"); 19. } 20. System.out.println("Carrying on"); What lines are output if the methods at lines 3 and 5 complete successfully with out throwing any exceptions? (Choose all that apply.) A. Success

B. Bad URL C. Bad file contents D. General exception E. Doing finally part F. Carrying on Answer:A. Success E. Doing finally part F. Carrying on 8. Consider the following class hierarchy and code fragment: 1. try { 2. // assume s is previously defined 3. URL u = new URL(s); 4. // in is an ObjectInputStream 5. Object o = in.readObject(); 6. System.out.println("Success"); 7. } 8. catch (MalformedURLException e) { 9. System.out.println("Bad URL"); 10. } 11. catch (StreamCorruptedException e) { 12. System.out.println("Bad file contents"); 13. } 14. catch (Exception e) { 15. System.out.println("General exception"); 16. } 17. finally { 18. System.out.println("Doing finally part"); 19. } 20. System.out.println("Carrying on"); What lines are output if the method at line 5 throws an OutOfMemoryError? (Choos e all that apply.) A. Success B. Bad URL C. Bad file contents D. General exception E. Doing finally part F. Carrying on Answer:E. Doing finally part 9. Which of the following are appropriate situations for assertions? A. Preconditions of a public method B. Postconditions of a public method C. Preconditions of a private method D. Postconditions of a private method Answer:B. Postconditions of a public methodC. Preconditions of a private method D. Postconditions of a private method 10. Consider the following code: 1. public class Assertification { 2. public static void main(String[] args) { 3. assert args.length == 0; 4 } 5. } Which of the following conditions must be true in order for the code to throw an AssertionError? Assume you are using release 5.0. (Choose all that apply.) A. The source code must be compiled with the -source 1.5 flag. B. The application must be run with the -enableassertions flag or another assert ionenabling flag. C. The args array must have exactly zero elements.

D. The args array must have one or more elements. Answer:D. The args array must have one or more elements.A. The source code must be compiled with the -source 1.5 flag. B. The application must be run with the -enableassertions flag or another assert ionenabling flag. 11. Which of the following is the most appropriate way to handle invalid arg uments in a public method? A. Throw java.lang.InvalidArgumentException. B. Throw java.lang.IllegalArgumentException. C. Check for argument validity in an assert statement, which throws AssertionErr or when the arguments are invalid. D. Use non-assert code to check for argument validity. If invalid arguments are detected, explicitly throw AssertionError. Answer:B. Throw java.lang.IllegalArgumentException. 12. Suppose salaries is an array containing floats. Which of the following are v alid loop control statements for processing each element of salaries? A. for (float f:salaries) B. for (int i:salaries) C. for (float f::salaries) D. for (int i::salaries) Answer:A. for (float f:salaries) 13. Which of the following are legal? (Choose all that apply.) A. for (int i=0, j=1; i<10; i++, j++) B. for (int i=0, j=1;; i++, j++) C. for (int i=0, float j=1; ; i++, j++) D. for (String s = ; s.length()<10; s += !) Answer:A. for (int i=0, j=1; i<10; i++, j++),B. for (int i=0, j=1;; i++, j++), D for (String s = ; s.length()<10; s += !) 14. Suppose a method called finallyTest() consists of a try block, followed by a catch block, followed by a finally block. Assuming the JVM doesnt crash and the code does not execute a System.exit() call, under what circumstances will the finally block not begin to execute? A. The try block throws an exception, and the catch block also throws an excepti on. B. The try block throws an exception that is not handled by the catch block. C. The try block throws an exception, and the catch block calls finallyTest() in a way that causes another exception to be thrown. D. If the JVM doesnt crash and the code does not execute a System.exit() call, th e finally block will always execute. Answer:D. If the JVM doesnt crash and the code does not execute a System.exit() c all, the finally block will always execute. 15. Which of the following are legal loop definitions? (Choose all that apply.) A. while (int a = 0) { /* whatever */ } B. while (int a == 0) { /* whatever */ } C. do { /* whatever */ } while (int a = 0)

D. do { /* whatever */ } while (int a == 0) E. for (int a==0; a<100; a++) { /* whatever */ } F. None of them are legal. Answer:F. None of them are legal. 16. Which of the following are legal argument types for a switch statement? A. byte B. int C. long D. float E. char F. String Answer:A. byte,B. int,E. char 17. When is it appropriate to pass a cause to an exceptions constructor? A. Always B. When the exception is being thrown in response to catching of a different exc eption type C. When the exception is being thrown from a public method D. When the exception is being thrown from a private method Answer:B. When the exception is being thrown in response to catching of a differ ent exception type 18. Which of the following should always be caught? A. Runtime exceptions B. Checked exceptions C. Assertion errors D. Errors other than assertion errors Answer:B. Checked exceptions 19. When does an exceptions stack trace get recorded in the exception object? A. When the exception is constructed B. When the exception is thrown C. When the exception is caught D. When the exceptions printStackTrace() method is called Answer:A. When the exception is constructed 20. When is it appropriate to write code that constructs and throws an error? A. When a public methods preconditions are violated B. When a public methods postconditions are violated C. When a nonpublic methods preconditions are violated D. When a nonpublic methods postconditions are violated E. Never Answer:E. Never ================================================================================ =============================== Chapter 6 1. Consider this class: 1. public class Test1 { 2. public float aMethod(float a, float b) { 3. } 4. 5. } Which of the following methods would be legal if added (individually) at line 4? (Choose all that apply.) A. public int aMethod(int a, int b) { } B. public float aMethod(float a, float b) { } C. public float aMethod(float a, float b, int c) throws Exception { }

D. public float aMethod(float c, float d) { } E. private float aMethod(int a, int b, int c) { } Answer: A,C,E 2. Consider these classes, defined in separate source files: 1. public class Test1 { 2. public float aMethod(float a, float b) 3. throws IOException {... 4. } 5. } 1. public class Test2 extends Test1 { 2. 3. } Which of the following methods would be legal (individually) at line 2 in class Test2? (Choose all that apply.) A. float aMethod(float a, float b) {...} B. public int aMethod(int a, int b) throws Exception {...} C. public float aMethod(float a, float b) throws Exception {...} D. public float aMethod(float p, float q) {...} Answer: B,D 3. You have been given a design document for a veterinary registration system fo r implementation in Java. It states: A pet has an owner, a registration date, and a vaccination-due date. A cat is a p et that has a flag indicating whether it has been neutered, and a textual description of its m arkings. Given that the Pet class has already been defined, which of the following fields would be appropriate for inclusion in the Cat class as members? (Choose all that apply.) A. Pet thePet; B. Date registered; C. Date vaccinationDue; D. Cat theCat; E. boolean neutered; F. String markings; Answer:E. boolean neutered;F. String markings; 4. You have been given a design document for a veterinary registration system fo r implementation in Java. It states: A pet has an owner, a registration date, and a vaccination-due date. A cat is a p et that has a flag indicating if it has been neutered, and a textual description of its markin gs. Given that the Pet class has already been defined and you expect the Cat class t o be used freely throughout the application, how would you make the opening declaration of the Ca t class, up to but not including the first opening brace? Use only these words and spaces: b oolean, Cat, class, Date, extends, Object, Owner, Pet, private, protected, public, String. A. protected class Cat extends Owner B. public class Cat extends Object C. public class Cat extends Pet D. private class Cat extends Pet Answer:C. public class Cat extends Pet

5. Consider the following classes, declared in separate source files: 1. public class Base { 2. public void method(int i) { 3. System.out.print(Value is + i); 4. } 5. } 1. public class Sub extends Base { 2. public void method(int j) { 3. System.out.print(This value is + j); 5. public void method(String s) { 6. System.out.print(I was passed + s); 7. } 8. public static void main(String args[]) { 9. Base b1 = new Base(); 10. Base b2 = new Sub(); 11. b1.method(5); 12. b2.method(6); 13. } 14. } What output results when the main method of the class Sub is run? A. Value is 5Value is 6 B. This value is 5This value is 6 C. Value is 5This value is 6 D. This value is 5Value is 6 E. I was passed 5I was passed 6 Answer:C.Value is 5This value is 6 6. Consider the following class definition: 1. public class Test extends Base { 2. public Test(int j) { 3. } 4. public Test(int j, int k) { 5. super(j, k); 6. } 7. } Which of the following are legitimate calls to construct instances of the Test c lass? (Choose all that apply.) A. Test t = new Test(); B. Test t = new Test(1); C. Test t = new Test(1, 2); D. Test t = new Test(1, 2, 3); E. Test t = (new Base()).new Test(1); Answer:B. Test t = new Test(1);C. Test t = new Test(1, 2); 7. Consider the following class definition: 1. public class Test extends Base { 2. public Test(int j) { 3. } 4. public Test(int j, int k) { 5. super(j, k); 6. } 7. } Which of the following forms of constructor must exist explicitly in the definit ion of the Base class? Assume Test and Base are in the same package. (Choose all that apply.) A. Base() { } B. Base(int j) { } C. Base(int j, int k) { } D. Base(int j, int k, int l) { }

Answer:A. Base() { }B. Base(int j) { } 8. Consider the following definition: 1. public class Outer { 2. public int a = 1; 3. private int b = 2; 4. public void method(final int c) { 5. int d = 3; 6. class Inner { 7. private void iMethod(int e) { 8. 9. } 10. } 11. } 12. } Which variables can be referenced at line 8? (Choose all that apply. A. a B. b C. c D. d E. e Answer:a,b,c e 9. Which of the following statements are true? (Choose all that apply.) A. Given that Inner is a nonstatic class declared inside a public class Outer an d that appropriate constructor forms are defined, an instance of Inner can be constructed like this : new Outer().new Inner() B. If an anonymous inner class inside the class Outer is defined to implement th e interface ActionListener, it can be constructed like this: new Outer().new ActionListener( ) C. Given that Inner is a nonstatic class declared inside a public class Outer an d that appropriate constructor forms are defined, an instance of Inner can be constructed in a stat ic method like this: new Inner() D. An anonymous class instance that implements the interface MyInterface can be constructed and returned from a method like this: 1. return new MyInterface(int x) { 2. int x; 3. public MyInterface(int x) { 4. this.x = x;5. }6. }; Answer:A. Given that Inner is a nonstatic class declared inside a public class O uter and that appropriate constructor forms are defined, an instance of Inner can be constructed like this : new Outer().new Inner() 10. Which of the following are legal enums? A. enum Animals { LION, TIGER, BEAR } B. enum Animals { int age; LION, TIGER, BEAR; } C. enum Animals { LION, TIGER, BEAR; int weight;

} D. enum Animals { LION(450), TIGER(450), BEAR; int weight; Animals(int w) { weight = w; } } E. enum Animals { LION(450), TIGER(450), BEAR; int weight; Animals() { } Animals(int w) { weight = w; } } Answer:C e 11. Which of the following may override a method whose signature is void xyz(flo at f)? A. void xyz(float f) B. public void xyz(float f) C. private void xyz(float f) D. public int xyz(float f) E. private int xyz(float f) Answer:A. void xyz(float f),B. public void xyz(float f) 12. Which of the following are true? A. An enum definition should declare B. An enum may be subclassed. C. An enum may contain public method D. An enum may contain private data. Answer:C. An enum may contain public rivate data. (Choose all that apply.) that it extends java.lang.Enum. definitions. method definitions.D. An enum may contain p

13. Which of the following are true? (Choose all that apply.) A. An enum definition may contain the main() method of an application. B. You can call an enums toString() method. C. You can call an enums wait() method. D. You can call an enums notify() method. Answer:a,b,c,d 14. Suppose x and y are of type TrafficLightState, which is an enum. What is the best way to test whether x and y refer to the same constant? A. if (x == y) B. if (x.equals(y)) C. if (x.toString().equals(y.toString())) D. if (x.hashCode() == y.hashCode()) Answer:A. if (x == y) 15. Which of the following restrictions apply to anonymous inner classes? A. They must be defined inside a code block. B. They may only read and write final variables of the enclosing class. C. They may only call final methods of the enclosing class. D. They may not call the enclosing class synchronized methods. Answer:A. They must be defined inside a code block. 16. Given the following code, which of the following will compile? enum Spice { NUTMEG, CINNAMON, CORIANDER, ROSEMARY; }

A. Spice sp = Spice.NUTMEG; Object B. Spice sp = Spice.NUTMEG; Object C. Object ob = new Object(); Spice D. Object ob = new Object(); Spice Answer:A,b,d

ob ob sp sp

= = = =

sp; (Object)sp; object; (Spice)object;

17. Which of the following are true? A. An anonymous inner class may implement at most one interface. B. An anonymous inner class may implement arbitrarily many interfaces. C. An anonymous inner class may extend a parent class other than Object. D. An anonymous inner class that implements one interface may extend a parent cl ass other than Object. E. An anonymous inner class that implements several interfaces may extend a pare nt class other than Object. Answer:a,c 18. Which methods return an enum constants name? A. getName() B. name() C. toString() D. nameString() E. getNameString() Answer:B. name(),C. toString() 19. Suppose class X contains the following method: void doSomething(int a, float b) { } Which of the following methods may appear in class Y, which extends X? A. public void doSomething(int a, float b) { } B. private void doSomething(int a, float b) { } C. public void doSomething(int a, float b) throws java.io.IOException { } D. private void doSomething(int a, float b) throws java.io.IOException { } Answer:A. public void doSomething(int a, float b) { } 20. This question involves IOException, AWTException, and EOFException. They are all checked exception types. IOException and AWTException extend Exception, and EOFException extends IOException. Suppose class X contains the following method: void doSomething() throws IOException{ } Which of the following methods may appear in class Y, which extends X? A. void doSomething() { } B. void doSomething() throws AWTException { } C. void doSomething() throws EOFException { } D. void doSomething() throws IOException, EOFException { } Answer:a,c,d ================================================================================ =============================== Chapter 7 =================== 1. Which one statement is true concerning the following code? 1. class Greebo extends java.util.Vector 2. implements Runnable { 3. public void run(String message) { 4. System.out.println(in run() method: + 5. message); 6. }

7. } 8. 9. class GreeboTest { 10. public static void main(String args[]) { 12. Greebo g = new Greebo(); 13. Thread t = new Thread(g); 14. t.start(); 15. } 16. } A. There will be a compiler error, because class Greebo does not correctly imple ment the Runnable interface. B. There will be a compiler error at line 13, because you cannot pass a paramete r to the constructor of a Thread. C. The code will compile correctly but will crash with an exception at line 13. D. The code will compile correctly but will crash with an exception at line 14. E. The code will compile correctly and will execute without throwing any excepti ons. Answer: A 2. Which one statement is always true about the following application? 1. class HiPri extends Thread { 2. HiPri() { 3. setPriority(10); 4. } 5. 6. public void run() { 7. System.out.println( 8. Another thread starting up.); 9. while (true) { } 10. } 11. 12. public static void main(String args[]) { 13. HiPri hp1 = new HiPri(); 14. HiPri hp2 = new HiPri(); 15. HiPri hp3 = new HiPri(); 16. hp1.start(); 17. hp2.start(); 18. hp3.start(); 19. } 20. } A. When the application is run, thread hp1 will execute; threads hp2 and hp3 wil l never get the CPU. B. When the application is run, thread hp1 will execute to completion, thread hp 2 will execute to completion, then thread hp3 will execute to completion. C. When the application is run, all three threads (hp1, hp2, and hp3) will execu te concurrently, taking time-sliced turns in the CPU. D. None of the above scenarios can be guaranteed to happen in all cases. Answer: C 3. A thread wants to make a second thread ineligible for execution. To do t his, the first thread can call the yield() method on the second thread. A. True B. False Answer: B

4. A threads run() method includes the following lines: 1. try { 2. sleep(100); 3. } catch (InterruptedException e) { } Assuming the thread is not interrupted, which one of the following statements is correct? A. The code will not compile, because exceptions cannot be caught in a threads ru n() method. B. At line 2, the thread will stop running. Execution will resume in, at most, 1 00 milliseconds. C. At line 2, the thread will stop running. It will resume running in exactly 10 0 milliseconds. D. At line 2, the thread will stop running. It will resume running some time aft er 100 milliseconds have elapsed. Answer: D 5. A monitor called mon has 10 threads in its waiting pool; all these waiting th reads have the same priority. One of the threads is thr1. How can you notify thr1 so that it alone m oves from the Waiting state to the Ready state? A. Execute notify(thr1); from within synchronized code of mon. B. Execute mon.notify(thr1); from synchronized code of any object. C. Execute thr1.notify(); from synchronized code of any object. D. Execute thr1.notify(); from any code (synchronized or not) of any object. E. You cannot specify which thread will get notified. Answer: E 6. If you attempt to compile and execute the following application, will it ever print out the message In xxx? 1. class TestThread3 extends Thread { 2. public void run() { 3. System.out.println(Running); 4. System.out.println(Done); 5. } 6. 7. private void xxx() { 8. System.out.println(In xxx); 9. } 10. 11. public static void main(String args[]) { 12. TestThread3 ttt = new TestThread3(); 13. ttt.xxx(); 14. ttt.start(); 12. } 13. } A. Yes B. No Answer: A 7. A Java monitor must either extend Thread or implement Runnable. A. True B. False Answer: B 8. Which of the following methods in the Thread class are deprecated? A. suspend() and resume()

B. wait() and notify() C. start() and stop() D. sleep() and yield() Answer: A 9. Which of the following statements about threads is true? A. Every thread starts executing with a priority of 5. B. Threads inherit their priority from their parent thread. C. Threads are guaranteed to run with the priority that you set using the setPri ority() method. D. Thread priority is an integer ranging from 1 to 100. Answer: B 10. Which of the following statements about the wait() and notify() methods is t rue? A. The wait() and notify() methods can be called outside synchronized code. B. The programmer can specify which thread should be notified in a notify() meth od call. C. The thread that calls wait() goes into the monitors pool of waiting threads. D. The thread that calls notify() gives up the lock. Answer: C 11. Which of the following may not be synchronized? A. Blocks within methods B. Static methods C. Blocks within static methods D. Classes Answer: D 12. Which of the following calls may be made from a non-static synchronized meth od? A. A call to the same method of the current object. B. A call to the same method of a different instance of the current class. C. A call to a different synchronized method of the current object. D. A call to a static synchronized method of the current class. Answer: A,B,C,D 13. How many locks does an object have? A. One B. One for each method C. One for each synchronized method D. One for each non-static synchronized method Answer: A 14. Is it possible to write code that can execute only if the current thread own s multiple locks? A. Yes. B. No. Answer:A 15. Which of the following are true? (Choose all that apply.) A. When an application begins running, there is one daemon thread, whose job is to execute main(). B. When an application begins running, there is one non-daemon thread, whose job is to execute main(). C. A thread created by a daemon thread is initially also a daemon thread. D. A thread created by a non-daemon thread is initially also a non-daemon thread

. Answer: B,C,D 16. Which of the following are true? A. The JVM runs until there is only one daemon thread. B. The JVM runs until there are no daemon threads. C. The JVM runs until there is only one non-daemon thread. D. The JVM runs until there are no non-daemon threads. Answer: D 17. How do you prevent shared data from being corrupted in a multithreaded envir onment? A. Mark all variables as synchronized. B. Mark all variables as volatile. C. Use only static variables. D. Access the variables only via synchronized methods. Answer: D 18. How can you ensure that multithreaded code does not deadlock? A. Synchronize access to all shared variables. B. Make sure all threads yield from time to time. C. Vary the priorities of your threads. D. A, B, and C do not ensure that multithreaded code does not deadlock. Answer: D 19. Which of the following are true? (Choose all that apply.) A. When you declare a method to be synchronized, the method always synchronizes on the lock of the current object. B. When you declare a method to be synchronized, you can specify the object on w hose lock the method should synchronize. C. When you declare a block of code inside a method to be synchronized, the bloc k always synchronizes on the lock of the current object. D. When you declare a block of code inside a method to be synchronized, you can specify the object on whose lock the block should synchronize. Answer: A,D 20. Suppose you want to create a custom thread class by extending java.lang.Thre ad in order to provide some special functionality. Which of the following must you do? A. Declare that your class implements java.lang.Runnable. B. Override run(). C. Override start(). D. Make sure that all access to all data is via synchronized methods. Answer: B ================================================================================ =============================== chapter8 ================================ 1. Given a string constructed by calling s = new String(xyzzy), which of the calls modifies the string? A. s.append(aaa); B. s.trim(); C. s.substring(3); D. s.replace(z, a); E. s.concat(s);

F. None of the above Answer: F 2. Which one statement is true about the following code? 1. String s1 = abc + def; 2. String s2 = new String(s1); 3. if (s1 == s2) 4. System.out.println(== succeeded); 5. if (s1.equals(s2)) 6. System.out.println(.equals() succeeded); A. Lines 4 and 6 both execute. B. Line 4 executes and line 6 does not. C. Line 6 executes and line 4 does not. D. Neither line 4 nor line 6 executes. Answer: C 3. Suppose you want to write a class that offers static methods to compute hyper bolic trigonometric functions. You decide to subclass java.lang.Math and provide the new functionali ty as a set of static methods. Which one statement is true about this strategy? A. The strategy works. B. The strategy works, provided the new methods are public. C. The strategy works, provided the new methods are not private. D. The strategy fails because you cannot subclass java.lang.Math. E. The strategy fails because you cannot add static methods to a subclass. Answer: D 4. Which one statement is true about the following code fragment? 1. import java.lang.Math; 2. Math myMath = new Math(); 3. System.out.println(cosine of 0.123 = + 4. myMath.cos(0.123)); A. Compilation fails at line 2. B. Compilation fails at line 3 or 4. C. Compilation succeeds, although the import on line 1 is not necessary. During execution, an exception is thrown at line 3 or 4. D. Compilation succeeds. The import on line 1 is necessary. During execution, an exception is thrown at line 3 or 4. E. Compilation succeeds and no exception is thrown during execution. Answer: A 5. Which one statement is true about the following code fragment? 1. String s = abcde; 2. StringBuffer s1 = new StringBuffer(abcde); 3. if (s.equals(s1)) 4. s1 = null; 5. if (s1.equals(s)) 6. s = null; A. Compilation fails at line 1 because the String constructor must be called exp licitly. B. Compilation fails at line 3 because s and s1 have different types. C. Compilation succeeds. During execution, an exception is thrown at line 3. D. Compilation succeeds. During execution, an exception is thrown at line 5. E. Compilation succeeds. No exception is thrown during execution. Answer: E 6. In the following code fragment, after execution of line 1, sbuf references an

instance of the StringBuffer class. After execution of line 2, sbuf still references the same in stance. 1. StringBuffer sbuf = new StringBuffer(abcde); 2. sbuf.insert(3, xyz); A. True B. False Answer: A 7. In the following code fragment, after execution of line 1, sbuf references an instance of the StringBuffer class. After execution of line 2, sbuf still references the same in stance. 1. StringBuffer sbuf = new StringBuffer(abcde); 2. sbuf.append(xyz); A. True B. False Answer: A 8. In the following code fragment, line 4 is executed. 1. String s1 = xyz; 2. String s2 = xyz; 3. if (s1 == s2) 4. System.out.println(Line 4); A. True B. False Answer: A 9. In the following code fragment, line 4 is executed. 1. String s1 = xyz; 2. String s2 = new String(s1); 3. if (s1 == s2) 4. System.out.println(Line 4); A. True B. False Answer: B 10. Suppose prim is an int and wrapped is an Integer. Which of the following are legal Java statements? (Choose all that apply.) A. prim = wrapped; B. wrapped = prim; C. prim = new Integer(9); D. wrapped = 9; Answer: A,B,C,D 11. Which of the following are legal? (Choose all that apply.) A. List<String> theList = new Vector<String>; B. List<String> theList = new Vector<String>(); C. Vector <String> theVec = new Vector<String>; D. Vector <String> theVec = new Vector<String>(); Answer: B,D 12. Given the following, Map<String> names = new HashMap<String>(); which of the following are legal? (Choose all that apply.) A. Iterator<String> iter = names.iterator(); B. for (String s:names) C. while (String s:names) Answer: A,B

13. Which of the following are legal clone() methods in a class called Q13 that extends Object? A. public Object clone() { return super.clone(); } B. public Object clone() throws CloneNotSupportedException { return super.clone(); } C. public Q13 clone() { return (Q13)super.clone(); } D. public Q13 clone() throws CloneNotSupportedException { return (Q13)super.clone(); } Answer: B. public Object clone(),D. public Q13 clone() 14. Which of the following classes implement java.util.List? A. java.util.ArrayList B. java.util.HashList C. java.util.StackList D. java.util.Stack Answer: A,D 15. Which of the following are methods of the java.util.SortedSet interface? A. first B. last C. headSet D. tailSet E. subSet Answer: A,B,C,D,E 16. Which of the following are methods of the java.util.SortedMap interface? A. first B. last C. headMap D. tailMap E. subMap Answer: C,D,E 17. Which line of code tells a scanner called sc to use a single digit as a deli miter? A. sc.useDelimiter(d); B. sc.useDelimiter(\d); C. sc.useDelimiter(\\d); D. sc.useDelimiter(d+); E. sc.useDelimiter(\d+); F. sc.useDelimiter(\\d+); Answer: C 18. What happens when you try to compile and run this application? 1. import java.util.*; 2. 3. public class Apple { 4. public static void main(String[] a) { 5. Set<Apple> set = new TreeSet<Apple>(); 6. set.add(new Apple()); 7. set.add(new Apple()); 8. set.add(new Apple()); 9. } 10. } A. Compiler error. B. An exception is thrown at line 6. C. An exception is thrown at line 7. D. An exception is thrown at line 8.

E. No exception is thrown. Answer: C 19. Given arrays a1 and a2, which call returns true if a1 and a2 have the same l ength, and a1[i].equals(a2[i]) for every legal index i? A. java.util.Arrays.equals(a1, a2); B. java.util.Arrays.compare(a1, a2); C. java.util.List.compare(a1, a2); D. java.util.List.compare(a1, a2); Answer: a 20. Which of the following statements are true? A. StringBuilder is generally faster than StringBuffer. B. StringBuffer is generally faster than StringBuilder. C. StringBuilder is threadsafe; StringBuffer is not. D. StringBuffer is threadsafe; StringBuilder is not. Answer: a,d,e ================================================================================ =============================== CHAPTER 9 ===================== 13. Suppose class A extends Object; class B extends A; and class C extends B. Of these, only class C implements java.io.Serializable. Which of the following must be true in order to avoid an exception during deserialization of an instance of C? A. A must have a no-args constructor. B. B must have a no-args constructor. C. C must have a no-args constructor. D. There are no restrictions regarding no-args constructors. Answer: B must have a no-args constructor. 14. Suppose class A extends Object; Class B extends A; and class C extends B. Of these, only class C implements java.io.Externalizable. Which of the following must be true in order to avoid an exception during deserialization of an instance of C? A. A must have a no-args constructor. B. B must have a no-args constructor. C. C must have a no-args constructor. D. There are no restrictions regarding no-args constructors. Answer: c must have a no-args constructor. 15. Given the following class: public class Xyz implements java.io.Serializable { public int iAmPublic; private int iAmPrivate; static int iAmStatic; transient int iAmTransient; volatile int iAmVolatile; . . . } Assuming the class does not perform custom serialization, which fields are writt en when an instance of Xyz is serialized? (Choose all that apply.) A. iAmPublic B. iAmPrivate C. iAmStatic

D. iAmTransient E. iAmVolatile Answer: A. iAmPublicz,B. iAmPrivate,E. iAmVolatile 19. Which of the following are valid mode strings for the RandomAccessFile const ructor? (Choose all that apply.) A. r B. ro C. rw D. rws E. rwd Answer: A. r C. rw D. rws E. rwd 20. Which of the following are valid arguments to the DataInputStream constructo r? A. File B. FileReader C. FileInputStream D. RandomAccessFile Answer:C. FileInputStream //////////// practical 50 cau ================================practical 50 cau================================ =================================== 1. Given the following: public enum Wallpaper { BROWN, BLUE, YELLOW; } Which of the following are legal? A. enum PatternedWallpaper extends Wallpaper { STRIPES, DOTS, PLAIN; } B. Wallpaper wp = Wallpaper.BLUE; C. Wallpaper wp = new Wallpaper(Wallpaper.BLUE); D. void aMethod(Wallpaper wp) { System.out.println(wp); } E. int hcode = Wallpaper.BLUE.hashCode(); Answer:B.Wallpaper wp = Wallpaper.BLUE;D.void aMethod(Wallpaper wp) {System.out. println(wp);},E.int hcode = Wallpaper.BLUE.hashCode(); 2. Given the following: package pack; class Sploo { public int a; public static int b; int c; static int d; public void eee() { } public static void fff() { } }

Which of the following features of class Sploo may be accessed by a class, in package pack , as a result of the following import? import static pack.Sploo.*; A. a B. b C. c D. d E. eee() F. fff() Answer:b,d,fff() 3. Given the following: public abstract class Abby { abstract provideMe(); } public class SubAbby extends Abby { } Which statements are true? A. Abby generates a compiler error. B. Sub Abby generates a compiler error. C. If Sub Abby were declared abstract, it would compile without error. D. If SubAbby were declared abstract, it could be instantiated. E. Abby is a legal type for variables. Answer:B.Sub Abby generates a compiler error,C.If Sub Abby were declared abstrac t, it would compile without error,E.Abby is a legal type for variables 4. Given the following code: class Xxx { int[] ages; int[] heights = new int[10]; } A.Which statements are true? B.ages is initialized to null. C.ages is initialized to a reference to an array with zero elements. D.heightsis initialized tonull.

E.heightsis initialized to a reference to an array with zero elements. F.heightsis initialized to a reference to an array with 10 elements. Answer:A.Which statements are true?E.heightsis initialized to a reference to an array with zero elements. 5. Given a class with a public variable theTint of type Color , which of the following methods are consistent with the JavaBeans naming standards? A. public Color getColor() B. public Color getTint() C. public Color getTheTint() D. public Color gettheTint() E. public Color get_theTint() Answer:C. public Color getTheTint() 6. Which of the following statements are true regarding the following method? void callMe(String names) { } A.It doesnt compile. B.Within the method,names is an array containing Strings. C.Within the method, names is a list containing Strings. D.The method may be called only from within the enclosing class. Answer:B.Within the method,names 7. Given the following: public class Food { } public class Fruit extends Food { } public class Citrus extends Fruit { } public class Pomelo extends Citrus { } public class SuperDuper { public Fruit feedMe() { return new Fruit(); } } public class Subby extends SuperDuper { public ????? feedMe() { return new Pomelo (); } } Which of the following are legal return types for feedMe() in class Subby ? A. Object B. Food C.

Fruit D. Citrus E. Pomelo Answer:C.Fruit D.Citrus E.Pomelo 8. Given the following class: class A extends java.util.Vector { private A(int x) { super(x); } } Which statements are true? A. The compiler creates a default constructor with public access. B. The compiler creates a default constructor with protected access. C. The compiler creates a default constructor with default access. D. The compiler creates a default constructor with private access. E. The compiler does not create a default constructor. Answer:E.The compiler does not create a default constructor. 9. Which of the following types are legal arguments of a switch statement? A.enums B.bytes C. longs D. floats E. strings Answer:A.enums B.bytes 10. Given the following: int[] ages = { 9, 41, 49 }; int sum = 0; Which of the following are legal ways to add the elements of the array? A. for (int i=0; i<ages.length; i++) sum += ages[i]; B. for (int i=0; i<=ages.length; i++) sum += ages[i]; C. for (int i:ages) sum += i; D. sum += ages[int i:ages]; Answer:A. for (int i=0; i<ages.length; i++)sum += ages[i];C. for (int i:ages)sum += i; 11. Which lines check compile time and runtime. A. assert x == 4; B. assert x != 4; C. assert x == 4 : x D. assert x != 4 : x Answer:A. assert x == that x is equal to four? Assume assertions are enabled at

is not 4; is not 4; 4;C. assert x == 4 : x is not 4;

12. Which are appropriate uses of assertions?

A. Checking preconditions in a private method B. Checking postconditions in a private method C. Checking preconditions in a public method D. Checking postconditions in a public method Answer:A. Checking preconditions in a private method,B. Checking postconditions in a private method,D. Checking postconditions in a public method 13. EOFException and ObjectStreamException both extend IOException. NotSerializa bleException extends ObjectStreamException. AWTException does not extend any of the se. All are checked exceptions. Suppose class AClass has a method callMe() whose declara tion is void callMe() throws ObjectStreamException Which of the following may appear in a subclass of AClass? A. void callMe() B. void callMe() throws IOException C. void callMe() throws NotSerializableException D. void callMe() throws ObjectStreamException, AWTException Answer:A. void callMe(),C. void callMe()throws NotSerializableException 14. ObjectStreamException extends IOException. NotSerializableException extends ObjectStreamException. AWTException does not extend any of these. All are checke d exceptions. The callMe() method throws NotSerializableException.What does the following code print out? Choose all lines that are printed. try { callMe(); System.out.println(I threw); } catch (ObjectStreamException x) { System.out.println(Object stream); } catch (IOException x) { System.out.println(IO); } catch (Exception x) { System.out.println(Exception); } finally { System.out.println(Finally); } A. I threw B. Object Stream C. IO D. Exception E. Finally Answer:B. Object Stream,E. Finally 15. While testing some code that you are developing, you notice that an ArrayInd exOutOfBoundsException is thrown. What is the appropriate reaction? A. Enclose the offending code in a try block, with a catch block for ArrayIndexOutOfBoundsException that does nothing. B. Enclose the offending code in a try block, with a catch block for ArrayIndexOutOfBoundsException that prints out a descriptive message. C. Declare that the method that contains the offending code throws

ArrayIndexOutOfBoundsException. D. None of the above. Answer:D. None of the above. 16. How is IllegalArgumentException used? (Choose all correct options.) A. It is thrown by the JVM when a method is called with incompatible argument ty pes. B. It is thrown by the JVM to indicate arithmetic overflow. C. It is thrown by certain methods of certain core Java classes to indicate that preconditions have been violated. D. It should be used by programmers to indicate that preconditions of public met hods have been violated. E. It should be used by programmers to indicate that preconditions of nonpublic methods have been violated. Answer:C. It is thrown by certain methods of certain core Java classes to indica te that preconditions have been violated.D. It should be used by programmers to indicate that preconditions of public methods have been violated. 17. Suppose shorty is a short and wrapped is a Short. Which of the following are legal Java statements? (Choose all correct options.) A. shorty = wrapped; B. wrapped = shorty; C. shorty = new Short((short)9); D. shorty = 9; Answer:a,b,c,d all of 18. Which of the following statements are true? (Choose all correct options.) A. StringBuilder encapsulates a mutable string. B. StringBuilder is threadsafe. C. StringBuffer is threadsafe. D. StringBuffer is generally faster than StringBuilder. Answer:A. StringBuilder encapsulates a mutable string.C. StringBuffer is threads afe. 19. Suppose you know that a file named aaa was created by a Java program that us ed a DataOutputStream. The file contains 10 doubles, followed by a UTF string. Which of the following code snippets read the string correctly? Assume all code exists in an environment that legally handles IOException. (Choose all correct options.) A. RandomAccessFile raf = new RandomAccessFile("aaa", "r"); for (int i=0; i<10; i++) raf.readDouble(); String s = raf.readUTF(); B. RandomAccessFile raf = new RandomAccessFile("aaa", "r"); raf.seek(10*8); String s = raf.readUTF(); C. FileReader fr = new FileReader(fr); for (int i=0; i<10*8; i++) fr.read(); String s = fr.readUTF(); D. FileInputStream fis = new FileInputStream(aaa); DataInputStream dis = new DataInputStream(fis);

for (int i=0; i<10; i++) dis.readDouble(); String s = dis.readUTF(); E. FileInputStream fis = new FileInputStream(aaa); DataInputStream dis = new DataInputStream(fis); dis.seek(10*8); String s = dis.readUTF(); Answer:A. RandomAccessFile raf = new RandomAccessFile("aaa", "r");for (int i=0; i<10; i++)raf.readDouble();B.RandomAccessFile raf =new RandomAccessFile("aaa", " r");raf.seek(10*8);D. FileInputStream fis = new FileInputStream(aaa);DataInputStre am dis = new DataInputStream(fis);for (int i=0; i<10; i++)dis.readDouble(); String s = dis.readUTF(); 20. Suppose you want to read a file that was not created by a Java program. The file contains lines of 8-bit text, and the 8-bit encoding represents the local character set, as rep resented by the current default locale. The lines are separated by newline characters. Which strategy re ads the file and produces Java strings? A. Create a RandomAccessFile instance and use its readText() method. B. Create a RandomAccessFile instance and use its readUTF() method. C. Create a FileReader instance. Pass it into the constructor of LineNumberReade r. Use LineNumberReaders readLine() method. D. Create a FileInputStream instance. Pass it into the constructor of LineNumber Reader. Use LineNumberReaders readLine() method. E. Create a FileInputStream instance. Pass it into the constructor of DataInputS tream. Use DataInputStreams readLine() method. Answer:C. Create a FileReader instance. Pass it into the constructor of LineNumb erReader. Use LineNumberReaders readLine() method. 21. What interfaces can be implemented in order to create a class that can be se rialized? (Choose all that apply.) A. No interfaces need to be implemented. All classes can be serialized. B. Have the class declare that it implements java.io.Serializable. There are no methods in the interface. C. Have the class declare that it implements java.io.Serializable, which defines two methods: readObject and writeObject. D. Have the class declare that it implements java.io.Externalizable, which defin es two methods: readObject and writeObject. E. Have the class declare that it implements java.io.Externalizable, which defin es two methods: readExternal and writeExternal Answer:B. Have the class declare that it implements java.io.Serializable. There are no methods in the interface,E. Have the class declare that it implements jav a.io.Externalizable, which defines two methods: readExternal and writeExternal 22. Suppose you are writing a class that will provide custom deserialization. Th e class implements java.io.Serializable (not java.io.Externalizable). What access mode should the readObject() method have? A. public

B. protected C. default D. private Answer:D. private 23. Suppose you want to create a class that compiles and can be serialized and d eserialized without causing an exception to be thrown. Which statements are true regarding the class ? (Choose all correct options.) A. If the class implements java.io.Serializable and does not implement java.io.Externalizable, it must have a no-args constructor. B. If the class implements java.io.Externalizable, it must have a no-args constr uctor. C. If the class implements java.io.Serializable and does not implement java.io.Externalizable, its nearest superclass that doesnt implement Serializable must have a no-args constructor. D. If the class implements java.io.Externalizable, its nearest superclass that d oesnt implement Externalizable must have a no-args constructor. Answer:B. If the class implements java.io.Externalizable, it must have a no-args constructor.C. If the class implements java.io.Serializable and does not implem ent java.io.Externalizable, its nearest superclass that doesnt implement Serializ able must have a no-args constructor. 24. Suppose you want to use a DateFormat to format an instance of Date. What fac tors influence the string returned by DateFormats format() method? A. The operating system B. The style, which is one of SHORT, MEDIUM, or LONG C. The style, which is one of SHORT, MEDIUM, LONG, or FULL D. The locale Answer:C. The style, which is one of SHORT, MEDIUM, LONG, or FULL,D. The locale 25. How do you generate a string representing the value of a float f in a format appropriate for a locale loc? A. NumberFormat nf = NumberFormat.getInstance(loc); String s = nf.format(f); B. NumberFormat nf = new NumberFormat(loc); String s = nf.format(f); C. NumberFormat nf = NumberFormat.getInstance(); String s = nf.format(f, loc); D. NumberFormat nf = new NumberFormat(loc); String s = nf.format(f, loc); Answer:A. NumberFormat nf =NumberFormat.getInstance(loc);String s = nf.format(f) ; 26. Given the following code: 1. String scanMe = aeiou9876543210AEIOU; 2. Scanner scanner = new Scanner(scanMe); 3. String delim = ?????; // WHAT GOES HERE? 4. scanner.useDelimiter(delim); 5. while (scanner.hasNext()) 6. System.out.println(scanner.next()); What code at line 3 produces the following output?

aeiou AEIOU A. String B. String C. String D. String E. String F. String Answer:C.

delim = d+; delim = \d+; delim = \\d+; delim = d*; delim = \d*; delim = \\d*; String delim = \\d+;

27. Which line prints double d in a left-justified field that is 20 characters w ide, with 15 characters to the right of the decimal point? A. System.out.format("%20.5f", d); B. System.out.format("%20.15f", d); C. System.out.format("%-20.5f", d); D. System.out.format("%-20.15f", d); Answer:D. System.out.format("%-20.15f", d); 28. Suppose MyThread extends java.lang.Thread, and MyRunnable implements java.la ng .Runnable (but does not extend Thread). Both classes have no-args constructors. Which of the following cause a thread in the JVM to begin execution? (Choose all correct opti ons.) A. (new MyThread()).start(); B. (new MyThread()).run(); C. (new MyRunnable()).run(); D. (new Thread(new MyRunnable())) E. .start(); Answer:A. (new MyThread()).start();D. (new Thread(new MyRunnable())) 29. What will be the outcome when the following application is executed? public class ThreadTest { public void newThread() { Thread t = new Thread() { public void run() { System.out.println("Going to sleep"); try { sleep(5000); } catch (InterruptedException e) {} System.out.println("Waking up"); } }; t.start(); try { t.join(); } catch (InterruptedException e) {} System.out.println("All done"); } public static void main(String [] args) { new ThreadTest().newThread(); } } A. The code prints Going to sleep, then Waking up, and then All done. B. The code prints All done, then Going to sleep, and then Waking up. C. The code prints All done only. D. The code prints Going to sleep and then Waking up. E. The code does not compile. Answer:A. The code prints Going to sleep, then Waking up, and then All done.

30. Given the following class: class Classy { synchronized void notStaticMethod() { for (long n=0; n<100000000000L; n++) System.out.println(n); } synchronized static void staticMethod() { for (long n=0; n<100000000000L; n++) System.out.println(n); } } Suppose thread A and thread B both have references to each of two instances of C lassy. These references are named classy1 and classy2. Which statements are true? (Choose all correct options.) A. If thread A is executing classy1.staticMethod(), then thread B may not execut e classy1.staticMethod(). B. If thread A is executing classy1.staticMethod(), then thread B may not execut e classy2.staticMethod(). C. If thread A is executing classy1.notStaticMethod(), then thread B may not exe cute classy1.staticMethod(). D. If thread A is executing classy1.notStaticMethod(), then thread B may not exe cute classy1.notStaticMethod(). E. If thread A is executing classy1.notStaticMethod(), then thread B may not exe cute classy2.notStaticMethod(). Answer:A. If thread A is executing classy1.staticMethod(), then thread B may not execute classy1.staticMethod().B. If thread A is executing classy1.staticMethod (), then thread B may not execute classy2.staticMethod(),D. If thread A is execu ting classy1.notStaticMethod(), then thread B may not execute classy1.notStaticMethod(). 31. Suppose threads aThread and bThread are both accessing a shared object named sharedOb, and aThread has just executed: sharedOb.wait(); What code can bThread execute in order to get aThread out of the waiting state, no matter what other conditions prevail? A. aThread.notify(); B. aThread.notifyAll(); C. aThread.interrupt(); D. sharedOb.notify(); E. sharedOb.notifyAll(); Answer:C. aThread.interrupt();E. sharedOb.notifyAll(); 32. Suppose class Car has public variables forceOnGasPedal and forceOnBrakePedal , and a public method respondToPedalChanges(). Class Driver manipulates an instance of C ar by changing the variables and then calling the method. Which statements are true? ( Choose all that apply.) A. The Car and Driver classes are loosely coupled.

B. The Car and Driver classes are tightly coupled. C. This degree of coupling is desirable. D. This degree of coupling is undesirable. Answer:B. The Car and Driver classes are tightly coupled,D. This degree of coupl ing is undesirable. 33. Suppose class Home has methods chopWood() and carryWater(); it also has a me thod called chopWoodAndCarryWater(), which just calls the other two methods. Which statement s are true? (Choose all that apply.) A. chopWoodAndCarryWater() is an example of appropriate cohesion. B. chopWoodAndCarryWater() is an example of inappropriate cohesion. C. chopWoodAndCarryWater() is an example of appropriate coupling. D. chopWoodAndCarryWater() is an example of inappropriate coupling. Answer:B. chopWoodAndCarryWater() is an example of inappropriate cohesion. 34. Suppose class Lemon extends class Citrus. Given the following code: Lemon lem = new Lemon(); Citrus cit = new Citrus(); Which lines compile without error? (Choose all that apply.) A. lem = cit; B. cit = lem; C. lem = (Lemon)cit; D. cit = (Citrus)lem; E. cit = (Object)lem; Answer:B. cit = lem; C. lem = (Lemon)cit; D. cit = (Citrus)lem; 35. Suppose classes Lemon and Grapefruit extend class Citrus. Which statements a re true regarding the following code? 1. Grapefruit g = new Grapefruit(); 2. Citrus c = (Citrus)g; 3. Lemon lem = (Lemon)c; A. The cast in line 2 is not necessary. B. Line 3 causes a compiler error. C. The code compiles, and throws an exception at line 3. D. The code compiles and runs without throwing any exceptions. Answer:A. The cast in line 2 is not necessary,C. The code compiles, and throws a n exception at line 3. 36. Suppose class aaa.Aaa has a method called callMe(). Suppose class bbb.Bbb, w hich extends aaa.AAA, wants to override callMe(). Which access modes for callMe() in aaa.AAA will allow this? A. public B. protected C. default D. private Answer:A. public,B. protected 37. What happens when you try to compile the following code and run the Zebra ap plication? class Animal { float weight; Animal(float weight) { this.weight = weight; } }

class Zebra extends Animal { public static void main(String[] args) { Animal a = new Animal(222.2f); Zebra z = new Zebra(); } } A. Class Animal generates a compiler error. B. Class Zebra generates a compiler error. C. The code compiles without error. The application throws an exception when the Animal constructor is called. D. The code compiles without error. The application throws an exception when the Zebra constructor is called. E. The code compiles and runs without error. Answer:B. Class Zebra generates a compiler error. 38. Given the following code: 1. class Xyz { 2. float f; 3. Xyz() { 4. ??? // What goes here? 5. } 6. Xyz(float f) { 7. this.f = f; 8. } 9. } What code at line 4 results in a class that compiles? A. super(); B. this(1.23f); C. this(1.23f); super(); D. super(1.23f); this(1.23f); Answer:A. super();B. this(1.23f); 39. What relationship does the extends keyword represent? A. is a B. has a C. Polymorphism D. Multivariance E. Overloading Answer:A. is a 40. When should objects stored in a Set implement the java.util.Comparable inter face? A. Always B. When the Set is generic C. When the Set is a HashSet D. When the Set is a TreeSet E. Never Answer:D. When the Set is a TreeSet 41. Given the following class: class Xyzzy { int a, b; public boolean equals(Object x) { Xyzzy that = (Xyzzy)x; return this.a == that.a; } Which methods below honor the hash code contract? A. public int hashCode() { return a; }

B. public int hashCode() { return b; } C. public int hashCode() { return a+b; } D. public int hashCode() { return a*b; } E. public int hashCode() { return (int)Math.random(); } Answer:A. public int hashCode() { return a; },E. public int hashCode() { return (int)Math.random();} 42. Give the following declarations: Vector plainVec; Vector<String> fancyVec; If you want a vector in which you know you will only store strings, what are the advantages of using fancyVec rather than plainVec? A. Attempting to add anything other than a string to fancyVec results in a compi ler error. B. Attempting to add anything other than a string to fancyVec causes a runtime e xception to be thrown. C. Attempting to add anything other than a string to fancyVec causes a checked e xception to be thrown. D. Adding a string to fancyVec takes less time than adding one to plainVec. E. The methods of fancyVec are synchronized. Answer:A. Attempting to add anything other than a string to fancyVec results in a compiler error. 43. The declaration of the java.util.Collection interface is interface Collection <E> The addAll() method of that interface takes a single argument, which is a refere nce to a collection whose elements are compatible with E. What is the declaration of the addAll() method? A. public boolean addAll(Collection c) B. public boolean addAll(Collection c extends E) C. public boolean addAll(Collection ? extends E) D. public boolean addAll(Collection<? extends E> c) Answer:D. public boolean addAll(Collection<? extends E> c) 44. The java.util.Arrays class has a binarySearch(int[] arr, int key) method. Wh ich statements are true regarding this method? (Choose all that apply.) A. The method is static. B. The return value is the index in the array of key. C. The elements of the array must be sorted when the method is called. D. After the method returns, the elements of the array are sorted, even if they werent sorted before the call. Answer:A. The method is static, B. The return value is the index in the array of key,C. The elements of the array must be sorted when the method is called.

45. Given the following class: package ocean; public class Fish { protected int size; protected void swim() { } } Which of the following may appear in a subclass of Fish named Tuna that is not i n the ocean package? A. void swim() { } B. public void swim() { } C. size = 12; D. (new Tuna()).size = 12; Answer:B. public void swim() { },C. size = 12; 46. Given the following class: public class App { public static void main(String[] args) { System.out.println(args.length); } } Assuming App.class is stored in an appropriate location in file appjar.jar, what is printed when you type the following command line? java -cp appjar.jar -ea App 1 2 3 4 A. 4 B. 5 C. 6 D. 7 E. 8 F. 9 Answer:A. 4 47. Given the following classes: public class Wrapper { public int x; } public class Tester { private static void bump(int n, Wrapper w) { n++; w.x++; } public static void main(String[] args) { int n = 10; Wrapper w = new Wrapper(); w.x = 10; bump(n, w); // Now what are n and w.x? } } When the application runs, what are the values of n and w.x after the call to bu mp() in the main() method? A. n is 10, w.x is 10 B. n is 11, w.x is 10 C. n is 10, w.x is 11 D. n is 11, w.x is 11 Answer:C. n is 10, w.x is 11 48. When does the string created on line 2 become eligible for garbage collectio

n? 1. String s = aaa; 2. String t = new String(s); 3. t += zzz; 4. t = t.substring(0); 5. t = null; A. After line 3 B. After line 4 C. After line 5 D. The string created on line 2 does not become eligible for garbage collection in this code. Answer:A. After line 3 49. Suppose you want to run the following command line on a Windows system: java -classpath somewhere;elsewhere aaa.bbb.MyApplication On a Unix system the command line would be: java -classpath somewhere:elsewhere aaa.bbb.MyApplication Assume the CLASSPATH variable is not set. Which must be true in order for the ap plication to run? A. Class MyApplication must contain the statement package aaa.bbb;. B. Class MyApplication must be in a directory named aaa and must contain the sta tement package bbb;. C. Class MyApplication must contain either the statement package somewhere.aaa.b bb; or the statement package elsewhere.aaa.bbb;. D. The file MyApplication.class must be found either in somewhere\aaa\bbb or in elsewhere\aaa\bbb. (Substitute forward slashes for backslashes on a Unix system. ) Answer:A. Class MyApplication must contain the statement package aaa.bbb;D. The file MyApplication.class must be found either in somewhere\aaa\bbb or in elsewhe re\aaa\bbb. (Substitute forward slashes for backslashes on a Unix system 50. What is -15 % -10? A. 0 B. 5 C. 10 D. -5 E. -10 Answer:D. -5 //////////////////////////// ================================29/05/2010==============file anh================ ===== cai nay 29/05/2010 two topmost abstract classes for character streams are and answer: java.io.reader, jva.io.writer suppose that a, b, c are classes in which b is a subclass of a. study the follow ing declarations answer: objA=objB to read/write objects from/to a file as object streams, the class declaration of these objects must implement the marker interface answer: java.io.seriallzable in multi-processing system, answer: each process usually accesses its own data which of the following statement is correct about card layout answer: card layout arranges component by diving frame into spaces called card

which method is not a member the object class answer: waitAII() a method is implemented in a super class can not be overridden in derived classe s answer: final study the following java statements answer: 1,17 what is not a comparison operator answer: >> the re-use code ability is a result of the in oop answer: inheritance which of the following statements is correct about flow layout answer: the flow layout arranges components in horizontal rows In swing, what is the role of the components model answer: it is responsible for the data that the component presents to the users a reference variable can not be answer: an integral value which of the following statements is correct regarding type 4 jdbc driver (nativ e protocol) answer: it help the java applications communicate directly with the database usi ng java sockets consider the following declaration answer: it means the file can be opened for both reading and writing, and any ch anges to the files content, but not its metadata, will take place immediately suppose that the current position of a resultset, named rs, is at the last recor d, the statement rs.next() will return answer: false in java, answer: we use the interface keyword to declare an interface a java source code is a file with the file extension is answer: java the try catch statements must be used to contain statements that answer: may cause checked exceptions 31. To traverse elements in a set, one after one element, the java.utl....interf ace mus be use a.set b.list c.map d.Iterator Answer: Set 33. int x=32; x = x >>2; int y= x++

System.out.println(y); Answer: 8 34. Which of the following statement is correct about Thread? Answer: We cannot restart a dead thread by calling its star() or run() methods. 35.One off the difference about List and Sets Answer:A list can contain duplicate items but a set can not. 36. Which of the following statement is correct about object serialization? Answer: Transient fields are not serialized. 37. which statement is correct about protected modifier? Answer: Only variables and methods may be declared as protect members. 38.What is the role of RMI registry? Answer: The RMI registry is a program that associates names with RMI servies. 39.A method in a super class is implemented using the default modifier this meth od can not be overridden in subclasses using the... modifier. Answer : private 40.when a thread begin waiting an IO operation, it enters the ..... state. Answer: ready 42.A java source code will be compiled to the file extension is..... Answer: .class 43 With respect to steps in RMI implementation. (1) Create the remote interface (2) Create the remote object (3) Create the client object (4) Create the Stub Answer:(1) Create the remote interface (2) Create the remote object (4) Create t he Stub (3) Create the client object 44.Study the following Java statements. String s1="Hello"; String s2="Hello"; String s3="Hello"; Answer: There is only one string is stored in memory of the program 45 The .... class makes unilities to write platform-indeoendent code that examin es and manipulates folders. Answer: java.iso.File 46. int x=12; x=x<<2; int y=x++; System.out.println(x+y);

Answer: 97 47. Suppose that we have a combobox that contains a list of data. The combobox can only display to the user one item at a time. In term of Model-Wiew-Controlle r, which of the follwing statement is correct? Answer: The list of data combobox can be considered as a representative of the M odel. 48. Select incorrect statements about ServerSocket class (choose 1) Answer: A server socket, on the other hand, makes itselt available and then wait s for clients to intiate connection.

49._____________ drivers that implement the JDBC API as a mapping to another dat a access API, such as ODBC.Drivers of this type are generally dependent on a nat ive library, which linits their portability Answer: type 1 ============================================================================ nhu ng cau trong file anh ================ 1. The initial designed GUI : Centrel Panel jComboBox1 The result GUI will be Exam: Center Panel E01-Hoa, E02-Tuan Exam: Center Panel Hoa, Tuan Choose one answer a. 1 b. None of the others c. 2 Answer:1 2. import javax.swing.*; import java.awt.BorderLayour; public class NewJFrame1 extends javax.swing.JFrame { public NewJFrame1 () { init Components(); this.setSize(100,100); JPanel p = new JPanel (new BorderLayout()); this.add(p); for (int i = 0; i<10; i++) { JButton b = new JButton(b + i); p.add(b); } } Choose one answer a. 1 b. 0 c. 10 d. None of the others e. 5 Answer:10 3. Code for Mouse Even Handlers

private void jComboBoxMouseEntered(java.awt.event.MouseEvent evt) { JOptionPane.showMessageDialog(this,Hm); } private void jComboBoxMouseClicked(java.awt.event.MouseEvent evt) { JOptionPane.showMessageDialog(this,Ha); } Choose one answer a. User receives the message Hm when he/she clicks the combobox b. User receives the two messages, Hm the Ha, when he/she clicks the comboBox c. User receives the message Ha when he/she clicks the comboBox d. User receives two messages, Ha then Hm, when he/she clicks the comboBox e. User may not be able to click the comboBox Answer:User receives the two messages, Hm the Ha, when he/she clicks the comboBox 4. Choose one answer (1) The java.io. class makes it easier to write platform-independent code tha t examines and manipulates files

(2) The java.io class makes it easier to write platform-independent code that examines and manipulates folders a. File, container b. File, folder c. File, file d. None of the others e. File, Directory Answer:File, file 5. public class Hello { public static void main(String[] args) { int i = -1; System.out.println(i>>5); System.out.println(4&3); System.out.println(4|3); }

} Choose one answer a. The output is 103 b. The output is -107 c. The output is 107 d. None of the others e. The output is -103 Answer:The output is -107 6. import java.io.*; public class Exam1 { public static void main(String[] args) { File f = new File(f1.txt); FileReader fr = new FileReader(f); BufferReader br = new BufferedReader(fr); String S = ; while ((S=br.readLine())!=null) System.out.println(br); } } Choose one answer a. an error is thrown when it is compiled b. The program executes with no output c. None of the other d. The program will print the content of the f1.txt file to the screen Answer:an error is thrown when it is compiled 7. With respect to the java.sql.Statement interface (1) When we need retrieving data from a table of a database, the method of th e Statement interface should be used (2) When we need update data in a table of a database, the method of the Stat ement interface should be used Choose one answer a. executeUpdate(), executeQuery() b. update(), query() c. executeQuery(), executeUpdate() d. None of the others e. query(), update() Answer:executeQuery(), executeUpdate() 8. a. b. The top interface of Java Collection Framework is Collection Map

c. Set d. List e. All of the others Answer:All of the others 9. If we want to store a group of different elements in ascending order, th e java.util class should be used a. ArrayList b. SortedSet c. Vector d. HashSet e. HashMap Answer:SortedSet 10. Select correct statement (1) 12 buttons can not be added to a container which is assigned to a grid l ayout 2x5 (2) If 2 components are added to the center region of a border-layout contai ner, they will be seen by user as side-by-side components Choose one answer a. 1 b. 2 c. None of the others d. 2, 1 Answer:None of the others 11. If the following code is executed. What is the output int[] a = {1,2,3,4}; System.out.println(a[6]); Choose one answer a. ArrayIndexOutOfBoundException b. 0 c. A non-predictable value d. A compiler-time exception because they must be put in the try catch bloc k Answer:A compiler-time exception because they must be put in the try catch block 12. Select correct statement(s) (1) A process has a self-contained execution environment (2) A sub-thread has a self-contained execution environment (3) Programmers can schedule sub-threads of a program a. 1, 2, 3 b. None of the other c. 2 d. 2, 3 e. 1, 2 f. 1 Answer:1, 2, 3 13. Choose one answer a. It will show a clock in the jLabel1 b. The program cause errors when it is compiled c. It will show a full-formatted current date in the jLabel1 d. It will show nothing e. None of the others Answer:It will show a clock in the jLabel1 14. (1) (2) Select correct statement(s) The Swings list component (JList) can display text only The Swings button (JButton) can not contain an image

(3)

The Swings label (JLabel) can present an image

Choose one answer a. 1, 3 b. 2, 3 c. 3 d. 1 e. None of the others Answer:3 15. With respect to networking and the client-server model (1) A socket is one endpoint (a combination of an IP address and a port numb er) of a two-way communication link between two programs running on the network (2) TCP (Transimission Control Protocol) is a connection-based protocol that provides a reliable flow of data between two computers (3) UDP (User Datagram Protocol) is a protocol that sends independent packet s of data, called datagrams, from one computer to another with no guarantees abo ut arrival Choose one answer a. True, true , false b. True, false, true c. True, true, true d. False, true, true e. None of the other Answer:True, true, true 16. Two sub-threads of a program may not need synchronized if Choose one answer a. A thread waits a lock that is held by another b. None of the others c. They do not access any common resource d. They access common resources Answer:They access common resources 17. Choose one answer a. The output is 5,6 b. The output is Hello 75,6 c. The code line 33 causes an error when the program is compiled d. None of the others e. The program executes with no output Answer:The code line 33 causes an error when the program is compiled 18. The correct order in which database-accessing objects should be created a. Statement Connection ResultSet ResultSetMetaData b. Connection Statement ResultSetMetaData ResultSet c. Connection Statement ResultSet ResultSetMetaData d. Connection ResultSet Statement ResultSetMetaData e. None of the others Answer:Connection Statement ResultSet ResultSetMetaData 19. (1) rce (2) rogram (3) Choose a. b. With respect to JDBC In the two-tier model, a Java application talks directly to the data sou In the three-tier model, a middle tier of services is let between a Java p and the data source The JDBC API supports two-tier processing model for database access oly one answer True, true, true True, true, false

c. False, true, true d. True, false, false e. None of the others Answer:True, true, false 20. If a Java source code contains an assert as an identifier and it will be compiled with JDK version 1.4 or higher a. The option -source 1.4 version must be specified when it is compiled b. The option -source 1.4 must be specified when it is compiled c. The option -enableassertion must be specified when it is run d. None of the others Answer: The option -enableassertion must be specified when it is run 21. Select incorrect Java program entry point declarations (1) Public static void main() (2) Public static void main(String [] args) (3) Public static void main(String args[]) (4) Public static void main(String [] args) (5) Public static void main(String args) a. 3, 4, 5 b. 1, 2, 3 c. 2, 3, 4 d. 1, 4, 5 e. All of the others Answer:1, 4, 5 22. Which respect to networking and the client-server model (1) A server runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a clie nt to make a connection request (2) To connect to the server, the client must know the hostname or IP of the machine on which the server is running and the port number on which the server is listening Choose one answer a. True, false b. False, false c. False, true d. True, true Answer:True, true 23. Choose one answer a. The output is m2m2 b. None of the others c. The code line 25 causes an error because the B class is an abstract clas s d. The code line 28 causes an error because there is no overriding method e. The code line 21 causes an error because there is no overriding method Answer:The output is m2m2 24. Choose one answer a. The program will show current date in the label, named jLabel1 b. The code line 24 causes an error when the program is compiled c. None of the others d. The program is compiled successfully but the current date is not shown Answer:The code line 24 causes an error when the program is compiled 25. (1) (2) Select correct statement(s) A thread can be an instance of the java.lang.Thread class A thread can be an instance of a subclass of the java.lang.Thread class

(3) An instance of a class which implements the java.lang.Runnable can suppl y the executable code for a thread object Choose one answer a. 2 b. 1 c. 1, 2 d. 3 e. 1, 3 f. 1, 2, 3 Answer:1, 2, 3 26. a. b. c. Answer: Choose one answer The code causes (an) error(s). The output is 571 The output is 175

27. Select correct statements (1) A public member of a class can be accessed in all classes (2) A default member of a class can be accessed in all classes (3) A protected member of a class can be accessed in the package containing this class (4) A private member of a class can be accessed in the package containing th is class Choose one answer a. 2, 3, 4 b. 1, 2, 3 c. 1, 3 d. 1, 2 e. 1, 4 Answer:1, 3 28. Choose one answer a. The output is Hic10Hello10 b. The output is Hello10Hic10 c. The output is Hic9Hic10 d. None of the others e. The output is AA9Hic10 Answer:The output is AA9Hic10 29. In Windows systems, the . Program helps creating the Stub of a RMI server and the .. program will work as a RMI container (RMI registry) Choose one answer a. Makestub.exe, rmic.exe b. rmic.exe, rmiregistry.exe c. rmiregistry.exe, rmic.exe d. None of the others e. Stub.exe, rmicontainer.exe Answer:rmic.exe, rmiregistry.exe 30. To read data from a text file using the line-by-line accessing. The righ t order of object creations is a. File FileInputStream b. File FileReader BufferedReader c. File BufferedReader FileReader d. File BufferedReader e. File FileReader Answer:File FileReader BufferedReader

31. Choose one answer (1) An object having synchronized methods is called a(an) .. (2) The .. technique can be applied with a hope that a deadlock situation may not occur in a program (3) The sleep() method of the java.lang.Thread class accepts a argument that specifies a(an) . a. Synchronizer, sleeping, specific period of time b. None of the others c. Examiner, wait, father thread d. Monitor, wait-notify, specific period of time e. Monitor, NotifyAll, executing program Answer:Monitor, wait-notify, specific period of time 32. An instance of the java.util.Scanner class can read data from the ketboa rd (1), a file (2), a string of characters (3) (1) Is ., (2) is .., (3) is .. Choose one answer a. True, false, false b. None of the others c. True, true, true d. True, false, true e. True, true, false Answer:True, true, true 33. . is applied in a class . Is applied in a class hierarchy Choose one answer a. Method expanding, method generalization b. Method overloading, method overriding c. Method generalization, method specification d. Method overriding, method overloading e. None of the others Answer:Method overloading, method overriding 34. The Java language supports a. Desktop and web applications b. Security c. All of the others d. Platform-independence e. Object-oriented programming Answer:All of the others 35. Choose one answer a. The output is m2BB b. The program executes with no output c. An error is thrown when the program is compiled d. The output is BBB Answer:An error is thrown when the program is compiled 36. Which of the following Java operations cause compile-time errors int m = 5, n = 7 float x = m; //1 double y = n; //2 m = y; //3 n = x; //4 Choose one answer a. 2, 4 b. 1, 2, 3, 4 c. 1, 3

d. 3, 4 Answer:3, 4 37. To write objects to an object file. The right order of object creations is: a. FileReader - ObjectOutputStream b. File ObjectOutputStream FileOutputStream c. FileOutputStream ObjectOutputStream d. None of the others e. File ObjectOutputStream Writer Answer:File ObjectOutputStream Writer 38. Choose one answer a. The code line 30 causes a compiler-time error b. The output of the program is 12 c. The output of the program is 5 d. The output of the program is 7 Answer:The output of the program is 12 39. With respect to steps in RMI implementation (1) Create the remote interface (2) Create the remote object (3) Create the client object (4) Create the stub Choose one answer a. None of the other b. 1, 3, 4, 2 c. 1, 2, 4, 3 d. 2, 3, 1, 4 e. 2, 4, 1, 3 Answer:1, 2, 4, 3 40. Choose one answer a. The program causes errors when it is compiled b. None of the others c. The output is m1m2 d. The program executes with no output Answer:The output is m1m2 41. Select correct statements(1) (1) All byte stream classes are descended from eam classes (2) All character stream classes are descended asses (3) All byte stream classes are descended from (4) All character stream classes are descended ut Stream classes Choose one answer a. 2, 3 b. 1, 2 c. None of the others d. 1, 4 Answer:1, 2 the InputStream and OutputStr from the Reader and Writer cl the Reader and Writer classes from the InputStream and Outp

42. Study the following code was implemented in the Hello class static void print(Integer obj){ System.out.println(obj); } And it is used as Integer obj = new Integer(5);

int n = obj; //(1) Hello.print(n); //(2) A operation is carried out at the code line (1) A operation is carried out at the code line (2) Choose one answer a. None of the other b. Unboxing, boxing c. Wrapping, un-wrapping d. Boxing, unboxing Answer:None of the other 43. Suppose that the class A contains an inner class, named B. In a method o f A, to access data of a B object, Choose one answer. a. The B object must be created in the main method of the program b. None of the others c. The B object must be referred by a reference declared in A d. No restriction is examined because B is a subclass of A Answer:The B object must be referred by a reference declared in A 44. A Java source code will be compiled to a. Java bytecode b. Operation system code c. Assembly code d. Machine code e. All of the others Answer:Java bytecode 45. An abstract class a. Must contain all abstract method b. Can contain all concrete methods c. Must contain at least one abstract method d. Can not contain any data field Answer:Must contain at least one abstract method 46. Choose one answer a. The program executes with no output b. The code line 31 causes a compiler-time error c. None of the others d. The output is Hello Answer:The output is Hello 47. Select correct statement(s) (1) Swing is part of the Java Foundation Classes and provides a rich set of GUI components (2) Before you think about what your GUI will look like, its important to thi nk about what it will Choose one answer a. 1, 2 b. 2 c. None of the others d. 1 Answer:1, 2 48. a. b. c. d. An interface can contain Method implementations All of the other Constants Inner classes

Answer:All of the other 49. Which of the following layout manager will present components with the s ame size a. java.awt.GridLayout b. None of the others c. Java.awt.FlowLayout d. Java.awt.CardLayout e. Java.awt.BorderLayout Answer:java.awt.GridLayout 50. Study the following Java code int[] a = {1,2,3,4} int b=1; a[b]=b=3; If the code is executed, the array contains values: a. {1, 2, 3, 4} b. {1, 2, 3, 3} c. {1, 3, 3, 4} d. None of the others Answer:{1, 3, 3, 4} 51. Two topmost abstract classes for character streams are and a. java.io.Reader, java.io.Writer b. java.io.InputStream, java.io.OutputStream c. None of the others d. java.io.ObjectInputStream, java.io.ObjectOutputStream Answer:java.io.Reader, java.io.Writer 52. Suppose that A, B, C are classes in which B is a subclass of A. Study th e following declarations A objA; B objB; C objC; Select a valid statement a. objA = objC; b. objB = objA; c. objB = objC; d. objC = objB; e. objC = objA; f. objA = objB; Answer:objA = objB; 53. To read/write objects from/to a file as object streams, the class declar ation of these objects must implement the market interface a. java.io.Serialization b. java.io.Serializable c. java.lang.Serialization d. java.io.Stream e. java.lang.Serializable Answer:java.io.Serializable 54. In multi-processing system, a. A process must access data in others b. Each process usually accesses its own data c. All process have common executable environment d. All process must access common data allocated by operating system only Answer:Each process usually accesses its own data 55. Which of the following statement is correct about Card layout?

a. Card layout arranges components in time rather than in space b. Card layout arranges components in squares c. Card layout arranges component by dividing frame into spaces called card d. Card layout arranges each component as a card Answer:Card layout arranges components in squares 56. Which method is NOT a member the Object class? a. notifyAll() b. waitAll() c. wait() d. notify() Answer:waitAll() 57. A method is implemented in a super class can not be overridden in derive d classes a. Protected b. Private c. Final d. Public e. Default Answer:Final 58. Study the following Java statements String S = William, Bill is ill. int index1= S.indexOf(ill); int index2= S.lastIndexOf(ill); The value of index1 is . and index2 is a. 2, 18 b. 1, 17 c. None of the others d. 17, 1 e. 18, 2 Answer:1, 17 59. What is NOT a comparison operator a. >> b. Instanceof c. != d. == Answer:>> 60. The re-use code ability is the result of the in OOP a. eggregation b. encapsulation c. inheritance d. polymorphism Answer:inheritance 61. Which of the following statements is correct about Flow layout? a. The Flow layout arranges components in vertical columns b. The Flow layout arranges frames in vertical columns c. The Flow layout arranges frames in horizontal rows d. The Flow layout arranges components in horizontal rows Answer:The Flow layout arranges components in horizontal rows 62. In Swing, what is the role of the components model? a. It is responsible for the region of the screen dedicated to show somethi ng to the user b. It is responsible for the data that the component presents to the users c. It is a model component that we can base on that to create a similar com

ponent d. It is responsible for taking in user request and then modifiers those re quests Answer:It is responsible for the data that the component presents to the users 63. Choose one answer a. 1,2,3,4,5,6, b. 1,2,3,4,3,6, c. None of the others d. 1,2,3,3,5,6 Answer:,2,3,4,3,6, 64. A reference variable can not be . a. An array of numbers b. An integral value c. A string of characters d. A student Answer:An integral value 65. Choose one answer a. The program will print nothing b. The program will print Hello Java c. The program will cause an error when it is compiled d. The program will print Hello Java with a warning message Answer:The program will print nothing 66. Choose one answer a. The program will print: 2 3 4 b. The program will print: 1 2 3 4 c. The program will print: 1 2 3 d. The program will throw an exception when it executes Answer:he program will throw an exception when it executes 67. Choose one answer a. 6.456 b. 5.456 c. 4.456 d. The program will cause an error when it is compiled Answer:The program will cause an error when it is compiled 68. Which of the following statements is correct regarding Type 4 JDBC drive r (Native Protocol) a. It helps the Java applications communicate directly with the database by calling C/C++ native libraries b. It helps the Java applications communicate with the database using Java sockets c. It helps the Java applications communicate directly with the database by calling ODBC APL d. It helps the Java applications communicate directly with the database th rough a third party middleware Answer:It helps the Java applications communicate with the database using Java s ockets 69. Consider the following declaration RandomAccessFile(File file, String mode) If the mode if declared as rwd, what does it mean? a. It means the file can be opened for both reading and writing, and any ch anges to the files content or metadata will take place immediately b. It means the file can be opened for both reading and writing, and any ch anges to the files content, but not its metadata, will take place immediately

c. It means the file can be opened for reading only d. It means the file can be opened for appending data only Answer:It means the file can be opened for both reading and writing, and any cha nges to the files content, but not its metadata, will take place immediately 70. Suppose that the current position of a ResultSet, named rs, is at the la st record, the statement rs.next() will return a. False b. Null reference c. Blank record d. True Answer:False 71. In Java, . a. We can not create objects that belong to an abstract class using standar d syntax of object declaration b. All of the others c. We can use interface keyword to declare an interface d. We can create objects that belong to an abstract class if all abstract m ethods are implemented in object declarations Answer:We can use interface keyword to declare an interface 72. Choose one answer a. The program causes error(s) when it is compiled b. The program will print I cannot fly and I can fly c. The program will print I cannot fly Answer:The program will print I cannot fly 73. Choose one answer a. ob1==ob2 Have a nice day! b. Have a nice day! c. ob1 equals ob2 Have a nice day! d. No output Answer:ob1 equals ob2 Have a nice day! 74. A Java source code is a file with the file extension is a. .java b. .jar c. .rar d. .class Answer:.java 75. Choose one answer a. Not OK b. The program will cause an error when it is compiled c. The program will print nothing d. OK Answer:Not OK 76. The try catch statements must be used to contain statements that a. may cause run-time errors b. may cause unchecked exceptions c. may cause checked exceptions d. may cause compile-time errors Answer:may cause checked exceptions 77. To traverse elements in a set, one after one elements, the java.util inter face must be use

a. Set b. List c. Map d. Iterator Answer:Set 78. a. b. c. d. e. Answer: Choose one answer AC A CA C The program cause an error when it is compiled the program cause an error when it is compiled

79. Choose one answer a. 9 b. 16 c. None of the others d. 8 e. 17 Answer:8 80. Which of the following statements is correct about Thread? a. We can restart a dead thread by calling its start() or run() methods b. When the run() method of a thread returns, that thread is put into ready state c. We cannot call other methods (excepts start() and run()) of a dead threa d d. We cannot restart a dead thread by calling its start() or run() methods Answer:We cannot restart a dead thread by calling its start() or run() methods 81. Which of the following statements is correct about object serialization? a. All non-transient, including static fields, are-serialized b. Transient fields are not serialized c. None of the others d. Class definitions and its objects data are serialized Answer:Transient fields are not serialized 82. Which statement is correct about protected modifier? a. It means as the private modifier b. Only variables and methods may be declared as protected members c. The protected modifier can only provide accessing to the members of the class itself d. It means as the default modifier Answer:Only variables and methods may be declared as protected members 83. What is the role of RMI registry? a. The RMI registry is a program that associates names with RMI services b. The RMI registry is a server program that stores client information c. The RMI registry is a server program that stores both client and server information d. The RMI registry is a program that stores stub objects Answer:The RMI registry is a program that associates names with RMI services 84. A method in a super class is implemented using the default modifier, thi s method cannot be overridden in subclasses using the . Modifier a. Private b. Default c. Public d. Protected

Answer:Private 85. When a thread begins waiting an IO operation, it enters the state a. Suspended b. Blocked c. Ready d. Sleep Answer:Ready 86. Study the following Java statements: String s1 = Hello; String s2 = Hello; String s3 = Hello; a. There is only one string is stored in memory of the program. b. There is two strings are stored in memory of the program c. None of the others d. There is three strings are stored in memory of the program Answer:here is only one string is stored in memory of the program. 87. The . Class make utilities to write platform-independent code that examin es and manipulates folders a. java.io.Directory b. java.io.File c. None of the others d. java.io.Folder Answer:java.io.File 88. Choose one answer a. None of the others b. 49 c. 97 d. 80 Answer:97 89. Suppose that we have a combobox that contains a list of data. The combob ox can only display to the user one item at a time. In term of Model-View-Contro ller, which of the following statements is correct a. The list of data of the combobox can be considered as a representative o f the Controller b. The list of data of the combobox can be considered as a representative o f the View c. The list of data of the combobox can be considered as a representative o f the Model Answer:The list of data of the combobox can be considered as a representative of the Model 90. Select incorrect statements about ServerSocket class a. The most useful form of the ServerSocket constructor is public ServerSoc ket(int portNumber) b. To make the new object available for client connections, call its accept () method, which returns an instance of ServerSocket c. A server socket, on the other hand, makes itself available and then wait s for clients to initiate connections d. There is no way to know how long the accept() call will take Answer:A server socket, on the other hand, makes itself available and then waits for clients to initiate connections 91. drivers that implement the JDBC API as a mapping to another data access A PI, such as ODBC. Drivers of this type are generally dependent on a native libra ry, which limits their portability

a. Type 2 b. Type 1 c. Type 4 d. Type 3 Answer:Type 2 92. Which of the following operators will shift all bit values to the right and fill the empty bits on the left end with 0s a. >>> b. << c. <<< d. >> Answer:>>> 93. You are required to build an application that can connect to database to display data to end users. The requirement for the database connectivity is tha t it must provide a performance as fast as possible Suppose that all types of drives are available. Which type should you choose to satisfy the requirement a. Type 1 b. Type 3 c. Type 4 d. Type 2 Answer:Type 1 94. Which of the following statements is correct? a. TCP is a unreliable transmission protocol because it does not guarantee the data will be delivered correctly to the destination b. Basically, RIM technology uses traditional sockets but socket classes ar e created invisibly to developers c. None of the others d. In a computer, IP address is used to identify uniquely a process Answer:Basically, RIM technology uses traditional sockets but socket classes are created invisibly to developers 95. Suppose that a homogenous collection of objects, that belong the same ty pe, are managed. Which of the following declarations is the best choice a. java.util.TreeSet list; b. java.util.ArrayList list; c. java.util.List list; d. java.util.Vector list; Answer:java.util.Vector list; 96. Choose one answer a. If executed, the program will print out an exception b. The program will not run because it causes a compile error c. If executed, the program will print out: Done d. If executed, the program will print out: Error, Done Answer:The program will not run because it causes a compile error 97. Which of the following classes is not an abstract class? a. java.io.InputStream b. java.io.Writer c. None of the others d. java.io.OutputStream e. java.io.Reader Answer:None of the others 98. Which of the following layout managers will make all its components the same size

a. CardLayout b. GridLayour c. GridBagLayout d. BorderLayout Answer:GridLayour 99. Choose one answer a. The code will print out: Exception b. The code will print out: Error, Exception c. The code will print out: Error d. The code will cause a compile error Answer:The code will cause a compile error 100. Which of the following statements is true about Object class a. By default, the toString() method returns the address of the class b. By default, the clone() method performs deep copy of an object c. By default, the toString() method returns the name of the class d. By default, the equals() method simply performs the == operator Answer:By default, the toString() method returns the address of the class 101. Choose one answer a. The line 1 and the line 2 are executed b. Only the line 1 is executed c. The program causes a compile-time error d. The Line 1, the line 2, and the line 3 are executed Answer:The line 1 and the line 2 are executed 102. Which of the following modifiers is valid for a constructor a. Final b. Static c. Private d. Synchronized Answer:Private 103. Choose one answer a. The code causes an error because it must throw FileNotFoundException cla ss, not just Exception class b. The code causes an error because the FileInputStream class cannot receiv e File object for its constructor c. The code causes an error because the FileInputStream class cannot be use d to write data d. The code causes an error because the write() method of the FileInputStre am requires a string parameter Answer:The code causes an error because the FileInputStream class cannot be used to write data 104. Suppose that Your application has to read and write a string a lot of times Your application does not need to have multi threaded supports Performance is important Which of the following classes will you choose to deal with string data type to achieve the above requirements a. StringBuffer b. String c. StringPrinter d. StringBuilder Answer:String 105. Suppose that the layout of the frame f is BorderLayout. Study the follow ing statements

f. getContentPane().add { new JButton(B)}; The button B will be let at the region of the frame a. east b. north c. west d. none of the others e. south Answer:none of the others 106. Choose one answer a. m = b; b. b = m; c. i = d d. i = b1; Answer:b = m; 107. Suppose that you will insert a lot of rows into a database table row-byrow. Which of the following interfaces should be used a. CallableStatement b. PrepareStatement c. Statement d. Connection Answer:PrepareStatement 108. Choose one answer a. The code will print out: father b. The code will print out: father, son c. The code will print out: son d. The code will cause a compile-time error Answer:The code will cause a compile-time error 109. Which of the following options is not a valid declaration of the RandomA ccessFile class a. RandomAccessFile r = new RandomAccessFIle(file.txt, w); b. RandomAccessFile r = new RandomAccessFIle(file.txt, rwd); c. RandomAccessFile r = new RandomAccessFIle(file.txt, rws); d. RandomAccessFile r = new RandomAccessFIle(file.txt, rw); Answer:RandomAccessFile r = new RandomAccessFIle(file.txt, w); 27 The protected modifier cannot be applied to which of the following declasrati on? answer: static string="1213" 28 which the following declarcation is not correct? answer: int x=0A; 29 Which of the following declarations is not valid? answer: private int[]ar3=new int[2]{1,2}; 30 Which of the follwing commands is valid to execute a java byte-code file ? answer:javac myPackage.MyClassFile.class 31. the bove code is an example of... answer:tight coupling 32 which the following methods causes a thread to release the lock of the object that it is currntl holding? answer:notify() 33 You are assigned a job that you need to buy a lock to replace the old one in

your company.A lock-set includes 2 components : a lock and a key.Each key can on ly fit one lock. a key and alock in an example of... answer: tight coupling 34 In OOP, which the following statement is correct in terms of cohesion ? answer:Each method should perform one spacific task only. 37 Two streams in a Java socket are... answer: Binary streams 39 In order to alow an object can be serialized into file, which of the followin g interfaces needs to be implemented. answer: java.io.seralizable 40 Scanner sc=new Scanner("123...hi23there2"); sc.useSDelimiter("[[.]\\d]+") while (sc.Next()){system.out.print(sc.netxt())}; answer: print out : hithere 42 one of the benefit of Type 1 driver(JDBC-ODBC Bridge) is that it can provide connection to a database when Java driver is not available for that database. answer: None of others 43 which the following statement is true ? answer: athread must obtain the lock of the object it is trying to invoke the no tifyALL() method. 44 when invoking Math.random(),which of the following options mights be result? answer: the result is less than 1.0 45. You are required build a GUI application.The application has a main window w hich displays/ a toll bar at the top a status bar at the bottom a menu on the left an information table on the right a newd board at the middle of the window answer:BorderLayout 46. you are required to write a program that stores data retrieved from user to a text file.The data must be stored line by line and in Unicode format.which of the following classes is the best choice for storing tasks? answer: java.io.PrintWrite 47 Which the following protocols is a reliable protocol answer: TCP and UDP 48 for(Object s:V) answer: the line 6 should be changed to v.add(sc2.next()); 49.Character c1=new Character( a ); Character c2=new Character( a ); System.out.println(c1==c2); System.out.println(c1.equals(c2)); answer:false,true 50 in JTree control, which of the following classes represents for one node? answer:MutableTreeNote //////////////////////////

1. The .. object contains not just an SQL statement, but an SQL statement t hat has been precompiled a. Connection b. ResultSetMetaData c. None of the others d. PreparedStatement e. Statement f. ResultSet answer:PreparedStatement 2. Choose one answer a. BA b. B c. AB d. None of the others e. A f. A run-time exception answer:None of the others 3. Which component can display an image, but cannot get focus? a. JLabel b. JListbox c. JButton d. JTextField e. JPasswordField answer:JLabel 4. Select a correct statement a. An abstract class can not contain a concrete method b. No data field can be declared in an abstract class c. None of the others d. An abstract class must contain abstract methods only e. An interface can contain only one method implementation answer:None of the others 5. Select a correct statement about interfaces a. An interface is a class that has method implementations with no data b. An interface is an abstract class with no data c. An interface is a class that has at least one abstract method d. In its most common form, an interface is a group of related methods with empty bodies answer:In its most common form, an interface is a group of related methods with empty bodies 6. String S= Hello; String S2 = new String(Java Program); The String class describes an immutable chain of Unicode characters. Selec t a statement that causes an error a. S = Innovation; b. All of these assignment statement c. S2=S.toUpperCase(); d. None of the others e. S+=S2; answer:None of the others 7. Select the output of the following Java code System.out.print(1>>10); System.out.print(-1>>20); Choose one answer

a. 0-1 b. 1-1 c. 00 d. Unpredictable output answer:0-1 8. Select the correct syntax for throwing an exception when declaring a met hod a. None of the others b. [Modifier] {Return type] Identifier (Parameters) {throw TypeOfException} c. [Modifier] {Return type] Identifier (Parameters) throws TypeOfException d. [Modifier] {Return type] Identifier (Parameters) {throws TypeOfException ; e. [Modifier] {Return type] Identifier (Parameters) throw TypeOfException answer:[Modifier] {Return type] Identifier (Parameters) throws TypeOfException 9. Choose one answer a. String b. None of the others c. StringBuffer d. Compile-time error answer:compile-time error 10. Choose one answer a. None of the others b. The program causes a compile-time error because an inner class of a meth od can access final local variable of the method only c. The program causes a compile-time error because we can not create a anon ymous class in a method d. 21 answer:The program causes a compile-time error because an inner class of a metho d can access final local variable of the method only 11. With respect to access modifier overridden, the right order is a. private, protected, default, public b. default, private, protected, public c. public, protected, default, private d. private, default, protected, public answer:private, default, protected, public 12. An application that creates an instance of Thread must provide the code that will run in that thread. Select a correct way to do this a. All things are creating a java.lang.Thread object b. Provide a Runnable object. The Runnable object is passed to the Thread c onstructor c. All things are creating a Runnable object d. All of the others answer:Provide a Runnable object. The Runnable object is passed to the Thread co nstructor 13. The Java Collection framework is implemented in the package a. java.util.framework b. java.lang c. java.collection d. None of the others e. java.util.collection answer:None of the others 14. a. Choose one answer NOT OK ALSO OK

b. NOT OK ALSO NOT OK c. OK ALSO NOT OK d. OK ALSO OK answer:OK ALSO NOT OK 15. Choose one answer a. Unpredictable output b. A compile-time error c. None of the others d. [5, Hello, 7] e. [7, Hello, 5] answer:None of the others 16. In a client-server application model, which sides will initiate a connec tion a. Server b. None of them but a middle object c. Client d. Operation Systems in which they are running answer:Client 17. Choose one answer (1) A value variable contains datas value (2) A reference variable contains the address of data The statement (1) is .., and the statement (2) is a. False, true b. True, false c. False, false d. True, true answer:True, true 18. When reading objects from an object stream a. We usually use an explicit casting b. No casting is needed c. The compiler automatically identifies the class of the object d. The compiler will automatically use a conversion answer:We usually use an explicit casting 19. exist within a Every has at least one a. Processes, thread, thread, process b. Threads, process, thread, process c. Processes, thread, process, thread d. Threads, process, process, thread answer:Threads, process, process, thread 20. All of the numeric wrapper class in the java.lang package are subclasses of the abstract class a. java.lang.Integer b. java.lang.Wrapper c. none of the others d. java.lang.Object e. java.lang.Number answer:java.lang.Number 21. a. b. c. d. e. the java.io.ObjectInputStream class is a subclass of the class java.io.ObjectInput java.io.Stream java.io.Object java.lang.ByteStream java.io.InputStream

answer:java.io.InputStream 22. Choose one answer a. Unpredictable b. 21 c. Unpredictable error d. None of the others e. 12 answer:None of the others 23. With respect to processing models for database access, in the model, a J ava application talks directly to the data source a. Two-tier b. None of the other choices c. Three-tier d. Multi-tier answer:Two-tier 24. Choose one answer a. Unpredictable output b. None of the others c. AHello d. HelloA e. A run-time exception answer:None of the others 25. Select an incorrect identifier in Java a. &x b. _x_2 c. Principle d. _23 e. $integer answer:&x 26. Choose one answer a. Unpredictable output b. A run-time exception c. Compile-time error(s) d. AC e. AA answer:Compile-time error(s) 27. Select a characteristic that is not supported by the Java language a. multi-threaded b. procedure-oriented c. object-oriented d. security supported e. platform independent answer:procedure-oriented 28. If an object is visible to more than one thread, all reads or writes to that objects variables should be done through methods a. Private b. Protected c. None of the others d. Public answer:Public 29. a. Select a correct statement ObjectInputStream, ObjectOutputStream are not text streams

b. DataInputStream, DataOutputStream are binary streams c. PrintWritter, BufferedReader are not binary streams d. All of the others answer:PrintWritter, BufferedReader are not binary streams 30. RMI applications often comprise two separate programs, a server and a cl ient and they a. Must run in the same virtual machine b. Must run in two separate computers c. Can run in two separate virtual machines answer:Can run in two separate virtual machines 31. Choose one anser a. 8 b. Compile-time error c. 3 d. 4 e. 5 answer:5 32. Choose one answer a. 12 b. None of the others c. A run-time exception d. A compile-time error answer:A run-time exception 33. Choose one answer a. 10 b. 15 c. 20 d. 5 e. A compile-time error answer:20 34. Choose one answer a. -255 b. 259 c. 256 d. 3 e. -3 f. Another value answer:3 35. In order to use the TreeSet class, the class that describes elements mus t implement the interface a. java.util.treeset.Compare b. java.lang.Comparable c. java.util.Comparable d. None of the others e. java.lang.Comparing answer:java.lang.Comparable

1. Under which of the following environments does your programs execution code run? A. MSIL B. CLS C. CLR

D. VB .NET Answer: CLR 2. What is the compiler called that converts IL code into platform-specific code ? A. MSIL-converter B. JIT C. JTI D. Metadata Answer: JIT 3. What is the output format of the file the C# compiler produces? A. Byte code B. IL C. Hex dump D. Intel Assembler Answer: IL 4. Given the following program, what is the outcome when you try to compile and run it? using System; class Test { public static int Main() { Console.WriteLine("Hello World!"); } } A. It will compile and print Hello World! when run. B. It will compile and result in a runtime error indicating that the Console is an unknown object. C. It will fail to compile with an error CS0161: Test.Main( ) : not all code paths return a value. D. It will fail to compile with an "error CS0161: Test.Main( ): method cannot return an int". Answer: not all code 5. Hiding the implementation and exposing the interface is a concept of OOP called: A. Polymorphism B. Encapsulation C. Overloading D. Static Answer: Encapsulation 6. Which of the following statements is true? A. A class is the implementation of an object. B. An object is the implementation of a class. C. A class is the instantiation of an object. D. An object is the instantiation of a class. Answer: object is instantiation

7. Which of the following is the correct way to declare the method GetPayCheck()? A. public int GetPayCheck() B. private int GetPayCheck() C. private void GetPayCheck(int a) D. public void GetPayCheck(int a) Answer: public int GetPayCheck() 8. Which is a definition of a static method? A. public static MethodA() B. public void MethodA() C. private static MethodA() D. public static void MethodA() Answer: public static void MethodA() 9. Which of the following languages is not part of the current .NET languages? A. Visual Basic B. C# C. C++ D. FoxPro Answer: FoxPro 10. In order to compile a C# program from the command line, what command would you use? A. cmd B. comp C. csc D. daml Answer: csc 1. Given the following code segment, what will the value returned from the method be? public int ViktorMove() { int x = 42; int y = 12; int w; object o; o = x; w = y * (int)o; return w; } A. 504 B. 491 C. 42 D. Runtime error, Null Pointer exception! Answer: 504 2. When will the garbage collector run? A. Every 15 minutes. B. Once every day at 13:00. C. When the application is low on memory. D. Randomly based on the resource load on the system. Answer: When the application is low on memory. 3. The statement that is used to replace multiple if statements is called: A. The case statement. B. The switch statement. C. The nestedif statement. D. The #endif statement. Answer: The case statement. 4. Which of the following is not a C# keyword? A. if

B. delegate C. private D. implements Answer: implements 5. Choose the correct method for declaring a namespace: A. namespace Osborne.Chapter5 B. namespace Osborne.Chapter5; C. namespace Osborne.Chapter5.MyClass D. namespace Osborne.Chapter5.MyClass; Answer: namespace Osborne.Chapter5; 6. Determine the output of the following code segment: int x = 42; x++; x += --x; System.Console.WriteLine ("The value of x is : {0}", x); A. 84 B. 83 C. 86 D. 85 Answer: 85 1. Given the following code, what will the compiler do? class Test1 { sealed abstract void MyMethod1A() { System.Console.WriteLine ("This is MyMethod1"); } } A. The code will compile properly. B. The class visibility is incorrect. C. System.Console.WriteLine is specified incorrectly. D. MyMethod1() is not properly declared. Answer: MyMethod1() is not properly declared. 2. Which line causes a compile error in the following code? 1. interface Test2 2. { 3. int Int2; 4. void Method2A(int); 5. string Method2B (); 6. int Method2C(int, int); 7. int Method2A(char); 8. } A. Line 3 B. Line 4 C. Line 5 D. Line 7 Answer: Line 3 3. What is the outcome of compiling this program? 1 public class Test3 2 { 3 void Method3A () 4 { 5 System.Console.WriteLine ("In Method3A"); 6 } 7 } 8 class Test3a: Test3 9 { 10 void Method3B () 11 {

12 Method3A(); 13 } 14 } 15 class Test3b 16 { 17 public static void Main() 18 { 19 Test3a a = new Test3a(); 20 a.Method3B(); 21 } 22 } A. It compiles successfully. B. Lines 12 and 20 are in error. C. Line 12 is an error. D. Line 20 is the error. Answer: 12 and 20 are in error. 4. What will happen on line 24? 1 class Test4 2 { 3 int test4a; 4 string test4b; 5 float test4c; 6 virtual public void Test4D () 7 { 8 System.Console.WriteLine("Hello") 9 } 10 } 11 class Test4a: Test4 12 { 13 override public void Test4D () 14 { 15 System.Console.WriteLine ("Goodbye"); 16 } 17 } 18 class Test4b 19 { 20 public static void Main() 21 { 22 Test4a t = new Test4a(); 23 Test4 t1 = t; 24 t.Test4D(); 25 } 26 } A. The compiler finds an error. B. A runtime error occurs. C. It prints Goodbye. D. It prints Hello. Answer: Goodbye. 5. What is the result of the following code? class Test5 { public Test5 ( ) { System.Console.WriteLine ("Test5 1"); } public Test5 (int num) { System.Console.WriteLine ("Test5 2"); } }

class Test5a { public Test5a (): base(5) { } public Test5a(int numb): base() { } } class Test5b { public static void Main() { Test5a t = new Test5a(12); } } A. It prints Test5 1. B. It prints Test5 2. C. It does not compile. D. It does not run. Answer: Test5 1. 1. Given the following code segment, what is the content of the string s in line 4? 1 string s = "Hello"; 2 string r; 3 r = s; 4 r += " World!"; A. Hello World! B. Hello C. Nothing, it is garbage collected D. The code will not compile Answer: Hello 2. Which of the following array declarations will produce a compiler error? A. int[] Integers = new int[] (1,2,3,4,5,6,7,8,9,0}; B. int[] Integers = new int[42]; C. int[] Integers = {1,2,3,4,5,6,7,8,9,0}; D. int I = 4; int[] Integers = new int[I] {1,2,3,4}; Answer: new int[I] 3. In the following code, what will be printed by the Console.WriteLine() method? string[] str = {"Hello", "!", "World"}; Array.Reverse(str); Console.WriteLine(str[0]); A. ! B. Hello C. olleH D. World Answer: World 4. In the following code, what will be printed by the Console.WriteLine() method? string[] str = {"Hello", "!", "World"}; Array.Sort(str); Console.WriteLine(str[0]); A. ! B. Hello C. olleH D. Hello World ! Answer: "!"

5. What is the outcome of the following code? 01 public void MethodB () 02 { 03 int [] MyInts = new int [2]; 04 try 05 { 06 for ( int i = 0; i < 3; i++) 07 { 08 MyInts[i] = i; 09 } 10 } catch (System.Exception e) 11 { 12 System.Console.WriteLine ("Some error occurred"); 13 } 14 } A. The code will not compile because there is an incorrect catch block. B. The code will not compile because of an error on line 6. C. The code will compile and displays Some error occurred. D. The code will compile and will abort upon execution. Answer: Some error occurred 6. What is the outcome of the following code? 01 public void MethodB () 02 { 03 int [] MyInts = new int [2]; 04 try 05 { 06 for ( int i = 0; i < 3; i++) 07 { 08 MyInts[i] = i; 09 } 10 } finally 11 { 12 System.Console.WriteLine ("This is executed"); 13 } 14 } A. The code will not compile because there is a missing catch block. B. The code will compile and abort upon execution. C. The code will compile and displays This is executed. D. The code will compile and will abort upon execution and then display This is executed. Answer: This is executed 7. You need to define a delegate for the following method: public class Class1 { public static int Method42(int i) { return i*42; } } How is the delegate for Method42() declared? A. delegate Class1.Method42; B. delegate int Met42(int i); C. delegate void Method42(string s); D. delegate int Class1.Method42(int i); Answer: delegate int Met42(int i); 8. What kind of delegate will be created for the following method? public void Method12(object sender, System.EventArgs e) { }

A. Single delegate B. Event delegate C. Multicast delegate D. Proxy delegate Answer: Multicast delegate 9. The following code segment creates an event handler. What text must be inserted in place of <<replace text here>> for the event to work? // declare the delegate for the event public delegate void SendFaxEventHandler(); public class Fax { // declare the SendFax event public <<replace text here>> event SendFaxHandler SendFax; // } A. void B. delegate C. Combine D. static Answer: static 10. You are building an event handler for the SendFax event from the sFax component, and you have written the following code. When you test the event handler, you find that it never runs. What code must you add to your application to make the event execute in response to the SendFax event? private void Send_Fax() { Console.WriteLine("Fax is sent!"); } A. public delegate SendFax(Send_Fax); B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); C. public event SendFax(Send_Fax); D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax); Answer: SendFax += new SendF 1. You want to see all the methods of a particular class that you are using in y our application. Which tool would you use? A. Class Viewer B. Object Browser C. Class Explorer D. Object Explorer Answer: Object Browser 2. You want to change the color of the text in the code window. Which menu item would you select? A. View | Options B. Tools | Customize C. View | Customize D. Tools | Options Answer: Tools | Options 3. Which key combination will allow you to compile your console application and leave the console window open? A. CTRL-F5 B. ALT-F5 C. F5 D. SHIFT-F5 Answer: CTRL-F5 4. To create a class file that can be added to a library, you would select which project type? A. ASP.NET Web Application B. Class Library

C. Console Application D. Web Control Library Answer: Class Library 1. What is the name given to the type of assembly that contains localized resources? A. Spoke B. Hub C. Sputnik D. Satellite Answer: Satellite 2. What is the correct name for a resource file with images for the English cult ure, in the United States subculture? A. images.US-en.resources B. images.en-US.resources C. resources.images.en-US D. images.en-US.dll Answer: es.en-US.resources 3. What is the minimum number of assemblies a .NET application can have? A. 0 B. 1 C. 2 D. 3 Answer: 1 4. How is the metadata for an assembly stored? A. In the Registry. B. In .ini files. C. As XML in the manifest. D. As a Type Library (.tlb) file. Answer: As XML in the manifest. 5. What tool is used to manage the assemblies in the Global Assembly Cache? A. gacmgr.exe B. gacutil.exe C. gassy.exe D. al.exe Answer: gacutil.exe 1. What is the code for the German language? A. ge B. gb C. de D. dk Answer: de 2. What namespace contains the ResourceManager class? A. System.Localization B. System.Resources C. System.Globalization D. System.Threading Answer: Resources 3. What is the process called that converts a primitive to a class? A. Primary B. Boxing C. Conversion D. Encoding Answer: Boxing 4. Which of the following code segments will correctly display the string resour ce txtHello? (All objects are correctly created.) A. Console.Write(rm.ToString("txtHello");

B. Console.WriteLine(rm.Strings("txtHello"); C. Console.Write(txtHello.ToString("s")); D. Console.Write(rm.GetString("txtHello")); Answer: rm.GetString("txtHello") 5. What does the following command do? csc /res:strings.resources HelloGlobalWorld.cs A. Builds only the HelloGlobalWorld program. B. Builds the HelloGlobalWorld and links the fallback resource. C. Creates an assembly for the HelloGlobalWorld program. D. Creates a name resolution report for the HelloGlobalWorld program. Answer: Builds the HelloGlobalWorld and links the fallback resource. 6. When localizing a web application, you find that you need to encode Unicode characters that are sent to the client. What attribute would you set? A. ResponseEncoding="UTF-8" B. Encoding="UTF-8" C. ResponseCode="UTF-8" D. EncodedResponse="UTF-8" Answer: ResponseEncoding="UTF-8" 7. What happens when the Resource Manager fails to find the localized resource for a locale? A. It uses the closest locale. B. It throws an exception. C. Nothing, the resource will be blank. D. It uses the fallback resource. Answer: the fallback resource 8. What namespace contains the CultureInfo class? A. System.Localization B. System.Resources C. System.Globalization D. System.Threading Answer: Globalization 9. Do you have to produce all the locale-specific assemblies before deploying th e application? A. Yes, the assemblies must be present for the final compile of the application. B. Yes, the fallback manifest must be built from all the satellite assemblies. C. Yes, the .NET Framework must update the registry with all the information at deployment. D. No, the satellite assemblies can be deployed at will after initial deployment . Answer: No, the satellite assemblies can be deployed at will after initial deplo yment. 10. In the following code segment, what is the significance of the "Strings" lit eral? static ResourceManager rm = new ResourceManager("Strings", Assembly.GetExecutingAssembly()); A. Arbitrary name for the assembly. B. The base name of the resource to be loaded. C. The base name of the assembly to be loaded. D. Alias for the Resource Manager. Answer: the resource to be loaded 11. Where in the object model is the information relating to the date format sto red for a specific locale? A. ResourceManager B. CultureInfo C. LocalFormat D. Reflection Answer: CultureInfo 12. Your application is called AccountingOne.exe. What must the name of the

French string resource be? A. AccountingOne.resources.dll B. strings.resources C. strings.fr.resources.dll D. strings.fr.resources Answer: strings.fr.resources 13. What does the attribute dir="rtf" stand for? A. The direction of RTF files. B. The encoding of RTF files. C. The direction for the display of characters. D. A directory listing of all RTF files. Answer: for the display of characters. 14. Your application is called AccountingOne.exe. What must the name of the satellite assemblies be? A. Accountingone.resources.dll B. accounting.Resources.dll C. AccountingOne.resources.dll D. Accounting.resources.dll Answer: untingOne 1. Which command will cause an XML file to be generated from documentation comments? A. csc MyClass.cs /doc:MyClass.cs B. cscd MyClass.cs /doc:MyClass.xml C. cscd MyClass.cs /doc:MyClass.cs D. csc MyClass.cs /doc:MyClass.xml Answer: csc .xml 2. Which line causes the following XML to be not well-formed? <VideoList> <tape> <name>XML is cool!</name> </VideoList> </tape> A. <tape> B. </VideoList> C. </tape> D. <name>XML is cool!</name> Answer: </VideoList> 3. Which XML rule does the following break? <employees> <Employee> <name>Kenneth S. Lind</name> </Employee> <employee> <name>Marj Rempel </employee> </employees> A. There must be a single root element. B. There must be matching opening and closing tags. C. XML is case-sensitive. D. All attributes must be in quotes. Answer: be matching opening and closing tags. 4. Which XML rule does the following break? <employees> <employee> <name id=123>Kenneth S. Lind</name> </employee> <employee> <name id=456>Marj Rempel</name> </employee>

</employees> A. There must be a single root element. B. There must be matching opening and closing tags. C. XML is case-sensitive. D. All attributes must be in quotes. Answer: All attributes must be in quotes. 5. Visual Studio .NET provides a tool to generate HTML from the XML documentation file. It is found where? A. Tools | Generate XML B. Tools | Generate HTML C. Tools | Build Comment Pages D. Tools | Build Comment Web Pages Answer: Web Pages 6. Which XML line(s) generates an employee attribute? A. <employee name="Ken"> B. <employee attribute name="Ken"> C. <employee Name= Ken > D. <employee attribute Name= Ken > Answer: ee name=/ee Name= Ken 7. Which of the following lines is an XML declaration? A. <xml version="1.0"> B. ?xml version="1.0"? C. <?xml version=1.0?> D. <?xml version="1.0"?> Answer: <?xml version="1.0"?> 8. Why will the following XML code not be rendered by a browser? <name> <lastname>Dowdy</lastname> <firstname>Howdy</firstname> </lastname> A. The browser is not specified. B. The root element is missing. C. The root element is not closed properly. D. The firstname element is incorrect. Answer: not closed properly. 9. Assess the following XML. Which answer correctly describes the code? <addresses> <listing> <name> <lastname>Dowdy</lastname> <firstname>Howdy</firstname> </name> <address> <street>123 Anywhere St</street> <city>MyCity</city> </address> </listing> </addresses> A. The name element is described incorrectly. B. The address element is described incorrectly. C. The addresses root element is described incorrectly. D. Nothingthis is well-formed XML. Answer: Nothingthis is well-formed XML. 10. Which of the following documentation comments is correct? A. /// summary This is a summary comment summary B. /// <summary> This is a summary comment </summary> C. /// <summary> This is a summary comment D. /// summary This is a summary comment Answer: <summary></summary>

1. You have been asked to debug a Web-based ASP.NET application. For some reason, the debugging information is not presented. What could be missing? A. <%@ Page Debug="true" %> B. <%@ Application Debug="true" %> C. <%@ Page Trace="true" %> D. <%@ Application Trace="true" %> Answer: Page Debug="true" %> 2. You want to examine and change the value of a variable in your C# application . You are developing using Visual Studio .NET. What window will allow you to change the value during execution? A. Locals window B. Call Stack window C. Immediate window D. Watch window Answer: Immediate window 3. You want to compile a console-based program at the command line. What is the correct syntax of the command-line compiler that will allow you to see debugging information? A. csc /b:debug MyApp.cs B. csc /d:debug MyApp.cs C. csc MyApp.cs /b:debug D. csc MyApp.cs /d:debug Answer: MyApp.cs /b:debug 4. Trace switches can be set using which class? A. System.Diagnostics.Trace B. System.Diagnostics.DefaultTraceListener C. System.Diagnostics.TraceSwitches D. System.Diagnostics.TraceSwitch Answer: TraceSwitches 5. The correct syntax for adding a trace listener to the Listeners collection is : A. TraceListeners.Add (new TextWriterTraceListener("myfile.txt"); B. Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); C. Trace.Add (new TraceListener ("myfile.txt"); D. TraceListener.Add (new TraceListener("myfile.txt"); Answer: Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); 6. To debug an ASP.NET application, you need to attach to which process? A. aspnet.exe B. asp.net.exe C. aspnet_debug.exe D. aspnet_wp.exe Answer: aspnet_wp.exe 7. How would you create a breakpoint in your code within Visual Studio .NET? A. Press F9. B. Right-click in the margin and select Insert Breakpoint. C. Choose Debug | New Breakpoint from the menu system. D. All of the above. E. None of the above. Answer: All of the above. 1. What does the following SQL statement return, assuming that all tables and column names are correct? SELECT FirstName, StreetAddress FROM Employees JOIN AddressBook ON Employees.EmpID = AddressBook.EmpID A. Nothing, the JOIN syntax is wrong.

B. All the records from the Employees table, and only the matching ones from the StreetAddress table. C. All the records from the StreetAddress table, and only the matching records from the Employees table. D. Only the matching records from the two tables. Answer: Only the matching records from the two tables. 2. What is a transaction? A. A banking term. B. A concept used to describe a step in the business process. C. A combination of DML steps that must succeed or the data is returned to its initial state. D. A combination of DDL steps that must succeed or the data is returned to its initial state. Answer: of DML steps that must succeed or the data is returned to its initial st ate. 3. What object is used to encapsulate a data source? A. XxxConnection B. XxxCommand C. XxxDataAdapter D. DataSet Answer: XxxConnection 4. What object is used to encapsulate a rowset? A. DataSet B. DataAdapter C. DataRowSet D. DataTable Answer: DataTable 5. What property is used on the DataTable to indicate a conflict after an update ? A. HasConflict B. HasError C. HasCollision D. HasDataError Answer: HasError 6. What is a DiffGram? A. An XML file containing both the original and current values for the data. B. An XML file containing the difference between original and current data. C. A DataSet loaded with two XML files, resulting in the difference being current. D. A DataSet loaded with an XML file and the original values from the data source. Answer: both the original and current values for the data. 7. How is the data represented in an XmlDataDocument? A. Relational B. Flat C. Hierarchical D. Tabular Answer: Hierarchical 8. When would you not use the OleDbConnection object? A. To connect to an SQL 7.0 database. B. To connect to a DB/2 database. C. To connect to an Access database. D. To connect to an SQL 6.5 database. Answer: an SQL 7.0 database. 9. What connection is used in ADO.NET to connect to an SQL Server 6.0? A. Use the OleDbConnection class. B. Upgrade the server to SQL 7.0 and use the OleDbConnection class. C. Upgrade the server to SQL 2000 and use the OdbcConnection class. D. Upgrade the server to SQL 6.5 and use the SqlConnection class. Answer: Use the OleDbConnection class.

10. On what object is the transaction in ADO.NET focused on? A. The command object B. The DataSet object C. The connection object D. The DataAdapter object Answer: The connection object 11. What is the SQL argument that sorts the data returned by an SQL SELECT statement? A. GROUP BY B. SORT BY C. SORTED D. ORDER BY Answer: ORDER BY 12. What combination of methods are used to improve the speed of the Fill() method of the DataAdapter? A. BeginFillData() and EndFillData() B. StartFillData() and EndFillData() C. BeginLoadData() and EndLoadData() D. StartLoadData() and EndLoadData() Answer: BeginLoadData() and EndLoadData() 13. The following SQL INSERT statement fails. What is the most probable reason for the failure? INSERT INTO Employees VALUES (42, Bob , Carol , 12) A. Syntax error in the INSERT statement. B. The columns in the Employees table are not in the indicated order (int, char, char, int). C. The Employees database does not have a default table defined. D. The SELECT INTO permission is not set. Answer: (int, char, char, int). 14. In the following code, what is the result of compilation? using System; using System.Data; using System.Xml; class question14 { public static void Main() { DataSet dsNw = new DataSet(); string strCn = "data source=(local);user id=sa;" + "initial catalog=northwind;"; SqlConnection cnNw = new SqlConnection(strCn); string strSQL = "SELECT * FROM Employees"; SqlDataAdapter daNw = new SqlDataAdapter(strSQL, cnNw); daNw.Fill(dsNw, "Employees"); XmlDataDocument doc = new XmlDataDocument(dsNw); doc.Save(Console.Out); } } A. No errors B. One error C. Two errors. D. Three errors. Answer: Three errors. 15. What is the result of the following SQL statement? USE Northwind DELETE Employees A. The Employees table is emptied. B. The current record is deleted. C. Syntax error, the USE command is wrong. D. The Employee database in the Northwind server is deleted.

Answer: table is emptied. 1. What definition correctly defines a label server control with the name set to lblHoop? A. <asp:Label name="lblHoop" runat="server" /> B. <Label id="lblHoop" runat="server" /> C. <asp:label id="lblHoop" runat="server" /> D. <server label name="lblHoop" runat="asp" /> Answer: <asp:label id="lblHoop" runat="server" /> 2. What ASP.NET object encapsulates the users data as it is sent from a form in a page? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: The Request object. 3. What important standard is used to connect client browsers with web servers? A. HTTP B. TCP/IP C. ASP.NET D. HTML Answer: TCP/IP 4. What ASP.NET object is used to get information about the web servers hostname? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Server object. 5. When writing server-side code, what marks are used to indicate the code block ? A. <% %> B. <!-- --> C. <@ language="c#" @> D. <asp:script runat="server" /> Answer: <% %> 6. What computer language is installed with the .NET Framework, by default? A. JavaScript B. Quick Basic C. C D. LiveScript Answer: JavaScript 7. What is the name of the process the browser uses to find the address of a web server? A. DMZ B. DNS C. Active Directory D. Database lookup Answer: DNS 8. How many rules are there regarding a well formed XML document? A. Nine B. Three C. Six D. Two Answer: Six 9. What line in the following XML document will generate an error? 1 <?xml version="1.0"> 2 <employees>

3 <employee> 4 <name>Bob Andcarrol</Name> 5 </employee> 6 <employee> 7 <Name>Robert Burns</Name> 8 </employee> 9 </employees> A. 6 B. 4 C. 1 D. There is no error. Answer: 4 10. What language is the standard web script language ECMAScript based on? A. JavaScript B. Java C. Perl D. Jscript Answer: JavaScript 11. What is the behavior of a web browser when it receives an invalid element? A. The web browser will display the element in raw form. B. The web browser will send a report to the webmaster detailing the error by using the Request object. C. The web browser will report the error, letting you debug the page. D. The browser will ignore the invalid section. Answer: ignore the invalid section. 12. What ASP.NET object encapsulates the state of the client and the browser? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Session object. 13. What object would you use if you need to support Netscape Navigator and Microsoft Internet Explorer? A. ActiveX control B. Intrinsic controls C. XML D. Java applet Answer: Java applet 14. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time? A. Synchronize() B. Lock() and UnLock() C. Lock() and Unlock() D. SingleUse() Answer: UnLock() 15. What ASP.NET object encapsulates the web site? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Application object. 1. When working with ASP.NET server controls, it is important to use the right event handlers to capture the event for the application to function properly. What event would you use to capture the selection of a new item in a DropDownList control? A. The Click event. B. The SelectionChanged event.

C. The SelectedIndexChanged event. D. The ChangedSelection event. Answer: SelectedIndexChanged event. 2. What code segment represents the event handler registration for the click eve nt of the btnA Button control? A. this.btnA.Click.Register(new System.EventHandler (this.setList)); B. this.btnA.Click.Add(new System.EventHandler (this.setList)); C. this.btnA.ClickEvent += new System.EventHandler (this.setList); D. this.btnA.Click += new System.EventHandler(this.setList); Answer: btnA.Click += 3. When an ASP.NET server control is added to a Web Form, Visual Studio .NET adds one item to the class for the form. What item is added? A. The event registration. B. A protected class member for the control. C. A default event handler for the click event. D. A default class that inherits from the controls base class. Answer: protected class member for the control. 4. When a browser requests an .aspx file and the file is displayed, what is actually returned to the browser from the server? A. HTML B. XML C. ASPX D. ASP Answer: HTML 5. What is the function of the CustomValidator? A. It allows for custom C# client-side code to validate entries in a control. B. It allows for a custom mixture of validator controls to use one central control for the display of messages. C. It uses scripted client-side code to validate the entry in a control. D. It uses server-side code to validate the entry in a control. Answer: It uses scripted client-side code to validate the entry in a control. 6. What attribute must be set on a validator control for the validation to work? A. Validate B. ValidateControl C. ControlToBind D. ControlToValidate Answer: ControlToValidate 7. The Items property of a ListBox is a reference to what kind of object? A. Item B. ListItem C. String D. Index value Answer: ListItem 8. What is the use of the WebForm.aspx.cs file? A. Holds the HTML code for the form. B. Holds the control configuration for the form. C. Holds the C# code for the codebehind module. D. Holds the C# code that will be translated into HTML on the client. Answer: for the codebehind module. 9. Given an ASP.NET Web Form called WebForm1, what class does the WebForm1 class inherit from by default? A. System.Web.Form B. System.Web.GUI.Page C. System.Web.UI.Page D. System.Web.UI.Form Answer: UI.Page

10. What layout mode is the default when a new Web Form is created? A. GridBagLayout B. GridLayout C. FlowLayout D. FormLayout Answer: GridLayout 11. When does the DropDownListBox control reload its list? A. Every time the server-side codebehind module is called. B. Every 2 minutes by default. C. When the user clicks on an entry in the control. D. Never. Answer: Every time the server-side codebehind module is called. 12. What is the Web.config file used for? A. To store the global information and variable definitions for the application. B. Configures the time that the server-side codebehind module is called. C. To configure the web server. D. To configure the web browser. Answer: To store the global information and variable definitions for the applica tion. 13. What happens if an ASP.NET server control with event-handling routines is missing the runat="server" attribute from its definition? A. The control will operate as usual; the default is runat="server". B. The control will revert to being a client-side control and function as such. C. The control will not function; the default is runat="client". D. The compilation of the application will fail. Answer: The compilation of the application will fail. 14. What happens if an ASP.NET server control with no event-handling routines is missing the runat="server" attribute from its definition? A. The control will operate as usual; the default is runat="server". B. The control will revert to being a client-side control and function as such. C. The control will not function; the default is runat="client". D. The compilation of the application will fail. Answer: not function; the default is runat="client". 15. After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesnt execute. What could the problem be? A. The AutoEventWireup attribute is set to False. B. The AutomaticPostBack attribute is set to False. C. The codebehind module is not properly compiled. D. The ListBox must be defined WithEvents. Answer: AutomaticPostBack attribute is set to False. 1. What must be done before you can consume a web service? A. Build a proxy library by using the TblImp.exe utility. B. Build a proxy library by using the Disc.exe utility. C. Build a proxy library by using the csc.exe utility. D. Build a proxy library by using the wsdl.exe utility. Answer: wsdl.exe utility. 2. You need to use the web service TempConvService. Where should you place the proxy file? A. In the lib directory off the root directory of the application. B. In the root directory of the application. C. In the bin directory off the root directory of the application. D. In the bin directory of .NET Framework. Answer: bin off the root directory of the application. 3. You need to use the web service TempConvService. What page directives correctly expose the web service? A. <%@ Page Language="c#" Debug="true" %> <%@ Import = "TempConvService" %> B. <%@ Page Language="c#" Debug="true" %> <%@ Import namespace="TempConvService" %>

C. <%@ Page Language="c#" Debug="true" %> <%@ Import ProxyNameSpace="TempConvService" %> D. <%@ Page Language="c#" Debug="true" %> <%@ Import namespace="bin/TempConvService" %> Answer: <%@ Page Language="c#" Debug="true" %><%@ Import namespace="TempConvServ ice" %> 4. You need to call a function that is located in a library named MyLibrary.dll, and this is the function signature: int MyFunc(int intAction, int intOption, uint uValue) You also need to rename the function to Func42 to avoid name conflicts in the application. Which code segment will correctly make the function available to your application? A. [DllImport("MyLibrary.dll")] public static extern int Func42 (int intAction, int intOption, int uValue); B. [DllImport("MyLibrary.dll", EntryPoint = "Func42")] public static extern int Func42 (int intAction, int intOption, uint uValue); C. [DllImport("MyLibrary.dll")] D. [DllImport("MyLibrary.dll", EntryPoint = "MyFunc")] public static extern int Func42 (int intAction, int intOption, uint uValue); Answer: "MyFunc" 6. You have been given the task of designing a web service to expose the data that is stored in a database on the server. In order to successfully build the web services, you need to import some namespaces. What is the minimum namespace you need to import? A. System.Web B. System.WebServices C. System.Web.Services D. System.Web.ServiceModel Answer: Web.Services 7. You have designed an event for the class you are working on, and the event is declared as follows: // declare the delegate for the event public delegate int MugEmptyHandler(int RefillVolume); // declare the event public static event MugEmptyHandler OnMugEmpty; When you try to register the event in the client code by using the following line, you receive a syntax error: this.OnMugEmpty += new MugEmptyHandler(this.Mug_Empty); You need to make the OnMugEmpty event functional. What will you do? A. Change the declaration of the event to indicate the parameter. B. Change the declaration of the event to indicate the return type. C. Change the declaration of the delegate to have no parameters. D. Change the declaration of the delegate to have a void return type. Answer: a void return type. 8. You are building an event handler for the SendFax event from the sFax component, and you have written the following code: private void Send_Fax() { Console.WriteLine("Fax is sent"); } When you test the event handler, you find that it never runs. What code must be added to your application to make the event execute in response to the SendFax event? A. public delegate SendFax(Send_Fax); B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); C. public event SendFax(Send_Fax); D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax);

Answer: Fax += new SendFaxHandler(this.Send_Fax); 9. Your manager has asked you to describe what you would use application variables for. What statement best describes the use of application variables? A. Application variables are used to keep state for each connected user. B. Application variables are used to keep state for the web site. C. Application variables are used to keep state for all the applications on the server. D. Application variables are used to keep state for all application objects in the web site. Answer: the web site. 10. You are using Visual Studio .NET to set up a reference to a COM component, but the reference operation fails. What is one possible solution? A. Register the COM component with .NET using TlbImp.exe. B. Register the COM component using wsdl.exe. C. Move the COM component to the bin directory of the application. D. Register the COM component in the Registry using Regsvr32.exe. Answer: Regsvr32.exe. 11. What information do you need to have in order to successfully reference a we b service using the Add Reference dialog box? A. The URI for the web services .asmx file. B. The URL for the web services .asmx file. C. The URL for the web services disco file. D. The URI for the web services disco file. Answer: URL .asmx file. 12. You have defined some web service methods, but when you test the web service, you do not have the methods available. The web service is defined as follows: [WebMethod] private void email(string to, string[] message, int option) { } What will you do to solve the problem? A. Replace the attribute with [WebServiceMethod]. B. Make the method public. C. Change the string[] to an object array. D. Change the return type to int. Answer: Make the method public. 13. You find that after running the following command line commands from the root directory of your web site that the web service is not available: >wsdl /l:cs /o:Address.cs http://localhost/Address/Address.asmx?WSDL /n:AddressService >csc /out:AddressProxy.dll /t:library /r:system.web.dll, system.dll, system.xml.dll, system.web.services.dll, system.data.dll Address.cs What will you do to make the web service available with the least amount of code and work? A. Run the following command: regsvr32 /.NET AddressProxy.dll B. Rerun the csc command specifying /o:bin/AddressProxy.dll. C. Rebuild the AddressProxy.dll file using the /AutoPost option. D. Rebuild your application after adding the reference to the web service. Answer: Rerun the csc command specifying /o:bin/AddressProxy.dll. 14. You have designed a web form that has one listbox control. You have implemented the SelectedIndexChanged event handler, and you have verified that all required declarations are in place and that the event handler is registered. During testing of the form, you find that the event does not execute . What is the most efficient way to make the event execute?

A. Set the AutoPostBack attribute of the listbox control to False. B. Set the AutoPostBack attribute of the @ Page directive to True. C. Set the AutoPostBack attribute of the listbox control to True. D. Change from the listbox control to the DropDownList control. Answer: to True. 1. What HTML element is the asp:Label control rendered as when the target is Internet Explorer? A. <label> B. <span> C. <div> D. <table> Answer: <span> 2. What HTML element is the asp:Label control rendered as when the target is Netscape Communicator? A. <label> B. <span> C. <div> D. <table> Answer: <span> 3. What is the result when a Web Form containing the following line is compiled and executed? <asp:Button id="theButton" onClick="theEvent" /> A. The button control is created; theEvent is the Click event handler. B. Compiler error; the control must be set to runat="server". C. Compiler error; onClick is not a valid attribute. D. Runtime exception; the control must be set to runat="server". Answer: Runtime exception; the control must be set to runat="server". 4. What HTML element is the asp:panel control rendered as? A. <span> B. <table> C. <div> D. <p> Answer: <div> 5. How do you specify the parameters for the ads in the AdRotator control? A. By programmatically setting the properties. B. By using an initialization file in .xml format. C. By using an initialization file in .txt format. D. By using an initialization file in .ini format. Answer: .xml format. 6. What of the following best describes a user control? A. A collection of server controls gathered in a web file with the <%@ Control %> directive. B. A collection of controls that are compiled into an assembly. C. A control that is built from multiple user-defined COM-based controls. D. A simple lightweight control that can display text only. Answer: <%@ Control %> 7. Which of the following is valid after adding the following directive to a Web Form? <%@ Register TagPrefix="WWW" TagName"WWWControl" Src="WWWControl1.ascx" %> A. <WWW:WWWControl1 id="theControl" runat="server" /> B. <asp:WWWControl id="theControl" runat="server" /> C. <WWW:WWWControl id="WWWContr" runat="server" /> D. <asp:WWWControl1 id="WWWContr" runat="server" /> Answer: WWW:WWWControl 8. You have correctly added the <%@ Register %> directive and the user-control definition in the <asp:Form> tag, but when you run the application it fails. What is the most likely cause of the failure? A. The protected class variable for the control is missing from the codebehind module.

B. The event registration is not performed; you must manually add it to the InitializeComponent event handler. C. There must be a call to the controls constructor in the Page_load() method. D. The control must be added to the Web Forms Controls collection. Answer: The protected class variable for the control is missing from the codebeh ind module. 9. After building a custom control, you test it by adding an ASP.NET web applica tion to the solution. You add a correct <%@ Register %> directive and a proper declaration of the control in the <asp:Form> tag to the Web Form, but when you execute the application you get an error. What is the most likely reason for the problem? A. The custom control must be compiled first. B. The web application must have a reference to the control. C. The custom control must be registered with Windows first. D. The assembly from the custom control is not in the applications bin directory. Answer: The assembly from the custom control is not in the applications bin direc tory. 10. You have successfully created a custom control and a web application project to test the control. The application runs with no problems, but when you look at the Design view of the Web Form, the control is displayed using an error display . What is the most efficient way to resolve the error display? A. Move the control to the web applications bin directory, and recompile the application. B. Add a reference to the control to the web application. C. Change the Bindable attribute for the Default property in the control to have a value of True. D. Manually enter the 128-bit GUID for the control in the applications configuration file. Answer: Add a reference to the control to the web application. 11. What method must be overridden in a custom control? A. The Paint() method. B. The Control_Build() method. C. The Render() method. D. The default constructor. Answer: The Render() method. 12. Your manager has asked you if ASP.NET can be used with dynamic control creation, and if it requires any extra software to make dynamic controls possibl e. What would you answer your manager? A. Yes, dynamic controls are possible using the standard control containers from ASP.NET. B. No, dynamic controls are not possible in ASP.NET. C. Yes, dynamic controls are possible in ASP.NET using a third-party assembly. D. Yes, dynamic controls are possible in ASP.NET by using the Web Services. Answer: using the standard control containers from ASP.NET. 1. What property is used to control how the user can press ALT-F to set the focu s to a control? A. AccessKey B. ControlOrder C. TabOrder D. TraceOrder Answer: AccessKey 2. You have created a localized web application that supports English, French,

German, and Spanish. After building the resource files, you code all the strings to come through the ResourceManager.GetString() method. You test the application by using the browser on your development computer, and as you switch languages in the Regional Settings, everything functions as expected. After deploying the application, you receive a message from a client saying that the application does not change when the client accesses it with a computer configured to use the French locale. You need to fix the application. What will you do? A. Rebuild the resource assembly. B. Add code to change the current threads culture to the users culture. C. Add code to change the location of the resource assembly. D. Instruct the user to upgrade to a newer browser. Answer: current threads culture to the users culture. 3. What is used to validate complex string patterns like an e-mail address? A. Extended expressions. B. Regular expressions. C. Irregular expressions. D. Basic expressions. Answer: Regular expressions. 4. What is the default language for the fallback culture? A. English. B. Swedish. C. Users setting. D. Neutral. Answer: Neutral. 5. What namespace is needed for Event Log support? A. System.Event B. System.Diagnostics C. System.EventLog D. System.Diagnostics.Event Answer: Diagnostics 6. What property controls whether the text in a TextBox control is displayed in clear text or as a collection of * characters? A. PasswordCharacter B. Hide C. Encrypt D. TextMode Answer: TextMode 7. You need to customize the error messages from your web application. What file will you modify to customize the error messages? A. Web.config B. Error.config C. Application.config D. global.asax Answer: Web.config 8. What property is set in order to display the text in reverse flow order? A. rtl B. ltr C. dir D. reverse Answer: dir 9. You have configured custom error pages for your application. When you test the pages from a co-workers computer, they display properly, but when displayed in your browser on the development computer, they display incorrectly. What will you do to correct the display of the error pages on your computer? A. Install Internet Explorer 6.0. B. Change the mode attribute to localhost in the Web.config file. C. Change the mode attribute to RemoteOnly in the Web.config file. D. Change the mode attribute to On in the Web.config file.

Answer: On in the Web.config file. 10. After adding messages to the trace log, you need to locate the output. What section contains the messages a developer has added to the trace log? A. Trace Information. B. Control Tree. C. Cookies. D. Headers Collection. E. Server Variables. Answer: Trace Information. 11. What file would you modify to implement application-wide error processing for all unhandled errors? A. Web.config B. Error.config C. Application.config D. global.asax Answer: global.asax 12. What property is used to control the order in which the controls are accesse d? A. AccessKey B. ControlOrder C. TabIndex D. TraceOrder Answer: TabIndex 13. How do you enable tracing? A. Set the Trace property of the Web Form to True. B. Set the Trace property of the Server object to True. C. Set the Session variable Trace to True. D. Set the Applications variable Trace to True. Answer: Web Form to True. 14. What control is used to validate that two fields are equal? A. RequiredFieldValidator B. RegularExpressionValidator C. CompareValidator D. The equals() method of the field. Answer: CompareValidator 15. What method is used to insert a highlighted entry in the trace output? A. Trace.Write() B. Trace.HighLight() C. Trace.Error() D. Trace.Warn() Answer: Trace.Warn() 1. What is the SQL equivalent of the DataSet relation object? A. XOR JOIN B. CROSS JOIN C. OUTER JOIN D. INNER JOIN Answer: INNER JOIN 2. Why should you close all database objects and set them to NULL before leaving the method where the objects were created? A. To ensure that the objects destructors are called. B. To ensure that the connection to the database is closed as soon as possible. C. To ensure that the objects can be reused. D. Good coding practice. Answer: connection to the database is closed as soon as possible. 3. What is the purpose of the following code segment? if ( !IsPostBack ) { sqlDataAdapter1.Fill(dsUsers1); DataGrid1.DataBind();

} A. To populate the DataAdapter the first time the web page is displayed. B. To populate the DataSet every time the web page is displayed. C. To populate the DataAdapter every time the web page is displayed. D. To populate the DataSet the first time the web page is displayed. Answer: DataSet the first time the web page is displayed. 4. Where are stored procedures saved? A. The GAC. B. The web server. C. The database server. D. The central store. Answer: The database server. 5. What is the root exception for the ADO.NET objects? A. DataException B. ADOException C. Exception D. DBException Answer: DataException 6. What best describes the xxxDataReader? A. A disconnected collection of tables. B. A manager that manages the connection to a data source, using four SQL statements. C. A connected, read-only, forward-only representation of the data source. D. The component that encapsulates the database driver. Answer: A connected, read-only, forward-only representation of the data source. 7. You are the developer of a Web Form, and you need to display data from a Microsoft SQL Server 6.5 in a DataGrid on your form. What DataAdapter is the most appropriate? A. sqlDataAdapter B. oleDbDataAdapter C. odbcDataAdapter D. adoDataAdapter Answer: oleDbDataAdapter 8. What is the purpose of the last string ("{0}") in the following code segment? DataBinder.Eval(dS1, "Tables[SP_SelUsers].DefaultView.[0].LastName", "{0}"); A. It is the formatting string for the bound data. B. It is the default value that will be used when the data is NULL. C. It is the parameter sent to the stored procedure SP_SelUsers. D. It is the placeholder for a DataBinding object. Answer: formatting string for the bound data. 9. What is the correct namespace for use with the SQL .NET Data Provider objects ? A. System.SQL B. System.Data.SqlConnections C. System.Data.SqlClient D. System.SqlConections Answer: Data.SqlClient 10. What is the correct statement to use for declaring that an xxxCommand object is used with a table? A. aCmd.CommandType = CommandType.Table; B. aCmd.CommandType = Table; C. aCmd.CommandType = "Table"; D. aCmd.CommandType = "CommandType.Table"; Answer: CommandType.Table; 11. How many sqlDataReader objects can be open on one Connection at one time? A. 4 B. 3

C. 2 D. 1 Answer: 1 12. What is the SQL wildcard character? A. * B. % C. & D. @ Answer: % 13. You need to connect to a Microsoft SQL Server version 6.5. What Connection object is the best choice? A. sqlConnection B. oleDbConnection C. ODBCConnection D. You must upgrade; there is no connection object for this database. Answer: oleDbConnection 14. You are using the try... catch block seen in the following code segment, but no exceptions are ever caught by the catch block. What is the problem? sqlConnection cn =new sqlConnection(strSQL); sqlDataSet ds; try { cn.Open(); //perform the data processing steps ... }catch(OleDbException e){ ... } A. The exception class is wrong; it should be SqlErrors. B. The exception class is wrong; it should be SqlSyntaxExceptions. C. The exception class is wrong; it should be SqlExceptions. D. The exception class is wrong; it should be SQLExcptions. Answer: SqlExceptions. 15. You are designing a Web Form that needs to have data available for as long a s eight hours at a time. Your manager has raised some concern that the database server will be unable to provide services to a large number of connected users. What object in the ADO.NET architecture will you bring to your managers attention as a possible solution? A. SQL disconnected recordsets. B. oleDbDataReader C. ODBCRecordSet D. oleDbDataSet Answer: oleDbDataSet 1. You are the developer of a web application that is retrieving historical spor ts information from a database server and displays it to the users of your applicat ion. What cache strategy will give you the best performance? A. Use the output cache. B. Use the cache object. C. Use the ASP.NET central cache. D. Use the client cache. Answer: output cache. 2. You are the developer of a web application and have decided to use the output cache in ASP.NET. Which of the following statements correctly defines the Web Form if you want to use the output cache, cache all items for 14 minutes, and store different versions of the cached objects for each customer ID? A. <%@ OutputCache Duration="840" VaryByCustom="true" %>

B. <%@ OutputCache Duration="14" VaryByCustom="true" %> C. <%@ OutputCache Duration="840" VaryByParam="Customer ID" %> D. <%@ OutputCache Duration="14" VaryByParam="Customer ID" %> Answer: 840 ustomer ID 4. You are configuring security for a web application that will be used on your company intranet. Your company is using Intel-based as well as Apple computers running Windows and other operating systems. The following is part of the Web.config file for the application: <configuration> <authentication mode="<<Enter Answer Here>>"> <forms> loginUrl="login.aspx" protection="All" timeout="30" path="/" </forms> </authentication> </configuration> What will you replace "<<Enter Answer Here>>" with to successfully have all users authenticate to the application? A. Forms B. Basic C. Digest D. Windows Answer: Forms 5. What should be added to basic authentication? A. FTP B. TCP C. SSL D. NHL Answer: SSL 6. You are deploying a web application using the XCOPY method, and you are now selecting the files that should be included in the deployment. What file extensions must be included in the deployment? Select all that apply. A. .resx B. .aspx C. .cs D. .ini Answer: .aspx 7. You have just installed IIS on your desktop computer that is running Windows 2000 Professional. Directly after the installation, you try to create a web appl ication and you are given error messages indicating that the Internet server is incompat ible with the .NET Framework. You need to create a web application, so what is the fastest way to be able to do so? A. Configure the FrontPage Server Extensions. B. Repair the .NET Framework installation from the Visual Studio .NET Windows Component update CD. C. There is no solution. Windows 2000 does not support .NET Framework web application development. D. Re-boot the computer. Answer: Repair the .NET Framework install 8. What is required in order to be able to install and use SSL on a web server? A. Export permission. B. The SSL add-on CD. C. Server certificate. D. Encryption key. Answer: Server certificate. 10. True or false. The Web.config file can be used to store configuration data f

or properties of some controls. A. True. B. False. Answer: True. 11. What tool is used to manage the GAC? A. GacMgr.exe B. GacSvr32.exe C. GacUtil.exe D. RegSvr.exe Answer: GacUtil.exe 12. What is the effect of the following code snippet from the Web.config file? ... <system.web> <authorization> <deny users="?" /> </authorization> </system.web> A. Anonymous access is denied. B. Only anonymous access is allowed. C. Users in the default group are denied access. D. There will be a syntax error when the application is executed. Answer: Anonymous access is denied. 13. You are deploying the web application you have been developing to a production server. Your application uses a number of resource assemblies and also one utility assembly that has been developed for the web application. You deploy the application by using a file-archiving utility to package all the .asp x and Web.config files into the archive, and the application is installed on the production server by un-packing the archive in the target directory. The deployment did not generate any error messages; but when you are testing the application, you find that it does not work. None of the localized resources display anything, and there are a large number of errors displayed. You need to make the application function normallywhat is the most efficient way to achieve that goal? A. Enable tracing for the application, trace to an XML file, analyze the output, and correct the source of the problems. B. Copy the /bin directory from the development system to the production server. C. Install Visual Studio .NET on the production server; enable debugging; and single-step through the application, correcting all problems as they appear. D. Abort the deployment, and inform the customer that you will be back as soon as you have found the problem. Answer: Copy the /bin directory f 14. True or false. The GAC cannot store multiple versions of the same assembly. A. True. B. False. Answer: False. 15. You are configuring your web application to require digest-based authenticat ion. What must you have in place before you can use digest-based authentication? A. A DNS server. B. Active Directory. C. Strong encryption keys. D. A strongly named Web.config file. Answer: Active Directory. 1. Which of the following methods are ways to create a Windows Form? A. Visual inheritance. B. Building a derived class from System.Windows.Forms.Form.

C. Extending a prebuilt form. D. Selecting a form class from the Inheritance Picker. E. All of the above. Answer: All of the above. 4. You want to add a control to your form that allows you to set a particular option on or off. Which control would you choose? A. Button B. CheckedListBox C. CheckBox D. ListBox E. RadioButton Answer: CheckBox 7. When you set the Localization property of a form to True, which of the following happens? A. You allow the application to accept localization resources. B. The form is translated into the language specified in the Language property. C. The property asks you for the translation language. D. The program prompts you to provide a language resource. Answer: You allow the applicat 8. By setting the Text property on the form, you will cause the value of the Tex t property to display on which part of the form? A. Bottom-right corner B. Top-right corner C. Title bar D. Status bar Answer: Title bar 10. What would the outcome of an application that contained this code be? private void Form1_Load (object sender, System.EventArgs e) { Form1.Hide(); } A. The application would not compile. B. The program would run but no form would display. C. The program would run and display the form. D. A runtime error would occur. Answer: application would not compile. 11. What would the outcome of an application that contained this code be? private void Form1_Load (object sender, System.EventArgs e) { this.Hide(); } A. The application would not compile. B. The program would run but no form would display. C. The program would run and display the form. D. A runtime error would occur. Answer: and display the form. 13. Which of the following are not methods of a System.Windows.Forms.Form object? A. Activate() B. Deactive() C. Form() D. OnCreate() Answer: Deactive() 14. Which of the following are not events of a System.Windows.Forms.Control? A. KeyPress B. KeyDown C. MousePress

D. MouseMove E. MouseEnter Answer: MousePress 15. In which namespace would you find the class Application? A. System.Application B. System C. System.Window.Forms D. System.Windows.Forms Answer: Windows.Forms 1. If you want to ask the user to select between two or more mutually exclusive options, you would employ which of the following controls? A. TabControl B. Button C. RadioButton D. CheckBox Answer: RadioButton 2. The following piece of code is intended to create a new TabPage in a TabControl. What will happen when you try to run this code? TabPage tpMyNewTabPage = new TabPage(); tpMyNewTabPage.Caption = "Add Students"; tpMyNewTabPage.Size = new System.Drawing.Size (536, 398); Button b = new Button(); tpMyNewTabPage.Controls.Add (b); A. The program compiles and executes properly. B. The program compiles and causes a runtime error. C. The program does not compile because it is unable to add the button. D. The program does not compile because of a syntax error. Answer: syntax error. 3. The following piece of code is intended to create a new TabPage in a TabControl. What will happen when you try to run this code? TabPage tpMyNewTabPage = new TabPage(); tpMyNewTabPage.Text = "Add Students"; tpMyNewTabPage.Size = new System.Drawing.Size (536, 398); Button b = new Button(); tpMyNewTabPage.Controls.Add (b); A. The program compiles and executes properly. B. The program compiles but the tab page does not show. C. The program compiles and causes a runtime error. D. The program does not compile because of a syntax error. Answer: does not show. 4. You want to validate the user input that is retrieved in a text box. Which co ntrol will assist you in displaying the error message without moving off the form? A. RichTextBox B. NotifyIcon C. HelpProvider D. ErrorProvider Answer: ErrorProvider 5. You want to validate the user input that is retrieved in a text box. Which ev ent will assist you in the validation of the data? A. UponValidation B. Validation C. Validating D. OnValidation Answer: Validating 6. Which of the following lines of code will produce a message box for the user? A. MessageDialogBox.Show ("This is your message"); B. MessageDialogBox.Show ("Message", "This is your message");

C. MessageBox.Show ("This is your message); D. MessageBox.Show ("Message", "This is your message"); Answer: MessageBox.Show 7. To dynamically add a context menu to your application, which section of code should be used? A. MenuItem m = new MenuItem(); contextMenu1.MenuItems.Add (m); B. MenuItem m = new MenuItem(); contextMenu1.MenuItem.Add (m); C. MainMenu m = new MainMenu(); contextMenu1.MenuItems.Add (m); D. MainMenu m = new MainMenu(); contextMenu1.MenuItem.Add (m); Answer: .MenuItems. 8. To produce a dialog box similar to the Windows Print dialog box, which of the following controls would you use? A. PrintPreviewDialog B. PrintDialog C. PrintBox D. SetupPrintDialog Answer: PrintDialog 9. Which property of the CheckedListBox allows you to preset the maximum number of items that can be selected? A. MaxItems B. MaximumItems C. SelectionItems D. SelectionMode Answer: SelectionMode 10. What is wrong with the following piece of code? Assume no other code has been written and you are creating the status bar dynamically. this.sbMyStatusBar.Panels[1].Text = "Panel 1"; this.sbMyStatusBar.Panels[2].Text = "Panel 2"; this.sbMyStatusBar.Panels[3].Text = "Panel 3"; A. Nothing is wrong with the code. B. It will cause a runtime error. C. There will be a syntax error found. D. The Text property is incorrect for a StatusBar. Answer: It will cause a runtime error. 11. Which line of code must be added in order to show a StatusBar? A. sbMyStatusBar.Show(); B. sbMyStatusBar.Display(); C. sbMyStatusBar.Show = true; D. sbMyStatusBar.Display = true; Answer: Show = true; 12. Which line of code will set the Link data for a LinkLabel? A. this.linkLabel1.Text = "http:\\www.microsoft.com"; B. this.linkLabel1.Link = "http://www.microsoft.com"; C. this.linkLabel1.HyperLink = "http://www.microsoft.com ; D. None of the above. Answer: None of the above. 14. Which property will allow the user to enter more than one line in a text box ? A. MaxLines B. MultipleLines C. MultiLines D. MultiLine Answer: MultiLine 15. Which control would you use to group a lot of controls together? A. GroupControl B. GroupBox

C. FrameControl D. FrameBox Answer: GroupBox 1. Which code segment will populate a DataSet? A. sqlDataProvider1.Fill (dsUsers1); B. sqlDataProvider.Fill (dataAdapter1); C. sqlDataAdapter.Fill (dsUsers1); D. sqlDataAdapter.Fill (dataAdapter1); Answer: Adapter (dsUsers1); 2. What type of commands can you create? A. Text, stored procedures, and tables. B. Text, stored procedures, and TableRows. C. Text, stored procedures, and TableDirect. D. Text, stored procedures, and TableColumns. Answer: TableDirect. 3. Data access exceptions all derive from which base class? A. Sql.Data.Exceptions B. Sql.SqlDataExceptions C. Exception D. DataException Answer: DataException 4. You need to get access to a database that is stored on a server running Microsoft Access 2002. Which data adapter would you use? A. SqlDataAdapter B. OleDbDataAdapter C. OleDataAdapter D. ODBCDataAdapter Answer: OleDbDataAdapter 5. You need to get access to a database that is stored on a server running Microsoft SQL Server 2000. Which data adapter would you use? A. SqlDataAdapter B. OleDbDataAdapter C. OleDataAdapter D. ODBCDataAdapter Answer: SqlDataAdapter 6. You want to return XML data from a Microsoft SQL Server 7.0 database. Which method would you execute? A. ExecuteXmlReader() B. ExecuteXmlData() C. ExecuteOleReader() D. ExecuteOldData() Answer: ExecuteXmlReader() 7. The Parse event is triggered after which of these occurrences? A. Data is sorted. B. Data is filtered. C. Data is bound to a control. D. Data is returned to the data source. E. All of the above. F. None of the above. Answer: returned to the data source. 8. The Format event is triggered after which occurrences? A. Data is sorted. B. Data is filtered. C. Data is bound to a control. D. Data is returned to the data source. E. All of the above. F. None of the above. Answer: All of the above. 12. Which of the following object types allow you to view read-only,

forward-only data? A. DataAdapter B. DataSet C. DataReader D. DataCommand Answer: DataReader 13. Which of the following statements is correct? A. The DataSource property refers to the dataset object, and the DisplayMember refers to the field. B. The DataMember property refers to the dataset object, and the DataSource refers to the field. C. The DataMember property refers to the field, and the DataSource refers to the dataset object. D. The DisplayMember property refers to the dataset object, and the DataSource refers to the field. Answer: DataSource 14. Why does the data not display using the following code? studentConnection.Open(); studentCommand = studentConnection.CreateCommand(); studentCommand.CommandType = CommandType.Text; studentCommand.CommandText = "SELECT * FROM Student"; studentAdapter = new SqlDataAdapter (studentCommand); studentSet = new DataSet(); this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName"); A. The command object is instantiated incorrectly. B. The dataset object is instantiated incorrectly. C. The data binding is done incorrectly. D. The dataset has not been populated. Answer: has not been populated. 1. Where should a web service proxy file be located? A. In the \bin directory of My Documents. B. In the \lib directory of the application. C. In the \bin directory of the application. D. In the \lib directory of My Documents. Answer: \bin application. 3. Which command-line tool will create a web service proxy? A. isdlam.exe B. ildasm.exe C. tlbimp.exe D. wsdl.exe Answer: wsdl.exe 4. Which command-line tool will allow you to view an assembly? A. isdlam.exe B. ildasm.exe C. tlbimp.exe D. wsdl.exe Answer: ildasm.exe 5. Which command-line tool will generate the proxy for a COM component? A. isdlam.exe B. ildasm.exeC. tlbimp.exe D. wsdl.exe Answer: wsdl.exe 6. Which of the following will display the Web Services on a remote IIS server (named www.hmr.com) in an assembly called MyServices? A. http://hmr.com/MyServices/ServiceName B. http://www.hmr.com/MyServices/ServiceName C. url://hmr.com/MyServices/ServiceName D. url://www.hmr.com/MyServices/ServiceName Answer: http://www

8. What must be done to be ready to consume a web service? A. Build a proxy library using wsdl.exe. B. Build a proxy library using csc.exe. C. Build a proxy library using TblImp.exe. D. Build a proxy library using pl.exe. Answer: wsdl.exe. 11. Which namespace is added to a program that calls a web service? A. using System.WebServices; B. using System.Web.Services; C. using System.Web.Services.List; D. using System.Web.Services.All; Answer: Web.Services; 12. Which URL will provide access to the web service called MyWebService, located in the WebServices web on the local machine? A. http://localhost/MyWebService/WebServices.asmx?WSDL B. http://localhost/WebServices/WebServices.asmx?WSDL C. http://localhost/MyWebService/MyWebService.asmx?WSDL D. http://localhost/WebServices/MyWebService.asmx?WSDL Answer: ices/MyWebS 13. A discovery file used to locate Web Services would have which extension? A. .discovery B. .discover C. .vdisco D. .disco Answer: .vdisco 14. When you test a web service, what do you expect to see as output? A. The web service running. B. The web site. C. The XML of the web proxy. D. The XML of the web service. Answer: web proxy. 15. Which attribute must be added to create an exposed web service method? A. [System.WebServices.WebMethod] B. [System.Web.Services] C. [System.Web.Services.Web.WebMethod] D. [System.Web.Services.WebMethod] Answer: Services.WebMethod] 1. Which file must be included in the assembly in order to provide a list of licensed controls within the application? A. xxxx.LIC B. xxxx.LCX C. xxxx.LICX D. xxxx.Licenses Answer: xxxx.LICX 2. You are planning to create a new control that will be used in place of the Button control. The new control will blink and change color whenever the user moves the mouse over the control. Which control type would you use? A. Derived control from the Button class. B. Derived control from the Control class. C. Derived control from the UserControl class. D. Customized control using GDI+. Answer: Button class. 1. Which tool allows you to install an assembly into the GAC? A. Ngen.exe B. Mscorcfg.msc C. Setup.exe D. sn.exe Answer: Ngen.exe

2. Which of the following accurately describes a strong named assembly? A. A private assembly with a unique name within an application domain. B. A private assembly with a unique name within a global domain. C. A shared assembly with a unique name within an application domain. D. A shared assembly with a unique name within a global domain. Answer: private global 3. Which template must be chosen from the Add New Project dialog boxs Templates list in order to have an application downloaded from an IIS (Internet Information Server) server? A. Windows Setup Project. B. CAB Project. C. IIS Project. D. Web Setup Project. Answer: Web Setup Project. 4. You have followed the steps in creating a Windows Installer Setup project, an d after deployment you notice that it does not install properly on the client. Which of the following could be the problem? A. You forgot to run the sn.exe utility. B. The shortcut was not configured properly. C. The release type is set to Debug. D. The Registry entry is incorrect. Answer: The release type is set to Debug. 5. Why did Microsoft invent assemblies? A. To allow applications to take care of their own components. B. To speed up processing. C. To confuse developers studying for the .NET development exams. D. To ensure that all components register properly in the Registry. Answer: To allow applications to take care of their own components. 7. What can be configured using the .NET Configuration tool? A. GAC cache. B. Assemblies. C. Security. D. Policy levels. E. All of the above. F. None of the above. Answer: All of the above. 8. Which of the following command-line entries would allow you to install an assembly into the GAC? A. gacutil /l myAssembly.exe B. gacutil /i myAssembly.exe C. gacutil /s myAssembly.exe D. gacutil /h myAssembly.exe Answer: Ngen.exe /cache 9. Which command would you use to list the existing files in the native image cache? A. Ngen.exe /list B. Ngen.exe /cache C. Ngen.exe /debug D. Ngen.exe /show Answer: Ngen.exe /show 11. If the redistributable package is to be installed on a server, what must be in place? A. .NET Framework B. SQL Server C. MDAC 2.6 D. CLR Answer: MDAC 2.6 12. Why is the Setup project name important? A. Setup looks for files under that name.

B. It is the name in the Add/Remove Programs dialog box. C. There cannot be any spaces in the name. D. The name goes in the Registry. Answer: It is the name in the Add/Remove Programs dialog box. 14. Which line must exist in the AssemblyInfo.cs file in order to sign the assembly? A. [assembly: AssemblyKeyFile("")] B. [key: AssemblyKeyFile("")] C. [assembly: AssemblyKeyFile("myKeys.snk")] D. [key: AssemblyKeyFile("myKeys.snk")] Answer: assembly myKeys.snk 15. Where is the GAC located by default? A. Windows directory. B. Programs directory. C. Documents and Settings directory. D. Application directory. Answer: Windows directory. 1. You are responsible for adding localization to an existing Windows Form. What class will determine the locale of the runtime environment? A. ResourceManager B. Localization C. Globalization D. CurrentUICulture Answer: CurrentUICulture 2. Which tool can you use to configure the security settings for an application? A. mscorcfg.msc B. ngen.exe C. caspol.exe D. caspol.msc Answer: mscorcfg.msc 3. Which tool can you use to precompile a Windows application? A. mscorcfg.msc B. ngen.exe C. caspol.exe D. caspol.msc Answer: ngen.exe 4. Which security file will override the machine configuration file? A. Enterprise configuration B. Application configuration C. Security configuration D. User configuration Answer: Application configuration 9. What are the three different policy-configuration files? A. Enterprise, Machine, User. B. Enterprise, Machine, Local. C. Enterprise, Security, Local. D. Enterprise, Security, User. Answer: Ent Mac User. 11. What type of array is the most efficient to work with? A. Rectangular array B. One-dimensional array C. Two-dimensional array D. Jagged array Answer: Jagged array 12. Which code-access class can be used to represent permissions related to network access? A. NetworkPermission B. RemotePermission C. URLPermission

D. SocketPermission Answer: SocketPermission 13. Which of the following represents a union of permissions? A. A collection of code groups. B. A collection of permissions. C. A collection of intersections. D. A collection of evidence. Answer: code groups. 15. What must be done to create a ToolTip on a new Windows control? A. Add a ToolTip control and set the ToolTip property of the new control. B. Set the ToolTip property of the new control. C. Set the Help property of the new control. D. Create a MessageBox that displays when the user clicks the new control. Answer: Create a MessageBox 3. Which namespace must be added to the XML web service in order to write to an event log? A. System.EventLog B. System.Events C. System.Diagnostics D. System.Diagnostics.Event Answer: Diagnostics 4. Which technology allows you to publish XML web services? A. XMLPub B. XSLT C. XPath D. UDDI Answer: UDDI 6. Which of the following describes the elements that make up a SOAP message? A. Envelope, Header, Body, Fault. B. Envelope, Header, Body, Error. C. Envelope, Body, Fault. D. Envelope, Header, Fault. Answer: En He Bo Fa 7. Which of the following technologies are used to describe a web service in ter ms of the messages that it creates and the messages that it accepts? A. XMLS B. XSLT C. CORBA D. WSDL Answer: WSDL 8. What is the default namespace for a new web service? A. http://localhost B. http://www.w3.org C. http://tempuri.org/ D. http://www.microsoft.com Answer: tempuri.org/ 10. How would you add a web service component to your Visual Studio .NET application? A. Project | Add Web Component B. Project | Add Component C. Project | Add Web Service D. Project | Add Service Answer: Add Service 11. A static discovery file will usually have a file extension of which of the following? A. .vsdisco B. .vdisco C. .sdisco

D. .disco Answer: .disco 12. Which of the following technologies is a lightweight protocol for exchange o f information in a decentralized, distributed environment? A. XML B. WSDL C. XSD D. SOAP Answer: SOAP 13. Which of the following technologies is a file that defines the structure and data types for XML documents? A. XSD B. XMLD C. XSLT D. XSL Answer: XSL 14. You are creating an application that will employ the services of an applicat ion that resides on a remote server. Which of the following protocols should be used to encode the message to the remote server? A. SOAP B. XML C. RPC D. DCOM Answer: SOAP 15. A WSDL document is a file that contains definitions for which of the followi ng? A. Types, Messages, Bindings. B. Types, Messages, portTypes, bindings, services. C. Types, portTypes, bindings, services. D. Messages, portTypes, bindings, services. Answer: Ty Me po bi se 2.You are creating a Windows service for Windows ME. You want to install the service in the Registry. What utility will do this for you? A. gacutil.exe B. regsvsc.exe C. sc.exe D. installer.exe E. None of the above. Answer: None of the above. 3. Which project template will allow you to create a background service in Visual Studio .NET? A. Windows service. B. Web service. C. Windows application. D. Service. Answer: Windows service. 5. You have created a serviced component that will interface with COM+ services. You want to register the component manually. Which utility will allow you to do this? A. gacutil.exe B. regsvsc.exe C. install.exe D. sc.exe Answer: regsvsc.exe 6. You have created a serviced component that will interface with COM+ services. You want to register the component automatically. Which utility will allow you to do this?

A. gacutil.exe B. regsvsc.exe C. xcopy.exe D. sc.exe Answer: xcopy.exe 8. Where would you find the Add Installer link within Visual Studio .NET? A. Under the Project menu. B. Under the Build menu. C. In the Toolbox. D. In the Properties Explorer window. Answer: Explorer window. 9. Which of the following methods will install a Windows service? Choose all that apply. A. xcopy.exe B. regedit.exe C. setup.exe D. service.exe Answer: setup.exe 10. A Windows service must inherit from which class? A. System.Service.ServiceBase B. System.ServiceProcess.Service C. System.ServiceProcess.ServiceBase D. System.Service.Service Answer: ServiceBase 11. Which Registry key would lead you to find the installed Windows service? A. HKEY_LOCAL_MACHINE\Services B. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services C. HKEY_LOCAL_MACHINE\System\Services D. HKEY_LOCAL_MACHINE\CurrentControlSet\Services Answer: System\Curren 13. Which class will allow you to programmatically work with your Windows servic e? A. ServiceController B. ServiceConfiguration C. ServiceStatus D. ServiceControl Answer: Controller 14. Which method of the ServiceController class will allow you to send a command to the service? A. Stop() B. Start() C. Pause() D. ExecuteCommand() Answer: ExecuteCommand() 15. Which of the following services represent the services that together provide an enterprise application? A. Business, Logic, Application B. Application, Business, Data C. Presentation, Business, Data D. Presentation, Logic, Data Answer: Pre Bu Data 2. In order to have your server component accept method calls that pass the object by value, your remote server object must implement which interface? A. IUnknown B. IMarshalByValue C. IMarshalByRef D. ISingleCall E. ISerializable Answer: ISerializable

3. You are in charge of creating a remote object that will return database recor ds to the caller of the method. You want to ensure that the object keeps track of the number of requests, and writes the number out to the database. Which activation mode would you use? A. SingleCall B. Singleton C. Client-activated D. Server-activated Answer: Singleton 4. You have created a remote object, ChatServer.dll, that is to be deployed to an IIS server. You need to create a configuration file that will provide locatio n and type information. Which file would you create? A. web.config B. machine.config C. application.config D. ChatServer.exe.config Answer: web.config 11. To which namespace does the Activator class belong? A. System B. System.Remoting C. System.Remote D. System.Remoting.Activation Answer: System 13. To which namespace does the HttpChannel class belong? A. System.Remoting B. System.Runtime.Remoting.Channels.Http C. System.Runtime.Remoting D. System.Runtime.Remoting.Channels Answer: Channels.Http 14. Which line of code will register a channel? A. ChannelServices.Register (channel); B. ChannelServices.RegisterChannel(4242); C. ChannelServices.Register (4242); D. ChannelServices.RegisterChannel(channel); Answer: Channel(channel); 15. In which directory does the <application_name>.exe.config file belong? A. In the bin directory of the application. B. In the root directory of the application. C. In the \Winnt\System32 directory. D. In the \Program Files\Microsoft.NET directory. Answer: root directory 2. Your manager has asked you about interoperability between XML Web Services and an existing CORBA environment. What wire protocol will you tell your manager about that will interoperate with CORBA? A. RPC B. COM+ C. SOAP D. DCOM Answer: SOAP 3. When discussing the XML Web Services architecture, which sentence best describes the service broker node? A. Broadcasts the available services. B. Advertises the available services in Active Directory. C. Advertises the services that are registered in the Registry. D. Assists the consumer to find the provider that supplies a particular web service. Answer: consumer

5. You want to ensure that your web method uses the cache for results, so you change the web method attribute to [WebMethod(BufferResponse = true)]. When you investigate, you find that your web method still is not using the cache. What is the most efficient way of ensuring that your web method uses the cache? A. Add CacheTime=300 to the WebMethod attribute. B. Add Cache=true to the WebMethod attribute. C. Add EnableCache=true to the WebMethod attribute. D. Add CacheDuration=300 as a parameter to the WebMethod attribute. Answer: parameter to t 6. What is the name of the root element in a WSDL document? A. definition B. wsdl_root C. xml_root D. root Answer: definition 8. What sentence best describes loosely coupled components? A. Both components use a common event model to communicate. B. Both components use public variables and methods to communicate. C. Both components use only public methods to communicate. D. Both components use asynchronous methods to communicate. Answer: asynchronous 9. You need to build a proxy class for an XML web service. What tool will you us e? Select all that apply. A. cdc.exe B. wsdl.exe C. proxy.exe D. disco.exe Answer: wsdl.exe 10. When you create an XML web service, it is stored in a source file. What is t he extension of that source file? A. .xmls B. .asxm C. .asmx D. .asxml Answer: .asmx 11. By adding the [WebService(Namespace="http://xxx.yyy")] attribute in front of the class that defines the XML web service, you modify a namespace. What is that namespace? A. The namespace of the XML web service. B. The default namespace of the SOAP messages. C. The namespace of the ASP.NET server. D. The default URL that all redirections will go to. Answer: XML web service. 12. By setting the EnableSession property to True, you have access to what resources? A. Nothing. You need to create the session first. B. Session variables. C. Application variables. D. Local variables stored in the Web Method session. Answer: Session variables. 13. The XML Web service broker stores information about the XML web services that have published their services to the broker. What structure does the servic e broker store the information in? A. Broker registry. B. Windows Registry. C. UDDI registry.

D. XML document. Answer: UDDI registry. 14. True or false? XML documents contain the data model of the data they contain . A. True B. False Answer: True 15. After creating a proxy class, you compile it. What type of file will the pro xy be compiled to? A. .dll B. .asmx C. .aspx D. .proxy Answer: .dll 1. What namespace must be used in order to use the DOM for XML support? A. System.Data.Xml B. System.Xml C. System.Xml.DOM D. System.DOM Answer: System.Xml 4. True or False. XML Transformations can be used to create a form letter. A. True. B. False. Answer: False. 6. You are parsing an XML document using an XmlReader. You find that the resulting node tree is very large compared to the number of elements and attributes in the XML document. Why would the result of the parsing produce a large node tree? A. The WhitespaceHandling parameter is set to WhitespaceHandling.All. B. The WhitespaceHandling parameter is set to WhitespaceHandling.None. C. The WhitespaceHandling parameter is set to WhitespaceHandling.Auto. D. The WhitespaceHandling parameter is set to WhitespaceHandling.Special. Answer: .All. 7. Which of the following classes supports XML schemas? Select all that apply. A. XmlReader B. XmlDocument C. XmlValidatingReader D. XmlNodeReader Answer: ValidatingReader 8. You are developing an application that will connect to a Microsoft SQL Server 6.5, and you need to select the appropriate ADO.NET connection object for this database server. What ADO.NET connection object is the most appropriate? A. XxxConnection B. SqlConnection C. OleDbConnection D. OdbcConnection Answer: OleDbConnection 14. When you build the schema of a DataSet, you need to model the data types of the data that will reside in the DataColumn objects. What data type would you use to represent a date? A. date B. day C. System.DateTime D. variant Answer: DateTime 15. True or False. HTML must be well formed to be used with XML. A. True. B. False.

Answer: True. 1. You need to create a UDDI registry for your company. What are your options regarding private UDDI registries? A. Use the Private UDDI SDK from Microsoft. B. Implement your own private UDDI registry by implementing the entire UDDI specification. C. Implement a custom publish/discover architecture. D. Hard-code the endpoints. Answer: UDDI registry 1.Which of the following statement about C# varialble is incorrect ? Answer: variable is a computer memory location identified by a unique name 2. The.types feature facilitates the definition of classes ,structures and interfa ces over multiple files? Answer: partial 3. The....class is a variable-length array that can dynamically increase or decre ase in size? Answer: ArrayList D. SortedList Answer: The.interface defines methods to control the different generic collections? A. ICollection 5. The default capacity of an ArrayList class is.....? Answer:24 6. in C# ...are created using delegates Answer: events 7. Which of the following code declare the delegate Calculation with the return type and the parameter types as integer ? Answer: public delegate int Calculation(int numOne,int numTwo); 8. The.......constructor initialises an object of the ArrayList class with the s pecified initial capacity as the parameter . Answer: ArrayList(int) 9. Which of the following statements about the different data types in C# are co rrect? Answer: Reference type variables store memory address of other variables in a st ack . D. int and class are examples of value and reference type variables respectively . 10. Which piece of code display a float value as string ? Answer: float flotNum = 500.25F; string stNum = flotNum.ToString(); Console.WriteLine(stNum); C. float flotNum = 500.25F; String stNum = flotNum.ToString(); Console.WriteLine(stNum); 11. An ....method is created when you instantiate or reference a delegate with a b lock of ... code. Answer: anonymous, unnamed D.unnamed,anonymous 12. The...........exception is thrown when the stack runs out of space while the.. ......exception is thrown when the result of an arithmetic,casting or conversion operation is larger in size than the destination object or variable. Answer: NullReferenceException, StackOverFlowException D. StackOverflowException, OverflowException 13. What is the output of the following code ? int num =5; while(num>0) { if(num>4) {

Console.WriteLine(num+""); } --num; if(num--= =4) { Console.WriteLine("(0)",num); } if(num==3) { Console.WriteLine("{0}",num); } num--; } Answer: 503 14. Which of the following statements about delegates are correct ? Answer: Delegates are objects that contains references to methods that need to b e invoked . 14. Which of the following statements about delegates are correct ? Answer: Delegates can be associated with methods provided they have the same ret urn type and parameter type. 15. Managing memory and verifying code safety are functionalities of........ Answer: Common Language Runtime 16. Restriction or constraints can be applied to type parameters by using the... ...keyword . Answer:where 17. Which of the following statements about the different operator are correct ? Answer: The Addition operator performs concatenation of strings if the operands are strings 17. Which of the following statements about the different operator are correct ? Answer: The Boolean inclusive OR operator returns true if at least one the expre ssion is true 17. Which of the following statements about the different operator are correct ? Answer: The Relational operators return a boolean value depending on the compari son being made 18. Which of the following statements about the partial class are correct ? Answer: Partial classes are the only types in C# that support partial definition s 18. Which of the following statements about the partial class are correct ? Answer: Partial classes can be defined over multiple locations to store differen t members 18. Which of the following statements about the partial class are correct ? Answer: Partial classes allow multiple developers to work on separate sections s imultaneously 19. Which of the following statements about System.Collections.Generic namespace classes are correct ? Answer: The List<T> class provides a generic collection of items that can be dyn amically resized 19. Which of the following statements about System.Collections.Generic namespace classes are correct ? Answer: The Queue<T> provides a generic collection that follows the First-In-Fir st-Out principle 19. Which of the following statements about System.Collections.Generic namespace classes are correct ? Answer: The Dictionary<K,V> provide a generic collection of sorted key and value pairs 20. The .........class is a combination of the.......and........class es. Answer: SortedList,Hashtable,ArrayList 21. Which of the following statements about the defferent types of C# statements

are correct ? Answer: Iteration statements help you to repeatedly execute a block of code with in program . 21. Which of the following statements about the defferent types of C# statements are correct ? Answer: Exception handling statements manage situation that hinder the normal ex ecution of the program. 22. The........method of the ArrayList class copies the elements of a list to an array while the........method also copies elements of a list to an array of typ e Object. Answer: CopyTo,ToArray 23. Which of the following statements about constraints on type parameters are c orrect ? Answer: The T:<base class name> specifies that the type parameter must be a pare nt class or its successor. 23. Which of the following statements about constraints on type parameters are c orrect ? Answer: The T:<interface name> specifies that the type parameter must be an inte rface or should inherit an interface. 24. Which of the following statements about generic methods are correct ? Answer: Generic methods process values whose data types are known only when they are accessed 24. Which of the following statements about generic methods are correct ? Answer: Generic methods can be declared within generic or non generic class decl aration. 25. Can you re-arrange the steps given below to implement delegates in C# ? Declare a delegate Call method using the delegate object Create method to be referenced by delegate Instantiate the delegate B. A C D B 26. The SortedList class behaves like an ......if you access its elements based on their index number otherwise it behaves like a.......... Answer: array,hash table 27. Which of the following statements about generics are correct ? Answer: Generic allow you to reuse the code in a safe manner without casting or boxing. 27. Which of the following statements about generics are correct ? Answer: Generics always accept a type parameter,which is a placeholder for the r equired date type. 28. Which of the following keywords are associated with iteration statements? Answer: foreach 29. Which of the following statements about C# are correct ? Answer: C# applications can easily use or integrate code written in other .NET l anguages. 29. Which of the following statements about C# are correct ? Answer: C# can be used to develop both,simple standalone and distributed applica tion. D. C# applications are easy to deploy because of its support for XML and SOAP. 30. .......are a kind of parameterized data structure that can work with value typ es as well as reference types. Answer: Enumerator 31. A.......is a set of items of same or different data types. Answer: collection 32. The.........property of the System.Exception class returns the Exception ins tance that caused the current exception. Answer: Message 33. Exception thrown due to arithmetic operations or null object reference are.. .........exceptions. Answer: system-level

35. Exceptions thrown due to failure in database connection or network connectio n are examples of.........exceptions Answer: application-level 36. The........fields are accessible by other classes but......fields are accessibl e only by the class in which they are declared. Answer: public,private 37. The.......interface supports simple iteration over elements a generics ? Answer: IEnumerator 38. The.........exception is thrown when a value is assigned null object . Answer: NullReferenceException 39. Which of the following statements about delegates in C# are correct? Answer: delegate can invoke one method at a time. 39. Which of the following statements about delegates in C# are correct? Answer: delegate can encapsulate static methods. 39. Which of the following statements about delegates in C# are correct? Answer: delegate is declared using the delegate keyword 40. ........allow you to reuse a code for different data types. Answer: Generics 41. Which of the following statements about exceptions are correct ? Answer: The System.Exception class is the base class that allows you to handle a ll exception. 41. Which of the following statements about exceptions are correct ? Answer: The System.Exception class contains properties that are common to all ex ceptions. 42. An......method is an inline nameless block of code that can be passed as a d elegate parameter ? A. anonymous B. named C. partial D. unnamed 43. Which of the following statements about Visual Studio 2005 IDE key elements are correct? (chon 1 dap an!) A. The code Editor facilitates writing, display and aditing of form, event, and method code. B. The Dynamic help window provides a list of topics depending on the active IDE area or task. D. The Solution Explorer provides an organized view of projects and access to th eir commands. 44: Which of the following statements about expressions and statements are corre ct? Answer: Statements may or may not return values, but expressions always return v alues. Which of the following statements about expressions and statements are correct? Answer: Compilers execute statements and since expressions are part of statement s, they are executed with them. 45: The Visual Studio 2005 edition is a proper choice for students enthusiasts a nd hobbyists? (chon 1 dap an!) Answer: Standard 46: The class is a combination of the Hashtable class and the ArrayList class? Answer: SortedList 1. Under which of the following environments does your programs execution code run? A. MSIL B. CLS C. CLR D. VB .NET Answer: CLR 2. What is the compiler called that converts IL code into platform-specific code ? A. MSIL-converter

B. JIT C. JTI D. Metadata Answer: JIT 3. What is the output format of the file the C# compiler produces? A. Byte code B. IL C. Hex dump D. Intel Assembler Answer: IL 4. Given the following program, what is the outcome when you try to compile and run it? using System; class Test { public static int Main() { Console.WriteLine("Hello World!"); } } A. It will compile and print Hello World! when run. B. It will compile and result in a runtime error indicating that the Console is an unknown object. C. It will fail to compile with an error CS0161: Test.Main( ) : not all code paths return a value. D. It will fail to compile with an "error CS0161: Test.Main( ): method cannot return an int". Answer: not all code 5. Hiding the implementation and exposing the interface is a concept of OOP called: A. Polymorphism B. Encapsulation C. Overloading D. Static Answer: Encapsulation 6. Which of the following statements is true? A. A class is the implementation of an object. B. An object is the implementation of a class. C. A class is the instantiation of an object. D. An object is the instantiation of a class. Answer: object is instantiation 7. Which of the following is the correct way to declare the method GetPayCheck()? A. public int GetPayCheck()

B. private int GetPayCheck() C. private void GetPayCheck(int a) D. public void GetPayCheck(int a) Answer: public int GetPayCheck() 8. Which is a definition of a static method? A. public static MethodA() B. public void MethodA() C. private static MethodA() D. public static void MethodA() Answer: public static void MethodA() 9. Which of the following languages is not part of the current .NET languages? A. Visual Basic B. C# C. C++ D. FoxPro Answer: FoxPro 10. In order to compile a C# program from the command line, what command would you use? A. cmd B. comp C. csc D. daml Answer: csc 1. Given the following code segment, what will the value returned from the method be? public int ViktorMove() { int x = 42; int y = 12; int w; object o; o = x; w = y * (int)o; return w; } A. 504 B. 491 C. 42 D. Runtime error, Null Pointer exception! Answer: 504 2. When will the garbage collector run? A. Every 15 minutes. B. Once every day at 13:00. C. When the application is low on memory. D. Randomly based on the resource load on the system. Answer: When the application is low on memory. 3. The statement that is used to replace multiple if statements is called: A. The case statement. B. The switch statement. C. The nestedif statement. D. The #endif statement. Answer: The case statement. 4. Which of the following is not a C# keyword? A. if B. delegate C. private D. implements Answer: implements 5. Choose the correct method for declaring a namespace:

A. namespace Osborne.Chapter5 B. namespace Osborne.Chapter5; C. namespace Osborne.Chapter5.MyClass D. namespace Osborne.Chapter5.MyClass; Answer: namespace Osborne.Chapter5; 6. Determine the output of the following code segment: int x = 42; x++; x += --x; System.Console.WriteLine ("The value of x is : {0}", x); A. 84 B. 83 C. 86 D. 85 Answer: 85 1. Given the following code, what will the compiler do? class Test1 { sealed abstract void MyMethod1A() { System.Console.WriteLine ("This is MyMethod1"); } } A. The code will compile properly. B. The class visibility is incorrect. C. System.Console.WriteLine is specified incorrectly. D. MyMethod1() is not properly declared. Answer: MyMethod1() is not properly declared. 2. Which line causes a compile error in the following code? 1. interface Test2 2. { 3. int Int2; 4. void Method2A(int); 5. string Method2B (); 6. int Method2C(int, int); 7. int Method2A(char); 8. } A. Line 3 B. Line 4 C. Line 5 D. Line 7 Answer: Line 3 3. What is the outcome of compiling this program? 1 public class Test3 2 { 3 void Method3A () 4 { 5 System.Console.WriteLine ("In Method3A"); 6 } 7 } 8 class Test3a: Test3 9 { 10 void Method3B () 11 { 12 Method3A(); 13 } 14 } 15 class Test3b 16 {

17 public static void Main() 18 { 19 Test3a a = new Test3a(); 20 a.Method3B(); 21 } 22 } A. It compiles successfully. B. Lines 12 and 20 are in error. C. Line 12 is an error. D. Line 20 is the error. Answer: 12 and 20 are in error. 4. What will happen on line 24? 1 class Test4 2 { 3 int test4a; 4 string test4b; 5 float test4c; 6 virtual public void Test4D () 7 { 8 System.Console.WriteLine("Hello") 9 } 10 } 11 class Test4a: Test4 12 { 13 override public void Test4D () 14 { 15 System.Console.WriteLine ("Goodbye"); 16 } 17 } 18 class Test4b 19 { 20 public static void Main() 21 { 22 Test4a t = new Test4a(); 23 Test4 t1 = t; 24 t.Test4D(); 25 } 26 } A. The compiler finds an error. B. A runtime error occurs. C. It prints Goodbye. D. It prints Hello. Answer: Goodbye. 5. What is the result of the following code? class Test5 { public Test5 ( ) { System.Console.WriteLine ("Test5 1"); } public Test5 (int num) { System.Console.WriteLine ("Test5 2"); } } class Test5a { public Test5a (): base(5) { }

public Test5a(int numb): base() { } } class Test5b { public static void Main() { Test5a t = new Test5a(12); } } A. It prints Test5 1. B. It prints Test5 2. C. It does not compile. D. It does not run. Answer: Test5 1. 1. Given the following code segment, what is the content of the string s in line 4? 1 string s = "Hello"; 2 string r; 3 r = s; 4 r += " World!"; A. Hello World! B. Hello C. Nothing, it is garbage collected D. The code will not compile Answer: Hello 2. Which of the following array declarations will produce a compiler error? A. int[] Integers = new int[] (1,2,3,4,5,6,7,8,9,0}; B. int[] Integers = new int[42]; C. int[] Integers = {1,2,3,4,5,6,7,8,9,0}; D. int I = 4; int[] Integers = new int[I] {1,2,3,4}; Answer: new int[I] 3. In the following code, what will be printed by the Console.WriteLine() method? string[] str = {"Hello", "!", "World"}; Array.Reverse(str); Console.WriteLine(str[0]); A. ! B. Hello C. olleH D. World Answer: World 4. In the following code, what will be printed by the Console.WriteLine() method? string[] str = {"Hello", "!", "World"}; Array.Sort(str); Console.WriteLine(str[0]); A. ! B. Hello C. olleH D. Hello World ! Answer: "!" 5. What is the outcome of the following code? 01 public void MethodB () 02 { 03 int [] MyInts = new int [2]; 04 try

05 { 06 for ( int i = 0; i < 3; i++) 07 { 08 MyInts[i] = i; 09 } 10 } catch (System.Exception e) 11 { 12 System.Console.WriteLine ("Some error occurred"); 13 } 14 } A. The code will not compile because there is an incorrect catch block. B. The code will not compile because of an error on line 6. C. The code will compile and displays Some error occurred. D. The code will compile and will abort upon execution. Answer: Some error occurred 6. What is the outcome of the following code? 01 public void MethodB () 02 { 03 int [] MyInts = new int [2]; 04 try 05 { 06 for ( int i = 0; i < 3; i++) 07 { 08 MyInts[i] = i; 09 } 10 } finally 11 { 12 System.Console.WriteLine ("This is executed"); 13 } 14 } A. The code will not compile because there is a missing catch block. B. The code will compile and abort upon execution. C. The code will compile and displays This is executed. D. The code will compile and will abort upon execution and then display This is executed. Answer: This is executed 7. You need to define a delegate for the following method: public class Class1 { public static int Method42(int i) { return i*42; } } How is the delegate for Method42() declared? A. delegate Class1.Method42; B. delegate int Met42(int i); C. delegate void Method42(string s); D. delegate int Class1.Method42(int i); Answer: delegate int Met42(int i); 8. What kind of delegate will be created for the following method? public void Method12(object sender, System.EventArgs e) { } A. Single delegate B. Event delegate C. Multicast delegate D. Proxy delegate Answer: Multicast delegate

9. The following code segment creates an event handler. What text must be inserted in place of <<replace text here>> for the event to work? // declare the delegate for the event public delegate void SendFaxEventHandler(); public class Fax { // declare the SendFax event public <<replace text here>> event SendFaxHandler SendFax; // } A. void B. delegate C. Combine D. static Answer: static 10. You are building an event handler for the SendFax event from the sFax component, and you have written the following code. When you test the event handler, you find that it never runs. What code must you add to your application to make the event execute in response to the SendFax event? private void Send_Fax() { Console.WriteLine("Fax is sent!"); } A. public delegate SendFax(Send_Fax); B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); C. public event SendFax(Send_Fax); D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax); Answer: SendFax += new SendF 1. You want to see all the methods of a particular class that you are using in y our application. Which tool would you use? A. Class Viewer B. Object Browser C. Class Explorer D. Object Explorer Answer: Object Browser 2. You want to change the color of the text in the code window. Which menu item would you select? A. View | Options B. Tools | Customize C. View | Customize D. Tools | Options Answer: Tools | Options 3. Which key combination will allow you to compile your console application and leave the console window open? A. CTRL-F5 B. ALT-F5 C. F5 D. SHIFT-F5 Answer: CTRL-F5 4. To create a class file that can be added to a library, you would select which project type? A. ASP.NET Web Application B. Class Library C. Console Application D. Web Control Library Answer: Class Library 1. What is the name given to the type of assembly that contains localized

resources? A. Spoke B. Hub C. Sputnik D. Satellite Answer: Satellite 2. What is the correct name for a resource file with images for the English cult ure, in the United States subculture? A. images.US-en.resources B. images.en-US.resources C. resources.images.en-US D. images.en-US.dll Answer: es.en-US.resources 3. What is the minimum number of assemblies a .NET application can have? A. 0 B. 1 C. 2 D. 3 Answer: 1 4. How is the metadata for an assembly stored? A. In the Registry. B. In .ini files. C. As XML in the manifest. D. As a Type Library (.tlb) file. Answer: As XML in the manifest. 5. What tool is used to manage the assemblies in the Global Assembly Cache? A. gacmgr.exe B. gacutil.exe C. gassy.exe D. al.exe Answer: gacutil.exe 1. What is the code for the German language? A. ge B. gb C. de D. dk Answer: de 2. What namespace contains the ResourceManager class? A. System.Localization B. System.Resources C. System.Globalization D. System.Threading Answer: Resources 3. What is the process called that converts a primitive to a class? A. Primary B. Boxing C. Conversion D. Encoding Answer: Boxing 4. Which of the following code segments will correctly display the string resour ce txtHello? (All objects are correctly created.) A. Console.Write(rm.ToString("txtHello"); B. Console.WriteLine(rm.Strings("txtHello"); C. Console.Write(txtHello.ToString("s")); D. Console.Write(rm.GetString("txtHello")); Answer: rm.GetString("txtHello") 5. What does the following command do?

csc /res:strings.resources HelloGlobalWorld.cs A. Builds only the HelloGlobalWorld program. B. Builds the HelloGlobalWorld and links the fallback resource. C. Creates an assembly for the HelloGlobalWorld program. D. Creates a name resolution report for the HelloGlobalWorld program. Answer: Builds the HelloGlobalWorld and links the fallback resource. 6. When localizing a web application, you find that you need to encode Unicode characters that are sent to the client. What attribute would you set? A. ResponseEncoding="UTF-8" B. Encoding="UTF-8" C. ResponseCode="UTF-8" D. EncodedResponse="UTF-8" Answer: ResponseEncoding="UTF-8" 7. What happens when the Resource Manager fails to find the localized resource for a locale? A. It uses the closest locale. B. It throws an exception. C. Nothing, the resource will be blank. D. It uses the fallback resource. Answer: the fallback resource 8. What namespace contains the CultureInfo class? A. System.Localization B. System.Resources C. System.Globalization D. System.Threading Answer: Globalization 9. Do you have to produce all the locale-specific assemblies before deploying th e application? A. Yes, the assemblies must be present for the final compile of the application. B. Yes, the fallback manifest must be built from all the satellite assemblies. C. Yes, the .NET Framework must update the registry with all the information at deployment. D. No, the satellite assemblies can be deployed at will after initial deployment . Answer: No, the satellite assemblies can be deployed at will after initial deplo yment. 10. In the following code segment, what is the significance of the "Strings" lit eral? static ResourceManager rm = new ResourceManager("Strings", Assembly.GetExecutingAssembly()); A. Arbitrary name for the assembly. B. The base name of the resource to be loaded. C. The base name of the assembly to be loaded. D. Alias for the Resource Manager. Answer: the resource to be loaded 11. Where in the object model is the information relating to the date format sto red for a specific locale? A. ResourceManager B. CultureInfo C. LocalFormat D. Reflection Answer: CultureInfo 12. Your application is called AccountingOne.exe. What must the name of the French string resource be? A. AccountingOne.resources.dll B. strings.resources C. strings.fr.resources.dll D. strings.fr.resources

Answer: strings.fr.resources 13. What does the attribute dir="rtf" stand for? A. The direction of RTF files. B. The encoding of RTF files. C. The direction for the display of characters. D. A directory listing of all RTF files. Answer: for the display of characters. 14. Your application is called AccountingOne.exe. What must the name of the satellite assemblies be? A. Accountingone.resources.dll B. accounting.Resources.dll C. AccountingOne.resources.dll D. Accounting.resources.dll Answer: untingOne 1. Which command will cause an XML file to be generated from documentation comments? A. csc MyClass.cs /doc:MyClass.cs B. cscd MyClass.cs /doc:MyClass.xml C. cscd MyClass.cs /doc:MyClass.cs D. csc MyClass.cs /doc:MyClass.xml Answer: csc .xml 2. Which line causes the following XML to be not well-formed? <VideoList> <tape> <name>XML is cool!</name> </VideoList> </tape> A. <tape> B. </VideoList> C. </tape> D. <name>XML is cool!</name> Answer: </VideoList> 3. Which XML rule does the following break? <employees> <Employee> <name>Kenneth S. Lind</name> </Employee> <employee> <name>Marj Rempel </employee> </employees> A. There must be a single root element. B. There must be matching opening and closing tags. C. XML is case-sensitive. D. All attributes must be in quotes. Answer: be matching opening and closing tags. 4. Which XML rule does the following break? <employees> <employee> <name id=123>Kenneth S. Lind</name> </employee> <employee> <name id=456>Marj Rempel</name> </employee> </employees> A. There must be a single root element. B. There must be matching opening and closing tags. C. XML is case-sensitive. D. All attributes must be in quotes.

Answer: All attributes must be in quotes. 5. Visual Studio .NET provides a tool to generate HTML from the XML documentation file. It is found where? A. Tools | Generate XML B. Tools | Generate HTML C. Tools | Build Comment Pages D. Tools | Build Comment Web Pages Answer: Web Pages 6. Which XML line(s) generates an employee attribute? A. <employee name="Ken"> B. <employee attribute name="Ken"> C. <employee Name= Ken > D. <employee attribute Name= Ken > Answer: ee name=/ee Name= Ken 7. Which of the following lines is an XML declaration? A. <xml version="1.0"> B. ?xml version="1.0"? C. <?xml version=1.0?> D. <?xml version="1.0"?> Answer: <?xml version="1.0"?> 8. Why will the following XML code not be rendered by a browser? <name> <lastname>Dowdy</lastname> <firstname>Howdy</firstname> </lastname> A. The browser is not specified. B. The root element is missing. C. The root element is not closed properly. D. The firstname element is incorrect. Answer: not closed properly. 9. Assess the following XML. Which answer correctly describes the code? <addresses> <listing> <name> <lastname>Dowdy</lastname> <firstname>Howdy</firstname> </name> <address> <street>123 Anywhere St</street> <city>MyCity</city> </address> </listing> </addresses> A. The name element is described incorrectly. B. The address element is described incorrectly. C. The addresses root element is described incorrectly. D. Nothingthis is well-formed XML. Answer: Nothingthis is well-formed XML. 10. Which of the following documentation comments is correct? A. /// summary This is a summary comment summary B. /// <summary> This is a summary comment </summary> C. /// <summary> This is a summary comment D. /// summary This is a summary comment Answer: <summary></summary> 1. You have been asked to debug a Web-based ASP.NET application. For some reason, the debugging information is not presented. What could be missing? A. <%@ Page Debug="true" %> B. <%@ Application Debug="true" %> C. <%@ Page Trace="true" %>

D. <%@ Application Trace="true" %> Answer: Page Debug="true" %> 2. You want to examine and change the value of a variable in your C# application . You are developing using Visual Studio .NET. What window will allow you to change the value during execution? A. Locals window B. Call Stack window C. Immediate window D. Watch window Answer: Immediate window 3. You want to compile a console-based program at the command line. What is the correct syntax of the command-line compiler that will allow you to see debugging information? A. csc /b:debug MyApp.cs B. csc /d:debug MyApp.cs C. csc MyApp.cs /b:debug D. csc MyApp.cs /d:debug Answer: MyApp.cs /b:debug 4. Trace switches can be set using which class? A. System.Diagnostics.Trace B. System.Diagnostics.DefaultTraceListener C. System.Diagnostics.TraceSwitches D. System.Diagnostics.TraceSwitch Answer: TraceSwitches 5. The correct syntax for adding a trace listener to the Listeners collection is : A. TraceListeners.Add (new TextWriterTraceListener("myfile.txt"); B. Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); C. Trace.Add (new TraceListener ("myfile.txt"); D. TraceListener.Add (new TraceListener("myfile.txt"); Answer: Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); 6. To debug an ASP.NET application, you need to attach to which process? A. aspnet.exe B. asp.net.exe C. aspnet_debug.exe D. aspnet_wp.exe Answer: aspnet_wp.exe 7. How would you create a breakpoint in your code within Visual Studio .NET? A. Press F9. B. Right-click in the margin and select Insert Breakpoint. C. Choose Debug | New Breakpoint from the menu system. D. All of the above. E. None of the above. Answer: All of the above. 1. What does the following SQL statement return, assuming that all tables and column names are correct? SELECT FirstName, StreetAddress FROM Employees JOIN AddressBook ON Employees.EmpID = AddressBook.EmpID A. Nothing, the JOIN syntax is wrong. B. All the records from the Employees table, and only the matching ones from the StreetAddress table. C. All the records from the StreetAddress table, and only the matching records from the Employees table. D. Only the matching records from the two tables.

Answer: Only the matching records from the two tables. 2. What is a transaction? A. A banking term. B. A concept used to describe a step in the business process. C. A combination of DML steps that must succeed or the data is returned to its initial state. D. A combination of DDL steps that must succeed or the data is returned to its initial state. Answer: of DML steps that must succeed or the data is returned to its initial st ate. 3. What object is used to encapsulate a data source? A. XxxConnection B. XxxCommand C. XxxDataAdapter D. DataSet Answer: XxxConnection 4. What object is used to encapsulate a rowset? A. DataSet B. DataAdapter C. DataRowSet D. DataTable Answer: DataTable 5. What property is used on the DataTable to indicate a conflict after an update ? A. HasConflict B. HasError C. HasCollision D. HasDataError Answer: HasError 6. What is a DiffGram? A. An XML file containing both the original and current values for the data. B. An XML file containing the difference between original and current data. C. A DataSet loaded with two XML files, resulting in the difference being current. D. A DataSet loaded with an XML file and the original values from the data source. Answer: both the original and current values for the data. 7. How is the data represented in an XmlDataDocument? A. Relational B. Flat C. Hierarchical D. Tabular Answer: Hierarchical 8. When would you not use the OleDbConnection object? A. To connect to an SQL 7.0 database. B. To connect to a DB/2 database. C. To connect to an Access database. D. To connect to an SQL 6.5 database. Answer: an SQL 7.0 database. 9. What connection is used in ADO.NET to connect to an SQL Server 6.0? A. Use the OleDbConnection class. B. Upgrade the server to SQL 7.0 and use the OleDbConnection class. C. Upgrade the server to SQL 2000 and use the OdbcConnection class. D. Upgrade the server to SQL 6.5 and use the SqlConnection class. Answer: Use the OleDbConnection class. 10. On what object is the transaction in ADO.NET focused on? A. The command object B. The DataSet object C. The connection object D. The DataAdapter object

Answer: The connection object 11. What is the SQL argument that sorts the data returned by an SQL SELECT statement? A. GROUP BY B. SORT BY C. SORTED D. ORDER BY Answer: ORDER BY 12. What combination of methods are used to improve the speed of the Fill() method of the DataAdapter? A. BeginFillData() and EndFillData() B. StartFillData() and EndFillData() C. BeginLoadData() and EndLoadData() D. StartLoadData() and EndLoadData() Answer: BeginLoadData() and EndLoadData() 13. The following SQL INSERT statement fails. What is the most probable reason for the failure? INSERT INTO Employees VALUES (42, Bob , Carol , 12) A. Syntax error in the INSERT statement. B. The columns in the Employees table are not in the indicated order (int, char, char, int). C. The Employees database does not have a default table defined. D. The SELECT INTO permission is not set. Answer: (int, char, char, int). 14. In the following code, what is the result of compilation? using System; using System.Data; using System.Xml; class question14 { public static void Main() { DataSet dsNw = new DataSet(); string strCn = "data source=(local);user id=sa;" + "initial catalog=northwind;"; SqlConnection cnNw = new SqlConnection(strCn); string strSQL = "SELECT * FROM Employees"; SqlDataAdapter daNw = new SqlDataAdapter(strSQL, cnNw); daNw.Fill(dsNw, "Employees"); XmlDataDocument doc = new XmlDataDocument(dsNw); doc.Save(Console.Out); } } A. No errors B. One error C. Two errors. D. Three errors. Answer: Three errors. 15. What is the result of the following SQL statement? USE Northwind DELETE Employees A. The Employees table is emptied. B. The current record is deleted. C. Syntax error, the USE command is wrong. D. The Employee database in the Northwind server is deleted. Answer: table is emptied. 1. What definition correctly defines a label server control with the name set to lblHoop? A. <asp:Label name="lblHoop" runat="server" />

B. <Label id="lblHoop" runat="server" /> C. <asp:label id="lblHoop" runat="server" /> D. <server label name="lblHoop" runat="asp" /> Answer: <asp:label id="lblHoop" runat="server" /> 2. What ASP.NET object encapsulates the users data as it is sent from a form in a page? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: The Request object. 3. What important standard is used to connect client browsers with web servers? A. HTTP B. TCP/IP C. ASP.NET D. HTML Answer: TCP/IP 4. What ASP.NET object is used to get information about the web servers hostname? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Server object. 5. When writing server-side code, what marks are used to indicate the code block ? A. <% %> B. <!-- --> C. <@ language="c#" @> D. <asp:script runat="server" /> Answer: <% %> 6. What computer language is installed with the .NET Framework, by default? A. JavaScript B. Quick Basic C. C D. LiveScript Answer: JavaScript 7. What is the name of the process the browser uses to find the address of a web server? A. DMZ B. DNS C. Active Directory D. Database lookup Answer: DNS 8. How many rules are there regarding a well formed XML document? A. Nine B. Three C. Six D. Two Answer: Six 9. What line in the following XML document will generate an error? 1 <?xml version="1.0"> 2 <employees> 3 <employee> 4 <name>Bob Andcarrol</Name> 5 </employee> 6 <employee> 7 <Name>Robert Burns</Name>

8 </employee> 9 </employees> A. 6 B. 4 C. 1 D. There is no error. Answer: 4 10. What language is the standard web script language ECMAScript based on? A. JavaScript B. Java C. Perl D. Jscript Answer: JavaScript 11. What is the behavior of a web browser when it receives an invalid element? A. The web browser will display the element in raw form. B. The web browser will send a report to the webmaster detailing the error by using the Request object. C. The web browser will report the error, letting you debug the page. D. The browser will ignore the invalid section. Answer: ignore the invalid section. 12. What ASP.NET object encapsulates the state of the client and the browser? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Session object. 13. What object would you use if you need to support Netscape Navigator and Microsoft Internet Explorer? A. ActiveX control B. Intrinsic controls C. XML D. Java applet Answer: Java applet 14. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time? A. Synchronize() B. Lock() and UnLock() C. Lock() and Unlock() D. SingleUse() Answer: UnLock() 15. What ASP.NET object encapsulates the web site? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Application object. 1. When working with ASP.NET server event handlers to capture the event What event would you use to capture DropDownList control? A. The Click event. B. The SelectionChanged event. C. The SelectedIndexChanged event. D. The ChangedSelection event. Answer: SelectedIndexChanged event. 2. What code segment represents the nt controls, it is important to use the right for the application to function properly. the selection of a new item in a

event handler registration for the click eve

of the btnA Button control? A. this.btnA.Click.Register(new System.EventHandler (this.setList)); B. this.btnA.Click.Add(new System.EventHandler (this.setList)); C. this.btnA.ClickEvent += new System.EventHandler (this.setList); D. this.btnA.Click += new System.EventHandler(this.setList); Answer: btnA.Click += 3. When an ASP.NET server control is added to a Web Form, Visual Studio .NET adds one item to the class for the form. What item is added? A. The event registration. B. A protected class member for the control. C. A default event handler for the click event. D. A default class that inherits from the controls base class. Answer: protected class member for the control. 4. When a browser requests an .aspx file and the file is displayed, what is actually returned to the browser from the server? A. HTML B. XML C. ASPX D. ASP Answer: HTML 5. What is the function of the CustomValidator? A. It allows for custom C# client-side code to validate entries in a control. B. It allows for a custom mixture of validator controls to use one central control for the display of messages. C. It uses scripted client-side code to validate the entry in a control. D. It uses server-side code to validate the entry in a control. Answer: It uses scripted client-side code to validate the entry in a control. 6. What attribute must be set on a validator control for the validation to work? A. Validate B. ValidateControl C. ControlToBind D. ControlToValidate Answer: ControlToValidate 7. The Items property of a ListBox is a reference to what kind of object? A. Item B. ListItem C. String D. Index value Answer: ListItem 8. What is the use of the WebForm.aspx.cs file? A. Holds the HTML code for the form. B. Holds the control configuration for the form. C. Holds the C# code for the codebehind module. D. Holds the C# code that will be translated into HTML on the client. Answer: for the codebehind module. 9. Given an ASP.NET Web Form called WebForm1, what class does the WebForm1 class inherit from by default? A. System.Web.Form B. System.Web.GUI.Page C. System.Web.UI.Page D. System.Web.UI.Form Answer: UI.Page 10. What layout mode is the default when a new Web Form is created? A. GridBagLayout B. GridLayout C. FlowLayout D. FormLayout

Answer: GridLayout 11. When does the DropDownListBox control reload its list? A. Every time the server-side codebehind module is called. B. Every 2 minutes by default. C. When the user clicks on an entry in the control. D. Never. Answer: Every time the server-side codebehind module is called. 12. What is the Web.config file used for? A. To store the global information and variable definitions for the application. B. Configures the time that the server-side codebehind module is called. C. To configure the web server. D. To configure the web browser. Answer: To store the global information and variable definitions for the applica tion. 13. What happens if an ASP.NET server control with event-handling routines is missing the runat="server" attribute from its definition? A. The control will operate as usual; the default is runat="server". B. The control will revert to being a client-side control and function as such. C. The control will not function; the default is runat="client". D. The compilation of the application will fail. Answer: The compilation of the application will fail. 14. What happens if an ASP.NET server control with no event-handling routines is missing the runat="server" attribute from its definition? A. The control will operate as usual; the default is runat="server". B. The control will revert to being a client-side control and function as such. C. The control will not function; the default is runat="client". D. The compilation of the application will fail. Answer: not function; the default is runat="client". 15. After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesnt execute. What could the problem be? A. The AutoEventWireup attribute is set to False. B. The AutomaticPostBack attribute is set to False. C. The codebehind module is not properly compiled. D. The ListBox must be defined WithEvents. Answer: AutomaticPostBack attribute is set to False. 1. What must be done before you can consume a web service? A. Build a proxy library by using the TblImp.exe utility. B. Build a proxy library by using the Disc.exe utility. C. Build a proxy library by using the csc.exe utility. D. Build a proxy library by using the wsdl.exe utility. Answer: wsdl.exe utility. 2. You need to use the web service TempConvService. Where should you place the proxy file? A. In the lib directory off the root directory of the application. B. In the root directory of the application. C. In the bin directory off the root directory of the application. D. In the bin directory of .NET Framework. Answer: bin off the root directory of the application. 3. You need to use the web service TempConvService. What page directives correctly expose the web service? A. <%@ Page Language="c#" Debug="true" %> <%@ Import = "TempConvService" %> B. <%@ Page Language="c#" Debug="true" %> <%@ Import namespace="TempConvService" %> C. <%@ Page Language="c#" Debug="true" %> <%@ Import ProxyNameSpace="TempConvService" %> D. <%@ Page Language="c#" Debug="true" %> <%@ Import namespace="bin/TempConvService" %> Answer: <%@ Page Language="c#" Debug="true" %><%@ Import namespace="TempConvServ

ice" %> 4. You need to call a function that is located in a library named MyLibrary.dll, and this is the function signature: int MyFunc(int intAction, int intOption, uint uValue) You also need to rename the function to Func42 to avoid name conflicts in the application. Which code segment will correctly make the function available to your application? A. [DllImport("MyLibrary.dll")] public static extern int Func42 (int intAction, int intOption, int uValue); B. [DllImport("MyLibrary.dll", EntryPoint = "Func42")] public static extern int Func42 (int intAction, int intOption, uint uValue); C. [DllImport("MyLibrary.dll")] D. [DllImport("MyLibrary.dll", EntryPoint = "MyFunc")] public static extern int Func42 (int intAction, int intOption, uint uValue); Answer: "MyFunc" 6. You have been given the task of designing a web service to expose the data that is stored in a database on the server. In order to successfully build the web services, you need to import some namespaces. What is the minimum namespace you need to import? A. System.Web B. System.WebServices C. System.Web.Services D. System.Web.ServiceModel Answer: Web.Services 7. You have designed an event for the class you are working on, and the event is declared as follows: // declare the delegate for the event public delegate int MugEmptyHandler(int RefillVolume); // declare the event public static event MugEmptyHandler OnMugEmpty; When you try to register the event in the client code by using the following line, you receive a syntax error: this.OnMugEmpty += new MugEmptyHandler(this.Mug_Empty); You need to make the OnMugEmpty event functional. What will you do? A. Change the declaration of the event to indicate the parameter. B. Change the declaration of the event to indicate the return type. C. Change the declaration of the delegate to have no parameters. D. Change the declaration of the delegate to have a void return type. Answer: a void return type. 8. You are building an event handler for the SendFax event from the sFax component, and you have written the following code: private void Send_Fax() { Console.WriteLine("Fax is sent"); } When you test the event handler, you find that it never runs. What code must be added to your application to make the event execute in response to the SendFax event? A. public delegate SendFax(Send_Fax); B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); C. public event SendFax(Send_Fax); D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax); Answer: Fax += new SendFaxHandler(this.Send_Fax); 9. Your manager has asked you to describe what you would use application variables for. What statement best describes the use of application variables? A. Application variables are used to keep state for each connected user. B. Application variables are used to keep state for the web site.

C. Application variables are used to keep state for all the applications on the server. D. Application variables are used to keep state for all application objects in the web site. Answer: the web site. 10. You are using Visual Studio .NET to set up a reference to a COM component, but the reference operation fails. What is one possible solution? A. Register the COM component with .NET using TlbImp.exe. B. Register the COM component using wsdl.exe. C. Move the COM component to the bin directory of the application. D. Register the COM component in the Registry using Regsvr32.exe. Answer: Regsvr32.exe. 11. What information do you need to have in order to successfully reference a we b service using the Add Reference dialog box? A. The URI for the web services .asmx file. B. The URL for the web services .asmx file. C. The URL for the web services disco file. D. The URI for the web services disco file. Answer: URL .asmx file. 12. You have defined some web service methods, but when you test the web service, you do not have the methods available. The web service is defined as follows: [WebMethod] private void email(string to, string[] message, int option) { } What will you do to solve the problem? A. Replace the attribute with [WebServiceMethod]. B. Make the method public. C. Change the string[] to an object array. D. Change the return type to int. Answer: Make the method public. 13. You find that after running the following command line commands from the root directory of your web site that the web service is not available: >wsdl /l:cs /o:Address.cs http://localhost/Address/Address.asmx?WSDL /n:AddressService >csc /out:AddressProxy.dll /t:library /r:system.web.dll, system.dll, system.xml.dll, system.web.services.dll, system.data.dll Address.cs What will you do to make the web service available with the least amount of code and work? A. Run the following command: regsvr32 /.NET AddressProxy.dll B. Rerun the csc command specifying /o:bin/AddressProxy.dll. C. Rebuild the AddressProxy.dll file using the /AutoPost option. D. Rebuild your application after adding the reference to the web service. Answer: Rerun the csc command specifying /o:bin/AddressProxy.dll. 14. You have designed a web form that has one listbox control. You have implemented the SelectedIndexChanged event handler, and you have verified that all required declarations are in place and that the event handler is registered. During testing of the form, you find that the event does not execute . What is the most efficient way to make the event execute? A. Set the AutoPostBack attribute of the listbox control to False. B. Set the AutoPostBack attribute of the @ Page directive to True. C. Set the AutoPostBack attribute of the listbox control to True. D. Change from the listbox control to the DropDownList control. Answer: to True.

1. What HTML element is the asp:Label control rendered as when the target is Internet Explorer? A. <label> B. <span> C. <div> D. <table> Answer: <span> 2. What HTML element is the asp:Label control rendered as when the target is Netscape Communicator? A. <label> B. <span> C. <div> D. <table> Answer: <span> 3. What is the result when a Web Form containing the following line is compiled and executed? <asp:Button id="theButton" onClick="theEvent" /> A. The button control is created; theEvent is the Click event handler. B. Compiler error; the control must be set to runat="server". C. Compiler error; onClick is not a valid attribute. D. Runtime exception; the control must be set to runat="server". Answer: Runtime exception; the control must be set to runat="server". 4. What HTML element is the asp:panel control rendered as? A. <span> B. <table> C. <div> D. <p> Answer: <div> 5. How do you specify the parameters for the ads in the AdRotator control? A. By programmatically setting the properties. B. By using an initialization file in .xml format. C. By using an initialization file in .txt format. D. By using an initialization file in .ini format. Answer: .xml format. 6. What of the following best describes a user control? A. A collection of server controls gathered in a web file with the <%@ Control %> directive. B. A collection of controls that are compiled into an assembly. C. A control that is built from multiple user-defined COM-based controls. D. A simple lightweight control that can display text only. Answer: <%@ Control %> 7. Which of the following is valid after adding the following directive to a Web Form? <%@ Register TagPrefix="WWW" TagName"WWWControl" Src="WWWControl1.ascx" %> A. <WWW:WWWControl1 id="theControl" runat="server" /> B. <asp:WWWControl id="theControl" runat="server" /> C. <WWW:WWWControl id="WWWContr" runat="server" /> D. <asp:WWWControl1 id="WWWContr" runat="server" /> Answer: WWW:WWWControl 8. You have correctly added the <%@ Register %> directive and the user-control definition in the <asp:Form> tag, but when you run the application it fails. What is the most likely cause of the failure? A. The protected class variable for the control is missing from the codebehind module. B. The event registration is not performed; you must manually add it to the InitializeComponent event handler. C. There must be a call to the controls constructor in the Page_load() method. D. The control must be added to the Web Forms Controls collection.

Answer: The protected class variable for the control is missing from the codebeh ind module. 9. After building a custom control, you test it by adding an ASP.NET web applica tion to the solution. You add a correct <%@ Register %> directive and a proper declaration of the control in the <asp:Form> tag to the Web Form, but when you execute the application you get an error. What is the most likely reason for the problem? A. The custom control must be compiled first. B. The web application must have a reference to the control. C. The custom control must be registered with Windows first. D. The assembly from the custom control is not in the applications bin directory. Answer: The assembly from the custom control is not in the applications bin direc tory. 10. You have successfully created a custom control and a web application project to test the control. The application runs with no problems, but when you look at the Design view of the Web Form, the control is displayed using an error display . What is the most efficient way to resolve the error display? A. Move the control to the web applications bin directory, and recompile the application. B. Add a reference to the control to the web application. C. Change the Bindable attribute for the Default property in the control to have a value of True. D. Manually enter the 128-bit GUID for the control in the applications configuration file. Answer: Add a reference to the control to the web application. 11. What method must be overridden in a custom control? A. The Paint() method. B. The Control_Build() method. C. The Render() method. D. The default constructor. Answer: The Render() method. 12. Your manager has asked you if ASP.NET can be used with dynamic control creation, and if it requires any extra software to make dynamic controls possibl e. What would you answer your manager? A. Yes, dynamic controls are possible using the standard control containers from ASP.NET. B. No, dynamic controls are not possible in ASP.NET. C. Yes, dynamic controls are possible in ASP.NET using a third-party assembly. D. Yes, dynamic controls are possible in ASP.NET by using the Web Services. Answer: using the standard control containers from ASP.NET. 1. What property is used to control how the user can press ALT-F to set the focu s to a control? A. AccessKey B. ControlOrder C. TabOrder D. TraceOrder Answer: AccessKey 2. You have created a localized web application that supports English, French, German, and Spanish. After building the resource files, you code all the strings to come through the ResourceManager.GetString() method. You test the application by using the browser on your development computer, and as you switch languages in the Regional Settings, everything functions as expected. After deploying the application, you receive a message from a client saying that

the application does not change when the client accesses it with a computer configured to use the French locale. You need to fix the application. What will you do? A. Rebuild the resource assembly. B. Add code to change the current threads culture to the users culture. C. Add code to change the location of the resource assembly. D. Instruct the user to upgrade to a newer browser. Answer: current threads culture to the users culture. 3. What is used to validate complex string patterns like an e-mail address? A. Extended expressions. B. Regular expressions. C. Irregular expressions. D. Basic expressions. Answer: Regular expressions. 4. What is the default language for the fallback culture? A. English. B. Swedish. C. Users setting. D. Neutral. Answer: Neutral. 5. What namespace is needed for Event Log support? A. System.Event B. System.Diagnostics C. System.EventLog D. System.Diagnostics.Event Answer: Diagnostics 6. What property controls whether the text in a TextBox control is displayed in clear text or as a collection of * characters? A. PasswordCharacter B. Hide C. Encrypt D. TextMode Answer: TextMode 7. You need to customize the error messages from your web application. What file will you modify to customize the error messages? A. Web.config B. Error.config C. Application.config D. global.asax Answer: Web.config 8. What property is set in order to display the text in reverse flow order? A. rtl B. ltr C. dir D. reverse Answer: dir 9. You have configured custom error pages for your application. When you test the pages from a co-workers computer, they display properly, but when displayed in your browser on the development computer, they display incorrectly. What will you do to correct the display of the error pages on your computer? A. Install Internet Explorer 6.0. B. Change the mode attribute to localhost in the Web.config file. C. Change the mode attribute to RemoteOnly in the Web.config file. D. Change the mode attribute to On in the Web.config file. Answer: On in the Web.config file. 10. After adding messages to the trace log, you need to locate the output. What section contains the messages a developer has added to the trace log? A. Trace Information. B. Control Tree.

C. Cookies. D. Headers Collection. E. Server Variables. Answer: Trace Information. 11. What file would you modify to implement application-wide error processing for all unhandled errors? A. Web.config B. Error.config C. Application.config D. global.asax Answer: global.asax 12. What property is used to control the order in which the controls are accesse d? A. AccessKey B. ControlOrder C. TabIndex D. TraceOrder Answer: TabIndex 13. How do you enable tracing? A. Set the Trace property of the Web Form to True. B. Set the Trace property of the Server object to True. C. Set the Session variable Trace to True. D. Set the Applications variable Trace to True. Answer: Web Form to True. 14. What control is used to validate that two fields are equal? A. RequiredFieldValidator B. RegularExpressionValidator C. CompareValidator D. The equals() method of the field. Answer: CompareValidator 15. What method is used to insert a highlighted entry in the trace output? A. Trace.Write() B. Trace.HighLight() C. Trace.Error() D. Trace.Warn() Answer: Trace.Warn() 1. What is the SQL equivalent of the DataSet relation object? A. XOR JOIN B. CROSS JOIN C. OUTER JOIN D. INNER JOIN Answer: INNER JOIN 2. Why should you close all database objects and set them to NULL before leaving the method where the objects were created? A. To ensure that the objects destructors are called. B. To ensure that the connection to the database is closed as soon as possible. C. To ensure that the objects can be reused. D. Good coding practice. Answer: connection to the database is closed as soon as possible. 3. What is the purpose of the following code segment? if ( !IsPostBack ) { sqlDataAdapter1.Fill(dsUsers1); DataGrid1.DataBind(); } A. To populate the DataAdapter the first time the web page is displayed. B. To populate the DataSet every time the web page is displayed. C. To populate the DataAdapter every time the web page is displayed. D. To populate the DataSet the first time the web page is displayed.

Answer: DataSet the first time the web page is displayed. 4. Where are stored procedures saved? A. The GAC. B. The web server. C. The database server. D. The central store. Answer: The database server. 5. What is the root exception for the ADO.NET objects? A. DataException B. ADOException C. Exception D. DBException Answer: DataException 6. What best describes the xxxDataReader? A. A disconnected collection of tables. B. A manager that manages the connection to a data source, using four SQL statements. C. A connected, read-only, forward-only representation of the data source. D. The component that encapsulates the database driver. Answer: A connected, read-only, forward-only representation of the data source. 7. You are the developer of a Web Form, and you need to display data from a Microsoft SQL Server 6.5 in a DataGrid on your form. What DataAdapter is the most appropriate? A. sqlDataAdapter B. oleDbDataAdapter C. odbcDataAdapter D. adoDataAdapter Answer: oleDbDataAdapter 8. What is the purpose of the last string ("{0}") in the following code segment? DataBinder.Eval(dS1, "Tables[SP_SelUsers].DefaultView.[0].LastName", "{0}"); A. It is the formatting string for the bound data. B. It is the default value that will be used when the data is NULL. C. It is the parameter sent to the stored procedure SP_SelUsers. D. It is the placeholder for a DataBinding object. Answer: formatting string for the bound data. 9. What is the correct namespace for use with the SQL .NET Data Provider objects ? A. System.SQL B. System.Data.SqlConnections C. System.Data.SqlClient D. System.SqlConections Answer: Data.SqlClient 10. What is the correct statement to use for declaring that an xxxCommand object is used with a table? A. aCmd.CommandType = CommandType.Table; B. aCmd.CommandType = Table; C. aCmd.CommandType = "Table"; D. aCmd.CommandType = "CommandType.Table"; Answer: CommandType.Table; 11. How many sqlDataReader objects can be open on one Connection at one time? A. 4 B. 3 C. 2 D. 1 Answer: 1 12. What is the SQL wildcard character? A. *

B. % C. & D. @ Answer: % 13. You need to connect to a Microsoft SQL Server version 6.5. What Connection object is the best choice? A. sqlConnection B. oleDbConnection C. ODBCConnection D. You must upgrade; there is no connection object for this database. Answer: oleDbConnection 14. You are using the try... catch block seen in the following code segment, but no exceptions are ever caught by the catch block. What is the problem? sqlConnection cn =new sqlConnection(strSQL); sqlDataSet ds; try { cn.Open(); //perform the data processing steps ... }catch(OleDbException e){ ... } A. The exception class is wrong; it should be SqlErrors. B. The exception class is wrong; it should be SqlSyntaxExceptions. C. The exception class is wrong; it should be SqlExceptions. D. The exception class is wrong; it should be SQLExcptions. Answer: SqlExceptions. 15. You are designing a Web Form that needs to have data available for as long a s eight hours at a time. Your manager has raised some concern that the database server will be unable to provide services to a large number of connected users. What object in the ADO.NET architecture will you bring to your managers attention as a possible solution? A. SQL disconnected recordsets. B. oleDbDataReader C. ODBCRecordSet D. oleDbDataSet Answer: oleDbDataSet 1. You are the developer of a web application that is retrieving historical spor ts information from a database server and displays it to the users of your applicat ion. What cache strategy will give you the best performance? A. Use the output cache. B. Use the cache object. C. Use the ASP.NET central cache. D. Use the client cache. Answer: output cache. 2. You are the developer of a web application and have decided to use the output cache in ASP.NET. Which of the following statements correctly defines the Web Form if you want to use the output cache, cache all items for 14 minutes, and store different versions of the cached objects for each customer ID? A. <%@ OutputCache Duration="840" VaryByCustom="true" %> B. <%@ OutputCache Duration="14" VaryByCustom="true" %> C. <%@ OutputCache Duration="840" VaryByParam="Customer ID" %> D. <%@ OutputCache Duration="14" VaryByParam="Customer ID" %> Answer: 840 ustomer ID 4. You are configuring security for a web application that will be used on your

company intranet. Your company is using Intel-based as well as Apple computers running Windows and other operating systems. The following is part of the Web.config file for the application: <configuration> <authentication mode="<<Enter Answer Here>>"> <forms> loginUrl="login.aspx" protection="All" timeout="30" path="/" </forms> </authentication> </configuration> What will you replace "<<Enter Answer Here>>" with to successfully have all users authenticate to the application? A. Forms B. Basic C. Digest D. Windows Answer: Forms 5. What should be added to basic authentication? A. FTP B. TCP C. SSL D. NHL Answer: SSL 6. You are deploying a web application using the XCOPY method, and you are now selecting the files that should be included in the deployment. What file extensions must be included in the deployment? Select all that apply. A. .resx B. .aspx C. .cs D. .ini Answer: .aspx 7. You have just installed IIS on your desktop computer that is running Windows 2000 Professional. Directly after the installation, you try to create a web appl ication and you are given error messages indicating that the Internet server is incompat ible with the .NET Framework. You need to create a web application, so what is the fastest way to be able to do so? A. Configure the FrontPage Server Extensions. B. Repair the .NET Framework installation from the Visual Studio .NET Windows Component update CD. C. There is no solution. Windows 2000 does not support .NET Framework web application development. D. Re-boot the computer. Answer: Repair the .NET Framework install 8. What is required in order to be able to install and use SSL on a web server? A. Export permission. B. The SSL add-on CD. C. Server certificate. D. Encryption key. Answer: Server certificate. 10. True or false. The Web.config file can be used to store configuration data f or properties of some controls. A. True. B. False. Answer: True.

11. What tool is used to manage the GAC? A. GacMgr.exe B. GacSvr32.exe C. GacUtil.exe D. RegSvr.exe Answer: GacUtil.exe 12. What is the effect of the following code snippet from the Web.config file? ... <system.web> <authorization> <deny users="?" /> </authorization> </system.web> A. Anonymous access is denied. B. Only anonymous access is allowed. C. Users in the default group are denied access. D. There will be a syntax error when the application is executed. Answer: Anonymous access is denied. 13. You are deploying the web application you have been developing to a production server. Your application uses a number of resource assemblies and also one utility assembly that has been developed for the web application. You deploy the application by using a file-archiving utility to package all the .asp x and Web.config files into the archive, and the application is installed on the production server by un-packing the archive in the target directory. The deployment did not generate any error messages; but when you are testing the application, you find that it does not work. None of the localized resources display anything, and there are a large number of errors displayed. You need to make the application function normallywhat is the most efficient way to achieve that goal? A. Enable tracing for the application, trace to an XML file, analyze the output, and correct the source of the problems. B. Copy the /bin directory from the development system to the production server. C. Install Visual Studio .NET on the production server; enable debugging; and single-step through the application, correcting all problems as they appear. D. Abort the deployment, and inform the customer that you will be back as soon as you have found the problem. Answer: Copy the /bin directory f 14. True or false. The GAC cannot store multiple versions of the same assembly. A. True. B. False. Answer: False. 15. You are configuring your web application to require digest-based authenticat ion. What must you have in place before you can use digest-based authentication? A. A DNS server. B. Active Directory. C. Strong encryption keys. D. A strongly named Web.config file. Answer: Active Directory. 1. Which of the following methods are ways to create a Windows Form? A. Visual inheritance. B. Building a derived class from System.Windows.Forms.Form. C. Extending a prebuilt form. D. Selecting a form class from the Inheritance Picker. E. All of the above. Answer: All of the above. 4. You want to add a control to your form that allows you to set a particular

option on or off. Which control would you choose? A. Button B. CheckedListBox C. CheckBox D. ListBox E. RadioButton Answer: CheckBox 7. When you set the Localization property of a form to True, which of following happens? A. You allow the application to accept localization resources. B. The form is translated into the language specified in the Language property. C. The property asks you for the translation language. D. The program prompts you to provide a language resource. Answer: You allow the applicat 8. By setting the Text property on the form, you will cause the value t property to display on which part of the form? A. Bottom-right corner B. Top-right corner C. Title bar D. Status bar Answer: Title bar 10. What would the outcome of an application that contained this code private void Form1_Load (object sender, System.EventArgs e) { Form1.Hide(); } A. The application would not compile. B. The program would run but no form would display. C. The program would run and display the form. D. A runtime error would occur. Answer: application would not compile. 11. What would the outcome of an application that contained this code private void Form1_Load (object sender, System.EventArgs e) { this.Hide(); } A. The application would not compile. B. The program would run but no form would display. C. The program would run and display the form. D. A runtime error would occur. Answer: and display the form. 13. Which of the following are not methods of a System.Windows.Forms.Form object? A. Activate() B. Deactive() C. Form() D. OnCreate() Answer: Deactive() 14. Which of the following are not events of a System.Windows.Forms.Control? A. KeyPress B. KeyDown C. MousePress D. MouseMove E. MouseEnter Answer: MousePress 15. In which namespace would you find the class Application? A. System.Application

the

of the Tex

be?

be?

B. System C. System.Window.Forms D. System.Windows.Forms Answer: Windows.Forms 1. If you want to ask the user to select between two or more mutually exclusive options, you would employ which of the following controls? A. TabControl B. Button C. RadioButton D. CheckBox Answer: RadioButton 2. The following piece of code is intended to create a new TabPage in a TabControl. What will happen when you try to run this code? TabPage tpMyNewTabPage = new TabPage(); tpMyNewTabPage.Caption = "Add Students"; tpMyNewTabPage.Size = new System.Drawing.Size (536, 398); Button b = new Button(); tpMyNewTabPage.Controls.Add (b); A. The program compiles and executes properly. B. The program compiles and causes a runtime error. C. The program does not compile because it is unable to add the button. D. The program does not compile because of a syntax error. Answer: syntax error. 3. The following piece of code is intended to create a new TabPage in a TabControl. What will happen when you try to run this code? TabPage tpMyNewTabPage = new TabPage(); tpMyNewTabPage.Text = "Add Students"; tpMyNewTabPage.Size = new System.Drawing.Size (536, 398); Button b = new Button(); tpMyNewTabPage.Controls.Add (b); A. The program compiles and executes properly. B. The program compiles but the tab page does not show. C. The program compiles and causes a runtime error. D. The program does not compile because of a syntax error. Answer: does not show. 4. You want to validate the user input that is retrieved in a text box. Which co ntrol will assist you in displaying the error message without moving off the form? A. RichTextBox B. NotifyIcon C. HelpProvider D. ErrorProvider Answer: ErrorProvider 5. You want to validate the user input that is retrieved in a text box. Which ev ent will assist you in the validation of the data? A. UponValidation B. Validation C. Validating D. OnValidation Answer: Validating 6. Which of the following lines of code will produce a message box for the user? A. MessageDialogBox.Show ("This is your message"); B. MessageDialogBox.Show ("Message", "This is your message"); C. MessageBox.Show ("This is your message); D. MessageBox.Show ("Message", "This is your message"); Answer: MessageBox.Show 7. To dynamically add a context menu to your application, which section of code should be used?

A. MenuItem m = new MenuItem(); contextMenu1.MenuItems.Add (m); B. MenuItem m = new MenuItem(); contextMenu1.MenuItem.Add (m); C. MainMenu m = new MainMenu(); contextMenu1.MenuItems.Add (m); D. MainMenu m = new MainMenu(); contextMenu1.MenuItem.Add (m); Answer: .MenuItems. 8. To produce a dialog box similar to the Windows Print dialog box, which of the following controls would you use? A. PrintPreviewDialog B. PrintDialog C. PrintBox D. SetupPrintDialog Answer: PrintDialog 9. Which property of the CheckedListBox allows you to preset the maximum number of items that can be selected? A. MaxItems B. MaximumItems C. SelectionItems D. SelectionMode Answer: SelectionMode 10. What is wrong with the following piece of code? Assume no other code has been written and you are creating the status bar dynamically. this.sbMyStatusBar.Panels[1].Text = "Panel 1"; this.sbMyStatusBar.Panels[2].Text = "Panel 2"; this.sbMyStatusBar.Panels[3].Text = "Panel 3"; A. Nothing is wrong with the code. B. It will cause a runtime error. C. There will be a syntax error found. D. The Text property is incorrect for a StatusBar. Answer: It will cause a runtime error. 11. Which line of code must be added in order to show a StatusBar? A. sbMyStatusBar.Show(); B. sbMyStatusBar.Display(); C. sbMyStatusBar.Show = true; D. sbMyStatusBar.Display = true; Answer: Show = true; 12. Which line of code will set the Link data for a LinkLabel? A. this.linkLabel1.Text = "http:\\www.microsoft.com"; B. this.linkLabel1.Link = "http://www.microsoft.com"; C. this.linkLabel1.HyperLink = "http://www.microsoft.com ; D. None of the above. Answer: None of the above. 14. Which property will allow the user to enter more than one line in a text box ? A. MaxLines B. MultipleLines C. MultiLines D. MultiLine Answer: MultiLine 15. Which control would you use to group a lot of controls together? A. GroupControl B. GroupBox C. FrameControl D. FrameBox Answer: GroupBox 1. Which code segment will populate a DataSet?

A. sqlDataProvider1.Fill (dsUsers1); B. sqlDataProvider.Fill (dataAdapter1); C. sqlDataAdapter.Fill (dsUsers1); D. sqlDataAdapter.Fill (dataAdapter1); Answer: Adapter (dsUsers1); 2. What type of commands can you create? A. Text, stored procedures, and tables. B. Text, stored procedures, and TableRows. C. Text, stored procedures, and TableDirect. D. Text, stored procedures, and TableColumns. Answer: TableDirect. 3. Data access exceptions all derive from which base class? A. Sql.Data.Exceptions B. Sql.SqlDataExceptions C. Exception D. DataException Answer: DataException 4. You need to get access to a database that is stored on a server running Microsoft Access 2002. Which data adapter would you use? A. SqlDataAdapter B. OleDbDataAdapter C. OleDataAdapter D. ODBCDataAdapter Answer: OleDbDataAdapter 5. You need to get access to a database that is stored on a server running Microsoft SQL Server 2000. Which data adapter would you use? A. SqlDataAdapter B. OleDbDataAdapter C. OleDataAdapter D. ODBCDataAdapter Answer: SqlDataAdapter 6. You want to return XML data from a Microsoft SQL Server 7.0 database. Which method would you execute? A. ExecuteXmlReader() B. ExecuteXmlData() C. ExecuteOleReader() D. ExecuteOldData() Answer: ExecuteXmlReader() 7. The Parse event is triggered after which of these occurrences? A. Data is sorted. B. Data is filtered. C. Data is bound to a control. D. Data is returned to the data source. E. All of the above. F. None of the above. Answer: returned to the data source. 8. The Format event is triggered after which occurrences? A. Data is sorted. B. Data is filtered. C. Data is bound to a control. D. Data is returned to the data source. E. All of the above. F. None of the above. Answer: All of the above. 12. Which of the following object types allow you to view read-only, forward-only data? A. DataAdapter B. DataSet C. DataReader D. DataCommand

Answer: DataReader 13. Which of the following statements is correct? A. The DataSource property refers to the dataset object, and the DisplayMember refers to the field. B. The DataMember property refers to the dataset object, and the DataSource refers to the field. C. The DataMember property refers to the field, and the DataSource refers to the dataset object. D. The DisplayMember property refers to the dataset object, and the DataSource refers to the field. Answer: DataSource 14. Why does the data not display using the following code? studentConnection.Open(); studentCommand = studentConnection.CreateCommand(); studentCommand.CommandType = CommandType.Text; studentCommand.CommandText = "SELECT * FROM Student"; studentAdapter = new SqlDataAdapter (studentCommand); studentSet = new DataSet(); this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName"); A. The command object is instantiated incorrectly. B. The dataset object is instantiated incorrectly. C. The data binding is done incorrectly. D. The dataset has not been populated. Answer: has not been populated. 1. Where should a web service proxy file be located? A. In the \bin directory of My Documents. B. In the \lib directory of the application. C. In the \bin directory of the application. D. In the \lib directory of My Documents. Answer: \bin application. 3. Which command-line tool will create a web service proxy? A. isdlam.exe B. ildasm.exe C. tlbimp.exe D. wsdl.exe Answer: wsdl.exe 4. Which command-line tool will allow you to view an assembly? A. isdlam.exe B. ildasm.exe C. tlbimp.exe D. wsdl.exe Answer: ildasm.exe 5. Which command-line tool will generate the proxy for a COM component? A. isdlam.exe B. ildasm.exeC. tlbimp.exe D. wsdl.exe Answer: wsdl.exe 6. Which of the following will display the Web Services on a remote IIS server (named www.hmr.com) in an assembly called MyServices? A. http://hmr.com/MyServices/ServiceName B. http://www.hmr.com/MyServices/ServiceName C. url://hmr.com/MyServices/ServiceName D. url://www.hmr.com/MyServices/ServiceName Answer: http://www 8. What must be done to be ready to consume a web service? A. Build a proxy library using wsdl.exe. B. Build a proxy library using csc.exe. C. Build a proxy library using TblImp.exe. D. Build a proxy library using pl.exe.

Answer: wsdl.exe. 11. Which namespace is added to a program that calls a web service? A. using System.WebServices; B. using System.Web.Services; C. using System.Web.Services.List; D. using System.Web.Services.All; Answer: Web.Services; 12. Which URL will provide access to the web service called MyWebService, located in the WebServices web on the local machine? A. http://localhost/MyWebService/WebServices.asmx?WSDL B. http://localhost/WebServices/WebServices.asmx?WSDL C. http://localhost/MyWebService/MyWebService.asmx?WSDL D. http://localhost/WebServices/MyWebService.asmx?WSDL Answer: ices/MyWebS 13. A discovery file used to locate Web Services would have which extension? A. .discovery B. .discover C. .vdisco D. .disco Answer: .vdisco 14. When you test a web service, what do you expect to see as output? A. The web service running. B. The web site. C. The XML of the web proxy. D. The XML of the web service. Answer: web proxy. 15. Which attribute must be added to create an exposed web service method? A. [System.WebServices.WebMethod] B. [System.Web.Services] C. [System.Web.Services.Web.WebMethod] D. [System.Web.Services.WebMethod] Answer: Services.WebMethod] 1. Which file must be included in the assembly in order to provide a list of licensed controls within the application? A. xxxx.LIC B. xxxx.LCX C. xxxx.LICX D. xxxx.Licenses Answer: xxxx.LICX 2. You are planning to create a new control that will be used in place of the Button control. The new control will blink and change color whenever the user moves the mouse over the control. Which control type would you use? A. Derived control from the Button class. B. Derived control from the Control class. C. Derived control from the UserControl class. D. Customized control using GDI+. Answer: Button class. 1. Which tool allows you to install an assembly into the GAC? A. Ngen.exe B. Mscorcfg.msc C. Setup.exe D. sn.exe Answer: Ngen.exe 2. Which of the following accurately describes a strong named assembly? A. A private assembly with a unique name within an application domain. B. A private assembly with a unique name within a global domain. C. A shared assembly with a unique name within an application domain. D. A shared assembly with a unique name within a global domain.

Answer: private global 3. Which template must be chosen from the Add New Project dialog boxs Templates list in order to have an application downloaded from an IIS (Internet Information Server) server? A. Windows Setup Project. B. CAB Project. C. IIS Project. D. Web Setup Project. Answer: Web Setup Project. 4. You have followed the steps in creating a Windows Installer Setup project, an d after deployment you notice that it does not install properly on the client. Which of the following could be the problem? A. You forgot to run the sn.exe utility. B. The shortcut was not configured properly. C. The release type is set to Debug. D. The Registry entry is incorrect. Answer: The release type is set to Debug. 5. Why did Microsoft invent assemblies? A. To allow applications to take care of their own components. B. To speed up processing. C. To confuse developers studying for the .NET development exams. D. To ensure that all components register properly in the Registry. Answer: To allow applications to take care of their own components. 7. What can be configured using the .NET Configuration tool? A. GAC cache. B. Assemblies. C. Security. D. Policy levels. E. All of the above. F. None of the above. Answer: All of the above. 8. Which of the following command-line entries would allow you to install an assembly into the GAC? A. gacutil /l myAssembly.exe B. gacutil /i myAssembly.exe C. gacutil /s myAssembly.exe D. gacutil /h myAssembly.exe Answer: Ngen.exe /cache 9. Which command would you use to list the existing files in the native image cache? A. Ngen.exe /list B. Ngen.exe /cache C. Ngen.exe /debug D. Ngen.exe /show Answer: Ngen.exe /show 11. If the redistributable package is to be installed on a server, what must be in place? A. .NET Framework B. SQL Server C. MDAC 2.6 D. CLR Answer: MDAC 2.6 12. Why is the Setup project name important? A. Setup looks for files under that name. B. It is the name in the Add/Remove Programs dialog box. C. There cannot be any spaces in the name. D. The name goes in the Registry. Answer: It is the name in the Add/Remove Programs dialog box. 14. Which line must exist in the AssemblyInfo.cs file in order to sign

the assembly? A. [assembly: AssemblyKeyFile("")] B. [key: AssemblyKeyFile("")] C. [assembly: AssemblyKeyFile("myKeys.snk")] D. [key: AssemblyKeyFile("myKeys.snk")] Answer: assembly myKeys.snk 15. Where is the GAC located by default? A. Windows directory. B. Programs directory. C. Documents and Settings directory. D. Application directory. Answer: Windows directory. 1. You are responsible for adding localization to an existing Windows Form. What class will determine the locale of the runtime environment? A. ResourceManager B. Localization C. Globalization D. CurrentUICulture Answer: CurrentUICulture 2. Which tool can you use to configure the security settings for an application? A. mscorcfg.msc B. ngen.exe C. caspol.exe D. caspol.msc Answer: mscorcfg.msc 3. Which tool can you use to precompile a Windows application? A. mscorcfg.msc B. ngen.exe C. caspol.exe D. caspol.msc Answer: ngen.exe 4. Which security file will override the machine configuration file? A. Enterprise configuration B. Application configuration C. Security configuration D. User configuration Answer: Application configuration 9. What are the three different policy-configuration files? A. Enterprise, Machine, User. B. Enterprise, Machine, Local. C. Enterprise, Security, Local. D. Enterprise, Security, User. Answer: Ent Mac User. 11. What type of array is the most efficient to work with? A. Rectangular array B. One-dimensional array C. Two-dimensional array D. Jagged array Answer: Jagged array 12. Which code-access class can be used to represent permissions related to network access? A. NetworkPermission B. RemotePermission C. URLPermission D. SocketPermission Answer: SocketPermission 13. Which of the following represents a union of permissions? A. A collection of code groups. B. A collection of permissions.

C. A collection of intersections. D. A collection of evidence. Answer: code groups. 15. What must be done to create a ToolTip on a new Windows control? A. Add a ToolTip control and set the ToolTip property of the new control. B. Set the ToolTip property of the new control. C. Set the Help property of the new control. D. Create a MessageBox that displays when the user clicks the new control. Answer: Create a MessageBox 3. Which namespace must be added to the XML web service in order to write to an event log? A. System.EventLog B. System.Events C. System.Diagnostics D. System.Diagnostics.Event Answer: Diagnostics 4. Which technology allows you to publish XML web services? A. XMLPub B. XSLT C. XPath D. UDDI Answer: UDDI 6. Which of the following describes the elements that make up a SOAP message? A. Envelope, Header, Body, Fault. B. Envelope, Header, Body, Error. C. Envelope, Body, Fault. D. Envelope, Header, Fault. Answer: En He Bo Fa 7. Which of the following technologies are used to describe a web service in ter ms of the messages that it creates and the messages that it accepts? A. XMLS B. XSLT C. CORBA D. WSDL Answer: WSDL 8. What is the default namespace for a new web service? A. http://localhost B. http://www.w3.org C. http://tempuri.org/ D. http://www.microsoft.com Answer: tempuri.org/ 10. How would you add a web service component to your Visual Studio .NET application? A. Project | Add Web Component B. Project | Add Component C. Project | Add Web Service D. Project | Add Service Answer: Add Service 11. A static discovery file will usually have a file extension of which of the following? A. .vsdisco B. .vdisco C. .sdisco D. .disco Answer: .disco 12. Which of the following technologies is a lightweight protocol for exchange o f information in a decentralized, distributed environment?

A. XML B. WSDL C. XSD D. SOAP Answer: SOAP 13. Which of the following technologies is a file that defines the structure and data types for XML documents? A. XSD B. XMLD C. XSLT D. XSL Answer: XSL 14. You are creating an application that will employ the services of an applicat ion that resides on a remote server. Which of the following protocols should be used to encode the message to the remote server? A. SOAP B. XML C. RPC D. DCOM Answer: SOAP 15. A WSDL document is a file that contains definitions for which of the followi ng? A. Types, Messages, Bindings. B. Types, Messages, portTypes, bindings, services. C. Types, portTypes, bindings, services. D. Messages, portTypes, bindings, services. Answer: Ty Me po bi se 2.You are creating a Windows service for Windows ME. You want to install the service in the Registry. What utility will do this for you? A. gacutil.exe B. regsvsc.exe C. sc.exe D. installer.exe E. None of the above. Answer: None of the above. 3. Which project template will allow you to create a background service in Visual Studio .NET? A. Windows service. B. Web service. C. Windows application. D. Service. Answer: Windows service. 5. You have created a serviced component that will interface with COM+ services. You want to register the component manually. Which utility will allow you to do this? A. gacutil.exe B. regsvsc.exe C. install.exe D. sc.exe Answer: regsvsc.exe 6. You have created a serviced component that will interface with COM+ services. You want to register the component automatically. Which utility will allow you to do this? A. gacutil.exe B. regsvsc.exe C. xcopy.exe D. sc.exe Answer: xcopy.exe

8. Where would you find the Add Installer link within Visual Studio .NET? A. Under the Project menu. B. Under the Build menu. C. In the Toolbox. D. In the Properties Explorer window. Answer: Explorer window. 9. Which of the following methods will install a Windows service? Choose all that apply. A. xcopy.exe B. regedit.exe C. setup.exe D. service.exe Answer: setup.exe 10. A Windows service must inherit from which class? A. System.Service.ServiceBase B. System.ServiceProcess.Service C. System.ServiceProcess.ServiceBase D. System.Service.Service Answer: ServiceBase 11. Which Registry key would lead you to find the installed Windows service? A. HKEY_LOCAL_MACHINE\Services B. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services C. HKEY_LOCAL_MACHINE\System\Services D. HKEY_LOCAL_MACHINE\CurrentControlSet\Services Answer: System\Curren 13. Which class will allow you to programmatically work with your Windows servic e? A. ServiceController B. ServiceConfiguration C. ServiceStatus D. ServiceControl Answer: Controller 14. Which method of the ServiceController class will allow you to send a command to the service? A. Stop() B. Start() C. Pause() D. ExecuteCommand() Answer: ExecuteCommand() 15. Which of the following services represent the services that together provide an enterprise application? A. Business, Logic, Application B. Application, Business, Data C. Presentation, Business, Data D. Presentation, Logic, Data Answer: Pre Bu Data 2. In order to have your server component accept method calls that pass the object by value, your remote server object must implement which interface? A. IUnknown B. IMarshalByValue C. IMarshalByRef D. ISingleCall E. ISerializable Answer: ISerializable 3. You are in charge of creating a remote object that will return database recor ds to the caller of the method. You want to ensure that the object keeps track of the number of requests, and writes the number out to the database. Which activation mode would you use?

A. SingleCall B. Singleton C. Client-activated D. Server-activated Answer: Singleton 4. You have created a remote object, ChatServer.dll, that is to be deployed to an IIS server. You need to create a configuration file that will provide locatio n and type information. Which file would you create? A. web.config B. machine.config C. application.config D. ChatServer.exe.config Answer: web.config 11. To which namespace does the Activator class belong? A. System B. System.Remoting C. System.Remote D. System.Remoting.Activation Answer: System 13. To which namespace does the HttpChannel class belong? A. System.Remoting B. System.Runtime.Remoting.Channels.Http C. System.Runtime.Remoting D. System.Runtime.Remoting.Channels Answer: Channels.Http 14. Which line of code will register a channel? A. ChannelServices.Register (channel); B. ChannelServices.RegisterChannel(4242); C. ChannelServices.Register (4242); D. ChannelServices.RegisterChannel(channel); Answer: Channel(channel); 15. In which directory does the <application_name>.exe.config file belong? A. In the bin directory of the application. B. In the root directory of the application. C. In the \Winnt\System32 directory. D. In the \Program Files\Microsoft.NET directory. Answer: root directory 2. Your manager has asked you about interoperability between XML Web Services and an existing CORBA environment. What wire protocol will you tell your manager about that will interoperate with CORBA? A. RPC B. COM+ C. SOAP D. DCOM Answer: SOAP 3. When discussing the XML Web Services architecture, which sentence best describes the service broker node? A. Broadcasts the available services. B. Advertises the available services in Active Directory. C. Advertises the services that are registered in the Registry. D. Assists the consumer to find the provider that supplies a particular web service. Answer: consumer 5. You want to ensure that your web method uses the cache for results, so you change the web method attribute to [WebMethod(BufferResponse = true)]. When you investigate, you find that your web method still is not using the cache. What is the most efficient way of ensuring that your web method uses the cache?

A. Add CacheTime=300 to the WebMethod attribute. B. Add Cache=true to the WebMethod attribute. C. Add EnableCache=true to the WebMethod attribute. D. Add CacheDuration=300 as a parameter to the WebMethod attribute. Answer: parameter to t 6. What is the name of the root element in a WSDL document? A. definition B. wsdl_root C. xml_root D. root Answer: definition 8. What sentence best describes loosely coupled components? A. Both components use a common event model to communicate. B. Both components use public variables and methods to communicate. C. Both components use only public methods to communicate. D. Both components use asynchronous methods to communicate. Answer: asynchronous 9. You need to build a proxy class for an XML web service. What tool will you us e? Select all that apply. A. cdc.exe B. wsdl.exe C. proxy.exe D. disco.exe Answer: wsdl.exe 10. When you create an XML web service, it is stored in a source file. What is t he extension of that source file? A. .xmls B. .asxm C. .asmx D. .asxml Answer: .asmx 11. By adding the [WebService(Namespace="http://xxx.yyy")] attribute in front of the class that defines the XML web service, you modify a namespace. What is that namespace? A. The namespace of the XML web service. B. The default namespace of the SOAP messages. C. The namespace of the ASP.NET server. D. The default URL that all redirections will go to. Answer: XML web service. 12. By setting the EnableSession property to True, you have access to what resources? A. Nothing. You need to create the session first. B. Session variables. C. Application variables. D. Local variables stored in the Web Method session. Answer: Session variables. 13. The XML Web service broker stores information about the XML web services that have published their services to the broker. What structure does the servic e broker store the information in? A. Broker registry. B. Windows Registry. C. UDDI registry. D. XML document. Answer: UDDI registry. 14. True or false? XML documents contain the data model of the data they contain . A. True

B. False Answer: True 15. After creating a proxy class, you compile it. What type of file will the pro xy be compiled to? A. .dll B. .asmx C. .aspx D. .proxy Answer: .dll 1. What namespace must be used in order to use the DOM for XML support? A. System.Data.Xml B. System.Xml C. System.Xml.DOM D. System.DOM Answer: System.Xml 4. True or False. XML Transformations can be used to create a form letter. A. True. B. False. Answer: False. 6. You are parsing an XML document using an XmlReader. You find that the resulting node tree is very large compared to the number of elements and attributes in the XML document. Why would the result of the parsing produce a large node tree? A. The WhitespaceHandling parameter is set to WhitespaceHandling.All. B. The WhitespaceHandling parameter is set to WhitespaceHandling.None. C. The WhitespaceHandling parameter is set to WhitespaceHandling.Auto. D. The WhitespaceHandling parameter is set to WhitespaceHandling.Special. Answer: .All. 7. Which of the following classes supports XML schemas? Select all that apply. A. XmlReader B. XmlDocument C. XmlValidatingReader D. XmlNodeReader Answer: ValidatingReader 8. You are developing an application that will connect to a Microsoft SQL Server 6.5, and you need to select the appropriate ADO.NET connection object for this database server. What ADO.NET connection object is the most appropriate? A. XxxConnection B. SqlConnection C. OleDbConnection D. OdbcConnection Answer: OleDbConnection 14. When you build the schema of a DataSet, you need to model the data types of the data that will reside in the DataColumn objects. What data type would you use to represent a date? A. date B. day C. System.DateTime D. variant Answer: DateTime 15. True or False. HTML must be well formed to be used with XML. A. True. B. False. Answer: True. 1. You need to create a UDDI registry for your company. What are your options regarding private UDDI registries? A. Use the Private UDDI SDK from Microsoft.

B. Implement your own private UDDI registry by implementing the entire UDDI specification. C. Implement a custom publish/discover architecture. D. Hard-code the endpoints. Answer: UDDI registry 1.To quit a c# application the following should be used a.Application.Exit(); b.System.Environment.Exit(0) c.System.Environment.Exit(1) (Your selection was wrong) d.All Of The Above Answer: d.All Of The Above 2.The c# keyword float maps to which .NET type? Answer: System.Single 3.Which of these string definitions will prevent escaping on backslashes in c#? Answer: String s=@\teststring; 4.Which of the following statements correctly declares a 2 dimensional array in c#? Answer: int[,] myarray; 5.The c# keyword int maps to which .NET type? Answer: System.Int32 6.dual main is possible Answer: yes 7.Is the anonymous properties are beneficial than normal properties in C#3.0 ? Answer: No 8.Which of this is true about "params int[] arr" ? Answer: params should be the last parameter passed to a function 9.Which among this is a valid Method of File Class ? Answer: ReadAllBytes() 10.FileInfo.OpenText() return a Answer: Streamreader 11.What is the use of ?? operator Answer: Used to assign value to a nullable type 12.What is the syntax for creating a nullable type ? Answer: char? nChar = J ; 13.Ildasm.exe used for? Answer: MSIL code to Text File 14.What does the Initial Catalog parameter define in the connection string? Answer: Database name 15.Whats the .NET collection class that allows an element to be accessed using a unique key? Answer: HashTable 16.Can you store multiple data types in System.Array? Answer: No 17.How can you clean up objects holding resources from within the code? Answer: Call Dispose Method

18.Which controls do not have events? Answer: TimerControl 19.Is String is Value Type or Reference Type in C#? Answer: Value Type 20.I have two contructor one is Static Constructor and another one is Public Con structor,Which one is Call first Answer: Static Constructor 21.Method Overloading and Overriding are the same. Answer: False 22.Which of the following is a correct call to the Main() function Answer: static void Main() 23.A local C# variable declared in the for loop is in scope within Answer: Body of the for loop 24.Interfaces provide implementation of methods Answer: False 25.Operators cannot be overloaded? Answer: && 26.Events are associated with Answer: Delegates 27.Indexers are associated with Answer: Properties 28.What is meant by Boxing? Answer: Valuetype to Reference type 29.The Content of Assembly is viewed by using Answer: ILDASM.exe 30.Which of the following isn t a dictionary classes? Answer: Queue 31.Which one of below collections class uses LIFO(last in first out )? Answer: Stack 32.Which one of below collections class uses FIFO(first in first out )? Answer: Queue 33.Which is the correct way to define a delegate ? Answer: public delegate int Calculate(int Basic, int Da,int PF); 34.Versioning is applicable for private assemblies Answer: No 35.Which of the following is true for Structure Answer: Structures do not require constructors 36.What is true for class and structure? Answer: Class use heap and structure use stack 37.Is it possible to have different access modifiers on the get/set methods of a property Answer: No 38.Which keyword is invalid when it is used with parameters variables sent to a

method ? Answer: param 39.Which of these datatypes are not CLS Compliant ? Answer: sbyte 40.Which of these options are not a member of System.Console Class Answer: TitleText 41.Can notepad be used to create .NET Programs ? Answer: Yes 42.For the C# Compiler csc.exe, which option is the default output type among th e given Output options ? Answer: /target:exe 43.What line of code should be used to instruct the C# compiler to check code fo r CLS compliance using .NET attribute ? Answer: [assembly: System.CLSCmpliant(true)] 44.What is the entry point of Thread? Answer: run method 45.How many objects will be created in this case Answer: one 46.What data type RangeValidator control does not support?What data type RangeVa lidator control does not support? Answer: Double 47.Which is not the keyword in c# language? Answer: boolean 48.What does WSDL stand for ? Answer: Web Services Description Language

49.Operator OverLoading In C# Answer: && 50.class X { public void C() { Console.WriteLine("X.C"); } public virtual void D() { Console.WriteLine("X.D"); } } class Y: X { new public void C() { Console.WriteLine("Y.C"); } public override void D() { Console.WriteLine("Y.D"); } } class Test { static void Main() { Y y = new Y(); X x = y; x.C(); y.C(); x.D();

y.D(); } } Answer: X.C, Y.C, Y.D ,Y.D 51.Which keyword is used to call the base class constructor in C#? Answer: base 52.What is the name of C# command line compiler? Answer: csc.exe 53.In inheritance, when a class inherit another class they can inherit private m ethod of base class? Answer: Yes 54.Which access modifer use in method of Interface? Answer: None 55.Which is true for the Destructors? Answer: All of the above 56.So as to make Multipple Inheritance possible in .NET which conecpt we use? Answer: Interface 57.Which of the following is not a reference type? Answer: struct types 58.Using which keyword we will be able to call base class functionality Answer: base 59.How can we prevent a class fromgetting Instantiating Answer: Both 60.Is it Possible to create constructor in an abstract class? Answer: Yes,but only concrete constructor 61.A class type in c# is a value type Answer: no 62.How to retrive Thried highest salery from salery table? Answer: SELECT MIN (SAL) FROM SALERY WHERE SAL IN (SELECT TOP 3 SAL FROM SALERY ORDER BY SAL DESC) 63.We need to register a private assembly in windows registry in order to use it (True/False) Answer: False 64.In c# a technique used to stream the data is known as Answer: Serialization 65.To change the variable while debugging, the following window is used? Answer: Immediate window 66.How to deploy an assembly? Answer: All The Above 67.In a multilevel hierarchy how r constructors called Answer: Top down

68.Bool data type in c# is Answer: Value type 69.To write a line of text to console window ,we make following call Answer: both 70.To read user input from console, we make following call Answer: both 1)test is a Random object, then what expression will return a value between 0 an d 100? Next.test(100) test.Next(100) test(0,100) test(Next(100)) Answer: test.Next(100) 2)To determine the number of dimensions of an array at runtime, which one of the following properties do you use? LastIndex UnBound Size Rank Length Answer: Rank 3)What is the exception that is thrown when there is an attempt to dynamically a ccess a method that does not exist? MissingMethodException TypeLoadException MethodLoadException MethodAccessException Answer: MissingMethodException 4)Which one is not user defined data type? Class String Struct Enumerator Answer: String 5)Can we have static indexer in C# ? NO YES None Answer: NO

6)Can two catch blocks be executed? NO YES None Answer: NO 7)Can we have different access modifiers on get/set methods of a property ? NO YES None Answer: NO 8)If we inherit a class do the private variables also get inherited ? Yes, the variables are inherited but can not be accessed directly by the class interface Yes, the variables are inherited and also we canaccessed directly by the class interface NO NONE Answer: Yes, the variables are inherited but can not be accessed directly by the class interface 9)Can we use events with threading ? YES NO None Answer: YES 10)Example for Daemon thread Garbage collector. WCF WPF NONE Answer: Garbage collector 11)Object type collections are located in the whcih NameSpace? System.Collections System.Collections.Generic None Answer: System.Collections

12)Generic Collections are located in which Name-space? System.Collections.Generic System.Collections System.OBJECT NONE Answer: System.Collections.Generic 13)Static datamembers should be initialized inside the constructor. FALSE TRUE None Answer: FALSE 14)Which method do you invoke on the DataAdapter control to load your generated dataset with data? Read() Fill() Write() CopyRow() Answer: Fill() 15)Can you edit data in the Repeater control? No Yes None Answer: No 16)Whats the .NET collection class that allows an element to be accessed using a unique key? Array HashTable Array List int[] Answer: HashTable 17)Will the finally block get executed if an exception has not occurred? No Yes None Answer: Yes

18)Can multiple catch blocks be executed for a single try statement? No Yes None Answer: No 19)Can you store multiple data types in System.Array? Select Answer: No Yes Int,String Answer: No 20)What the top .NET class that everything is derived from? System.Windows.Forms System.Object System.Collection None Char Answer: System.Object 21)Does C# support multiple-inheritance? No Yes None Answer: No 22)Is it possible to have different access modifiers on the get/set methods of a property? Yes No May Be Can t Say Answer: No 23)Do finally block get executed if the exception had not occurred? Yes No May Be Can t Say

Answer: Yes 24)Type of code security that protects system resources from unauthorized calls Role-based Security Code-based Security both a and b None of the above Answer: Code-based Security 25)________________ refers to formatting data based on locale. Globalization Localization both a and b None of the above Answer: Globalization 26)Which of the following can t be used in our .NET application? .Net assemblies ActiveX control COM type libraries All of the above can be used Answer: All of the above can be used 27)All control inherits either directly or indirectly from the base class contro l Yes No May Be Can t Say Answer: Yes 28)We can add methods, fields and events to our control in the same way as we ad d member to a class Yes No May Be Can t Say Answer: Yes 29)An inherited control from the existing one also inherits the visual represent ation of the base control Yes No

May Be Can t Say Answer: Yes 30)What are the basic techniques for creating a control? Inheriting from an existing control Inherit from UserControl Inherit form Control a and b a,b and c Answer: a,b and c 31)_______________ represents a drawing surface and provides methods for renderi ng to that drawing surface. Graphic object Pens object Brushes object Colors object Answer: Graphic object 32)What does the keyword virtual mean in the method definition? The The The The Answer: method method method method is public can be derived is static can be over-ridden

33)Can you inherit multiple interfaces? Yes No May Be Can t Say Answer: Yes 34)What is the .NET collection class that allows an element to be accessed using a unique key? HashTable ArrayList ArrayList Queue Answer: HashTable 35)Can you store multiple data types in System.Array?

The method can be over-ridden

Yes No May Be Can t Say Answer: Yes 36)Different ways a method can be overloaded in C#.NET Different parameter data types Different number of parameters Different order of parameters All of the above Answer: All of the above 37)The RangeValidator control supports the following data types Integer only Date, Integer and String only string Date and Integer Answer: Date, Integer and String 38)Boxing in .Net allows the user to convert a a a a interger type to double reference type to a value type value type to a reference type double type to interger

Answer: a value type to a reference type 39)Difference between Convert.ToString() and ToString() Convert.ToString() handle null values but ToString() don t ToString() output as per format supplied Convert.ToString() only handle null values ToString() handle null values but Convert.ToString() don t Answer: Convert.ToString() handle null values but ToString() don t 40)int keyword targets to which .Net type? System.Int8 System.Int16 System.Int32 System.Int64 Answer: System.Int32 41)An Event has _____ as default return type

No return type for events Double Integer String Answer: No return type for events 42)What are the features of an abstract class? It contain instance variables It contain constructors It may extend another class all of the above Answer: all of the above 43)Sealed Classes cannot be a base class. True False May Be Can t Say Answer: True 44)Is there any errors in this -> EmployeeMgmt constructor: Public int EmployeeM gmt { emp_id = 100; } Return type No errors Formal parameters Name Answer: Return type 45)Two methods with the same name but with different parameters Overloading Loading Multiplexing Duplexing Answer: Overloading 46)Feature of a local variable It It It It can be used anywhere in the program must accept a class must be declared within a method represent a class object

Answer: It must be declared within a method

47)A variable which is declared inside a method is called a________variable Serial Local Private Static Answer: Local 48)Which of the following Statement rethrows Exception throw new System.Exception(); throw; rethrow Exception(); rethrow; Answer: throw; 49)All the C# programs must have the following statement include System using System using DotNet import System ANswer: using System 50)How do you convert a string into an integer in .NET? Int32.Parse(string) Int64.Parse(string) Int.Parse(string) Int16.Parse(string) none of these Answer: Int32.Parse(string) 51)alternative of multiple inheritance in c#? Interface abstract class static class sealed class Answer: Interface 52)which of the following is a C# keyword? base if case switch all of the above Answer: all of the above

53)Can I define my own exceptions? Yes, as long as you follow the rule that exceptions derive from System.E xception. More specifically, MS recommend that user-defined exceptions inherit f rom System.ApplicationException (which is derived from System.Exception). Only instances of the System.Exception classes, or classes derived from System.Exception. This is in sharp contrast with C++ where instances of almost a ny type can be thrown. No None Answer: Yes, as long as you follow the rule that exceptions derive from System.E xception. More specifically, MS recommend that user-defined exceptions inherit f rom System.ApplicationException (which is derived from System.Exception). 54)Which object class methods can a derived class override? All of them Only the ToString method The virtual methods The static methods Answer: The virtual methods 55)What is the difference between interface and abstract class An abstract class may only contain incomplete methods An interface may contain complete or incomplete methods A class may inherit several interfaces, A class may inherit only one abs tract class A class implementing an abstract class has to implement all the methods of the abstract class, but the same is not required in the case of an interface Answer: A class may inherit several interfaces, A class may inherit only one abs tract class 56)Which construct is used to ensure that a certain section of code always runs whenever execution leaves a designated piece of code, whether due to an exceptio n or not? try/catch try/finally try/throw catch/finally Answer: try/finally 57)Are private class-level variables inherited? No, because class is private. Yes, but they are not accessible. Yes, and you can access the variables. Undeterminate.

Answer: Yes, but they are not accessible. 58)What does the parameter Initial Catalog define inside Connection String? Password User name Database Secuity Answer: Database 59)which words combination is used to override method? super,override abstract,virtual virtual,overload virtual,override Answer: virtual,override 60)int x = 42; int s = 43; x++; x += s; Console.WriteLine(x); 2 85 42 45 Answer: 85 61)Which of the following is a value type, and not a reference type? array delegate enum class Answer: enum 62)Which statement is the keyword default normally used? in in in in a a a a switch if else loop foreach

Answer: in a switch 63)True or false: an instance of a derived class may be passed as an argument to a method that expects an instance of the base class.

True False True False Answer: True 64)Can an Abstract class be declared as sealed? No Yes In certain situations Can t Say Answer: No 65)Which operator is used to allocate memory for an instance of a class, as well as to pass arguments to a constructor of that class? new delete alloc malloc Answer: new 66)What happens to the input variable index in the following call: int i = 20; foo( ref i ); public void foo ( ref int i ) { int j = 3; i = j; i += 10; } i i i i is is is is not changed 20 23 13

Answer: i is 13 67)An array is a list of data items that _________________ all have the same type all have different names all are integers all are orignally set to null (\0 ) none of the above Answer: all have the same type 68)which of the following is not a c# keyword?

struct while else break inheritance Answer: inheritance 69)C# does not support? multiple inheritance interface abstract static Answer: multiple inheritance 70)If a method is marked as protected internal who can access it? Access Access aining class. Access Access aining class. is limited to the current assembly is limited to the containing class or types derived from the cont is limited to the containing type is limited to the current assembly or types derived from the cont

Answer: Access is limited to the current assembly or types derived from the cont aining class. 71)what is the default access specifier for a Top-level Class, which are not nes ted into other Classes public private protected internal Answer: internal 72)The following code will generate a compiler error. string GetAgePhrase(int age) { if (age > 60) return Senior; if (age > 40) return Middle-aged; if (age > 20) return Adult; if (age > 12) return Teen-aged; if (age > 4) return Toddler; } Which of the following statements, inserted as the last line of the function, wo uld solve the problem? continue; break; return Infant; return;

return 0; Answer: return Infant; 73)Which of the following is not a C# keyword? Implements If Private Delegate Answer: Implements 74)The statement that is used to replace multiple if statements is called The switch & case statement ?: (ternary operator) The nestedif statement The #endif statement Answer: The switch & case statement 75)Does C# support multiple-inheritance? Yes No --Answer: No 76)In HashTable,if it is readonly or fixed only ,if you provide values what happ ens? ArgumentNullException ArgumentException Not SupportedException Answer: Not SupportedException 77)What happens if you pass an element which already exists in HashTable? ArgumentNullException ArgumentException Not SupportedException Answer: ArgumentException 78)what happens if you pass null key for a HashTable? ArgumentNullException NotSupportedException ArgumentException

Answer: ArgumentNullException 79)Does Console.WriteLine() stop printing if it encounters null character in the middle of string yes no Can t say ANswer: no 80)To iterate through the items of array we use for loop for each Both 1 & 2 None of Above Answer: Both 1 & 2 81)Arrays implements ___________Interface IEnumerable IList IDictonary All Of The Above Answer: IEnumerable 82)Arrays values are stored in Stack or Heap stack heap Can t say Answer: heap 83)Does c# supports Union? yes no Can t say Answer: no 84)Which operator is used for connecting a event with a procedure in c# += = both None of these Answer: +=

85)The equivalent Html control for the tag is HtmlCheckBox htmlnputCheckBox HtmlCheck CheckBox Answer: htmlnputCheckBox 86)The equivalent HTML control for the tag is HtmlInput HtmlButton HtmlPushButton HtmlInputButton Answer: HtmlInputButton 87)Static method can not be overriden. true false Both None of these Answer: true 88)A structure in c# can be derived from one or more class interface both None of these Answer: interface 89)Which one of the following statement is correct string is immutable & StringBuilder is muttable Both string & StringBuilder are muttable string is mutable & StringBuilder is immuttable None Answer: string is immutable & StringBuilder is muttable 90)Which of the following is not a C# keyword? delegate if implements private Answer: implements

91)what is difference between keyword const and static readonly both supports only reference types both supports reference types and value types static read only supports reference types and value types const supports reference types and value types all are wrong Answer: static read only supports reference types and value types 92)Can u allow classes to be inherited but prevent the method from being overrid den yes no Can t say Answer: yes 93)Can u override private virtual methods? no yes Can t say Answer: no 94)Can u declare override method static while original method is non-static? yes no Can t say Answer: no 95)Does Main() in c# should be always to be public ? no yes Can t say Answer: yes 96)Is GoTo statement supported in c#? yes no Can t say Answer: yes 97)can we create enumerated data-types in c#?

no yes Can t say Answer: yes 98)what data-type should we use if u want an 8 -bit value that is signed? byte sbyte int long Answer: sbyte 99)How will you choose between abstract class and interface? When default implementation is required, abstract class will be used,els e interface will be chosen. To implement abstraction, abstract class should be used For each interface, abstract class should be declared NA Answer: When default implementation is required, abstract class will be used,els e interface will be chosen. 100)Which of the following causes theapplication Run method to end A method An event The last line of code in the programe is reached It never ends Answer: An event 101)What method can be used to display a form ShowDialog ShowForm Show None Answer: ShowDialog 102)Are member of the an interface declared as public private or protected? yes no none of these no Answer: yes 103)Which of the following is the same as a base class?

Parent class Derived Class Child class None of these Answer: Parent class 104)Which of the following keyword is not used in exception? try catch throws throw Answer: throws 105)Where within a class can an event be instantiated either a proerty or a method nor a property or a method both a property or a method a proerty Answer: either a proerty or a method 106)Can you declare the main method as private yes no other no Answer: yes 107)How many interface can be inherited at a time? many zero many or zero one Answer: many or zero 01.What extension you use for your c# .c# .c .css .cs Answer: .cs 02.what is the output? Gives error Compiles but not executes

from parentparent from parentchild from childchild None of Above Answer: from parentparent from parentchild from childchild 03.No of integral data types in c# 2.0 9 6 8 7 Answer: 9 04.Which of the following is not a keyword in c# protect abstract private public Answer: protect 05.What is the output? 100 10 100 9000 100 0 None of Above Answer: 100 10 06.Is delegate a type safe function pointer yes no Can t say Answer: yes 07.can we run ASP.NET 1.1 application and ASP.NET 2.0 application on same comput er no yes CAB archeive Answer: yes 08.can we use break statement in finally block yes no Can t say Answer: no 09.what is the implicit name of parameter that GETS passed into class Value

Variable Constant None of Above Answer: Value 10.Inorder to use StringBuilder in class we need to refer System.String System.Text Both 1 & 2 None Answer: System.Text 11.which tool is used to browse classes structs ,interfaces etc in BCL wincv Immediatewindow callstackwindow None of Above Answer: wincv 12.How do you refer parent class in c# this base mybase None of Above Answer: base 13.The following is a correct call to Main() function in c# public static void Main(string [] args) public static void main(String args[]) Both 1 & 2 None of Above Answer: public static void Main(string [] args) 14.All the variables local to a method in c# must be initialized? Yes No Can t say Answer: Yes 15.Does Structs and Classes support Inheritance Structs supports Inheritence Classes supports Inheritence Both 1 & 2 None of Above Answer: Classes supports Inheritence 16.Which of the following are predefined reference types in c#?

Object Class Interface Both 2 & 3 Both 1 & 2 Answer: Both 1 & 2 17.What is the property of XML Case sensitive Root element is neccessry opening and closing tag is neccessary Can store Huge data All of the above Answer: All of the above 18.How can you call Garbage Collector? gc.invoke() gc.cal() gc,collect() gc.run() Answer: gc,collect() 19.Which keword is used to implement shadowing in C# new KEWWORD IN BASE CALSS shadow KEWWORD IN BASE CLASS new KEWWORD IN DERIVED CLASS shadow KEWWORD IN DERIVED CLASS CAN NNOT BE IMPLEMENTED Answer: new KEWWORD IN DERIVED CLASS 20.Which Operator can not be overloaded? Unary Operators Binary Operators Conditioal Operators Logical Operators Answer 3 and Answer 4 Answer: Conditioal Operators + Logical Operators 21.A Function Can Be Over loaded on the basis of : Type of Parameters Sequence of Parameter Return type Number of parameter All of the above Answer: All of the above 22.What is boxing?

Encapsulating Encapsulating Encapsulating Encapsulating

an object a copy of a copy of a copy of

in a value type. an object in a value type an object in a value type a value type in an object

Answer: Encapsulating a copy of a value type in an object 23.Which of these statements correctly declares a two-dimensional array in C#? int[,] myArray; int[][] myArray; int[2] myArray; System.Array[2] myArray; Answer: int[,] myArray;

System.Int16 System.Int32 System.Int64 System.Int128 Answer: System.Int32 25.Is there an equivalent of exit() for quitting a C# .NET application? No Yes I dont know Answer: Yes 26.Is there regular expression (regex) support available to C# developers? Yes No I dont know Answer: Yes 27.Are private class-level variables inherited? Yes No I dont know Answer: Yes 28.Is it possible to have a static indexer in C#? Yes No I dont know Answer: No 29.Is it possible to inline assembly or IL in C# ? No

24.The C# keyword int

maps to which .NET type?

Yes I dont know Answer: No 30.Which atribute is used to serialize a object [Serializable] [SettingsSerializeAs] [TestFixture] Answer: [Serializable] 31.Which Property of datagrid is used for Sorting AllowSorting AccessKey AutoGenerateColumns Answer: AllowSorting 32.Which property of datagrid is used for paging AllowPaging DataBind DataKeyField Answer: AllowPaging 33.ArrayList belongs to which Assembly System.Collections System.Data System.Data.Net Answer: System.Collections 34.which one is not true with class? It it It It is a reference type is stored in heap is a value type can be inherited

Answer: It is a value type 35.If There is no web.config file in an application then : Program Program Program It show will not execute can not compile can execute but can not be debugged runtime error

Answer: Program can execute but can not be debugged 36.Which one Method is not provided with dataset? ReadXSLT() ReadXML() GetXML()

WriteXML() Answer: ReadXSLT() 37.Which one is not part of Dataset ? DataRow DataColumn DataRelation DataView DataConnection Answer: DataConnection 38.Which one Support Connected Architecture? DataReader Data View Dataset Datalist Answer: DataReader 39.Which one Support Disconnected Architecture? DataList DataReader Dataset Dataview Answer: Dataset 40.The Example of Static Assembly is : Interface class JPEG and Gif Files All of the above Answer: All of the above 41.Garbage Collector Responsible to free unreferenced objects of: Managed Resources UnManaged Resources Both Answer1 and Answer 2 Can not say Answer: Managed Resources 42.What is the order of calling destructor in multiple inheritance ? Base class to derived class Derived Class to Base class Distructor can not be called An error occured Answer: Derived Class to Base class 43.What is the order of calling constructor in multiple inheritance when an obje

ct of derived class is created? Derived to base class Base class to Derived class Constructor of Base class can be called Contructor inheritance can not possible Answer: Base class to Derived class 44.Which is not true with Master Page Master Master Master Master Page Page Page Page can can can can be be be be added added added added on Application Lavel on Page Lavel Folder Lavel control Lavel

Answer: Master Page can be added control Lavel 45.Which is not true for Custom Control ? It It It It is a .dll files can be added to tool box. Can be installed in GAC is added on every page

Answer: It is added on every page 46.Multiple Inheritance Can be implemented by: Can Not Be implemented Intefaces Property Events Answer: Intefaces 47.Which one is not true with static constructor ? Only One Static Cunstructor found in a class It has no parameter it can access static member of class It Has no access modifiers It can be overloaded Answer: It can be overloaded 48.Which one is not correct with static class? It contain only static members It is sealed it can not be instantiated it has private constructor Directly accessed by Other class Answer: Directly accessed by Other class 49.An Interface can hold Only Functions Without Definnitions Only Properties Without Definnitions

Only Events Without Definnitions All Answer: All 50.Which namespaces in .NET has the data functionality class. System.Net; System.Data.SqlClient System.data System.Xml Answer: System.data 51.Extension of a Master page in Asp.net .asmx .master .cs .ascx .ashx Answer: .master 52.Two methods with the same name but with different parameters? Overloading Loading Multiplexing Duplexing Answer: Overloading 53.Feature of a local variable It It It It can be used anywhere in the program must accept a class must be declared within a method represent a class object

Answer: It must be declared within a method 54.A variable which is declared inside a method is called a________variable? Serial Local Private Static Answer: Local 55.The Default Type of enum is integer and has a default value 1 false true none of them Answer: false 56.Boxing is used for

Converting Value Type To Reference Type Converting Reference Type to Value Type Converting Class to Struct Type None of Above Answer: Converting Value Type To Reference Type 57.What is the Default Access Specifier for a Top-Level Class,Which are not Nest ed into Other Classes Public Protected Private Internal Answer: Internal 58.The Statement that is Used to Replace Multiple if Statements is Called The Switch & Case Statement ?: (ternary Operator) The nestedif Statement The #endif Statement Answer: The Switch & Case Statement 59.Can a dll run as stand alone application ? Yes No By Adding some code None of Above Answer: No 60.Which of the following is not a member of ConnectionObject BeginTransaction EndTransaction Execute Open Answer: Execute 61.Why doesn t C# support multiple inheritance? Multiple implementation inheritance injects a lot of simplicity into the implementation The number of places where MI is truly appropriate is actually quite lar ge The number of places where MI is truly appropriate is actually quite sma ll The number of places where MI is truly appropriate is actually quite sma ll and Multiple implementation inheritance injects a lot of complexity into the implementation Answer: The number of places where MI is truly appropriate is actually quite sma ll and Multiple implementation inheritance injects a lot of complexity into the implementation

62.Does Abstract classes contain Constructor? Yes No None Answer: Yes 63.Connecting a event with a procedure in C# through which of the following oper ator = += both None Answer: += 64.Is it possible that a Static method cannot be overridden True False Can t say . Answer: True 65.XML documentation C# compiler generating an XML documentation file from which below command csc /doc:currentXml.xml currentXml.cs csc /xml currentXml.cs c /doc /docfile: currentXml.xml currentXml.cs None Answer: csc /doc:currentXml.xml currentXml.cs 66.Exception ahndling An attempt to dynamically access a method that does not exist.Which Exception wi ll be thorown AccessException LoadException TypeLoadException MissingMethodException Answer: MissingMethodException 67.structure derived from A structure in C# can be derived from one or more interface class both none

Answer: interface 68.How do you force post back using JavaScript? IsPostBack if (!IsPostBack) __doPostBack Answer: __doPostBack 69.Can you call SQL Trigger from ASP.NET application explicitly? Yes No Don t Know Answer: No 70.What is the Maximum and Minimum Size of the Int64 9,223,372,036,854,775,808 / 9,223,372,036,854,775,808 9,223,372,036,854,771,024 / 9,223,372,036,854,771,024 6,400,000,000,000,000,000 / 6,400,000,000,000,000,000 Answer: 9,223,372,036,854,775,808 / 9,223,372,036,854,775,808 71.What is Minimum and Maximum Size of Int32 ? -3,200,102,400 / 3,200,102,448 -2,147,483,648 / 2,147,483,648 -3,200,000,000 / 3,200,000,000 Answer: -2,147,483,648 / 2,147,483,648 72.What is minimum and Maximum Size of Int16 ? -32,256 -16,768 -32,768 -16,256 / / / / 32,256 16,768 32,768 16,256

Answer: -32,768 / 32,768 73.What is the use of Partial Class ? Reduction in file contention in shared development environments. The for ms designer and the developer are not both trying to change the same file Isolation of low-level details. You don t have to worry about the detail s of how the individual controls are instantiated and initialized Protection for generated code through changes. You are less likely to ch ange the generated code, and any code that you add will not be in the designer f ile and is protected. All the above Answer: All the above 74.How many constructors does a class have? One Two

Three Many Answer: Many 75.What debugging tools come with the .NET SDK? CorDBG command-line debugger Dbg CLR graphic debugger Both A and B None of the above Answer: Both A and B 76.Is XML case-sensitive? Yes No None of the above Answer: Yes 77.Can you change the value of a variable while debugging a C# application? Yes No None of the above Answer: Yes 78.Can multiple catch blocks be executed? Yes No None of the above Answer: No 79.Does Abstract classes have constructor? No Yes Not possible, because we cant create an object of abstract classes Answer: Yes 80.What is the base class for the system element hierarchy ? CIM_LogicalElement CIM_ManagedSystemElement Win32_Process Win32_NetworkAdapter Answer: CIM_ManagedSystemElement 81.How can you get the ColumnName,DataType ColumnSize, IsKeyColumn,IsAutoIncreme nt of the table from the dataset. GetSchemaTable method of the DataReader Fill method of data adaptor

GetTableDetails method Dataset.GetDataTable() Answer: GetSchemaTable method of the DataReader 82.Main function What are valid signatures for the Main function? public static void Main() public static int Main() public static void Main( string[] args ) 1 And 3 Above ALL Answer: Above ALL 83.RCW

Run Callable Wrappers Revised Code of Washington Run time Callable Wrappers Run time Callable Writer Answer: Run time Callable Wrappers 84. To validate textbox for number Which of the function is used to check textbox only contain number ? char.IsDigit char.IsLetter char.IsNumber char.IsLetterOrDigit Answer: char.IsLetter 85.Separet time from datetime Which function is used to time from datetime ? Split Remove CompareTo None Answer: Split 86.What is an Object A A A A combination combination combination combination of of of of message and data namespace task to be performed Array

Answer: A combination of message and data

What is The Full FOrm of

RCW ..?

87.What is an Encapsulation An action or occurrence such as click. A package of one or more components together A set of statement that performs specific task A reference type variable Answer: A package of one or more components together 88.The subscript number of an array starts from 0 1 -1 2 Answer: 0 89.Which Escape Character is used for New Line in Console /n \n //n \\n Answer: \n 90.Which is true ? 1. 2. 3. 4. There can be only one static constructor in the class. The static constructor should be without parameters. It can only access the static members of the class. There should be no access modifier in static constructor definition. 1 & 2 & 1 & All 2 3 & 4 3 & 4 the above

Answer: All the above 91.Sort Elements How can you sort the elements of the array in descending order? System.Array.Clone() By calling Sort() and then Reverse() methods. By Calling Reverse() By calling Sort() Answer: By calling Sort() and then Reverse() methods. 92.what are the Activation modes for .NET Remoting what are the Activation modes for .NET Remoting Singleton Singlecall Both None

Answer: Both 93.Code Access Security does which one of the following? Defines permissions and permission sets that represent the right to acce ss various system resources Grants permissions to each assembly that is loaded, based on the permiss ions requested by the code Enables code to demand that its callers have specific permissions All of the above Answer: All of the above 94.Which of the following tools manages certificates, certificate trust lists (C TLs), and certificate revocation lists (CRLs)? sn.exe certnet.exe certmgr.exe ctl.exe Answer: certmgr.exe 95.Which one of the following .NET Framework tools displays details for failed a ssembly binds? asm.exe logvw.exe logasm.exe Fuslogvw.exe Answer: Fuslogvw.exe 96.Which one of the following statement is true for Assembly s Manifest? It loads the header file for the referenced assembly Enumerates other independent assemblies. Provides a level of indirection between consumers of the assembly and th e assembly s implementation. It loads the System Registry. Answer: Provides a level of indirection between consumers of the assembly and th e assembly s implementation. 97.What is the term for assemblies that are marked for a specific culture via th eir AssemblyCultureAttribute? Sattellite assemblies Cultured assemblies Multilanguage assemblies Global assemblies Answer: Sattellite assemblies 98.Whats the difference between a Thread and a Process? A process can have multiple threads in addition to the primary thread A process is code that is to be serially executed within a thread When a process begins to execute, it continues until it is killed or unt

il it is interrupted by a process with higher priority No Difference, they are so same thing Answer: A process can have multiple threads in addition to the primary thread 99.Which of the following is Reference Type? string bool int ushort Answer: string Question Marks: Using System; sealed class MyClass { public int x; public int y; } class MyDeriv edC : MyClass { } class MainClass { public static void Main() { MyClass mC = new MyClass(); mC.x = 110; mC.y = 150; Console.WriteLine("x = {0}, y = {1}", mC.x, mC.y); } } whats the obvious problem ????????? Choose one answer. a.x and y have not been initialized in the base class b.The Console.WriteLine format is incorrect c.sealed class needs an access modifier d.Canot Inherit from Sealed Class Answer: Canot Inherit from Sealed Class Question Marks: What is the default value for the Method attribute in a ASP.NET server-side Form control? Choose one answer. a.Get b.POST c.SOAP d.SMTP Answer: Get Question Marks: If a method is marked as protected internal who can access it? Choose one answer. a.Access is limited to the current assembly or types derived from the co ntaining class. b.Access is limited to the containing type c.Access is limited to the containing class or types derived from the co ntaining class d.Access is limited to the current assembly Answer: Access is limited to the current assembly or types derived from the cont aining class. Question Marks: Which statement is true about interface and abstract classes

Choose one answer. a.An interface may contain complete or incomplete methods b.A class implementing an abstract class has to implement all the method s of the abstract class, but the same is not required in the case of an interfac e c.A class may inherit several interfaces, A class can only inherit one a bstract class d.An abstract class may only contain incomplete methods (abstract method s) e.All Answer: A class may inherit several interfaces, A class can only inherit one abs tract class Question Marks: Static void Main(string[] args) { try { Console.WriteLine("Level 1"); try { Cons ole.WriteLine("Level 2"); goto exit; } finally { Console.WriteLine("Level 2 Fini shed"); } } finally { Console.WriteLine("Level 1 Finished"); } exit: ; } What is the output? Choose one answer. a.Leve1,Level 2,Level 1 Finished b.Level,Leve2,Leve 2 Finished c.Level 1,Level 2,Leve 2 Finished,Level 1 Finished d.error Answer: Level 1,Level 2,Leve 2 Finished,Level 1 Finished Question Marks: The following code will generate a compiler error. string GetAgePhrase(int age) { if (age > 50) return "JSuthahar"; if (age > 30) return "DotnetSpider"; if (age > 10) return "WebtekSolutions"; if (age > 9) return "Tradingbell"; if (age > 2) return "Suthahar"; } Which of the following statements, inserted as the last li ne of the function, would solve the problem? Choose one answer. a.Continue; b.Break; c.reture "Welcome"; d.return; e.return 3; Answer: reture "Welcome"; Question Marks: The statement that is used to replace multiple if statements is called Choose one answer. a.The switch & case statement b.The #endif statement c.?: (ternary operator) d.The nestedif statement Answer: The switch & case statement Question Marks: Can you declare the override method static while the original method is non-stat ic? Choose one answer.

a.Yes b.No c.None Answer: No Question Marks: How do you sort a user defined class objects? Choose one answer. a.using IComparable interface b.using sort method c.not possible d.both a and b Answer: using IComparable interface Question Marks: What cannot be declared in interfaces? Choose one answer. a.Enums b.Properties c.Variables d.Indexers Answer: Variables Question Marks: Can we declare indexers as static? Choose one answer. a.Yes b.No c.Can t say Answer: No Question Marks: Can we have declare indexers as static? Choose one answer. a.Yes b.No c.Can t say Answer: No Question Marks: What is System.Int32? Choose one answer. a.class b.struct c.property d.all Answer: struct Question Marks:

Can the class be declared as private or protected? Choose one answer. a.Yes b.No c.Some time Answer: No Question Marks: Difference between Virtual method and Abstract method? Choose one answer. a.Virtual methods may or may not be overridden in the child class b.Abstract methods must be overridden in the child class or else it must also be declared as abstract. c.both 1 and 2 d.None of the above Answer:both 1 and 2 Question Marks: Which utility is used to deploy an assembly in GAC? Choose one answer. a.GACUTIL.exe b.csc c.ngen.exe d.none Answer: GACUTIL.exe Question Marks: Can two catch blocks be executed? Choose one answer. a.No b.yes c.We cant say Answer: No Question Marks: What is the use of ENUM ? Choose one answer. a.It s used to define constants b.It s used to define private variables c.It s used to define public variables d.NONE Answer: It s used to define constants Question Marks: Does C# support multiple inheritance? Choose one answer. a.Yes b.No c.Some Time

Answer: No Question Marks: Can you inherit multiple interfaces? Choose one answer. a.Yes. .NET does support multiple interfaces. b.No. .NET does support multiple interfaces. c.Some time Answer: Yes. .NET does support multiple interfaces. Question Marks: Will the finally block get executed if an exception has not occurred? Choose one answer. a.No b.Yes c.Maybe Answer: Yes Question Marks: How can you sort the elements of the array in descending order? Choose one answer. a.By calling Sort() and then Reverse() methods. b.By calling Reverse() and then Sort() methods. c.Both Answer: By calling Sort() and then Reverse() methods. Question Marks: Can you store multiple data types in System.Array? Choose one answer. a.Yes b.No c.Some Time Answer: No Question Marks: Whats the top .NET class that everything is derived from? Choose one answer. a.System.String b.StringBuilder c.System.Object. d.Text.String Answer: System.Object. Question Marks: Are private class-level variables inherited? Choose one answer.

a.Yes b.No c.Yes, but they are not accessible. Answer: Yes, but they are not accessible. Question Marks: Does C# support multiple-inheritance? Choose one answer. a.Yes b.No. c.Some Time Answer: No Question Marks: What will be the output? object s1 = "One " + 1; var s2 = "One " + 1; 1. if (s1 == s2) Console.Write("Equal"); else Console.Write("Not Equal"); 2. if (s1.Equals (s2)) Console.Write("Equal"); else Console.Write("Not Equal"); Choose one answer. a.1. Error, 2. Equal b.1. Equal, 2. Error c.1. Not Equal, 2. Equal d.1. Equal, 2. Equal Answer: 1. Not Equal, 2. Equal Question Marks: Class A {} Class B : A {} (1) A a1 = new B(); (2) B b1 = new A(); Which one will execute? Choose one answer. a.2 b.1 c.Both d.None Answer: 1 Question Marks: What is the output of the following code? 1. string tempStr = "Welcome" + 2; 2. string tempStr1 = "Welcome" + "2"; 3. string tempStr2 = "Welcome" + 2 * 3; 4. st ring tempStr3 = "Welcome" + 2 - 1; Choose one answer. a.1. Welcome2, 2. Welcome2, 3. Welcome6, 4. Error b.1. Welcome2, 2. Welcome2, 3. Welcome6, 4. Welcome1 c.1. Welcome2, 2. Welcome2, 3. Welcome23, 4. Welcome1 d.1. Welcome2, 2. Welcome2, 3. Welcome23, 4. Error Answer: 1. Welcome2, 2. Welcome2, 3. Welcome6, 4. Error Question Marks: Constructors can not be static Choose one answer. a.true

b.false c.none Answer: false Question Marks: An abstract class Choose one answer. a.may contain instance variables b.may contain constructors c.may extend another class d.all of the above Answer: all of the above

108)Which one is true? System System System System is is is is a class a data member a name space type

Answer: System is a name space 1.Which of the following is Reference Type? string bool int ushort Answer: string 2.If you are using transactions, what is a great technique that can help you rol l back to certain points within a transaction? Tables Zones Savepoints Bookmarks Answer: Savepoints 3. A User wants to deploy a zero impact .NET application (one that will not affect other applications, does not use the registry, and lea ves no residue on removal).In the above scenario, which one of the following mus t the User deploy? A A A A Dynamic assembly global assembly static assembly Public assembly

Answer: A Dynamic assembly 4. A User wants to use reflection to discover the assembly that contains a speci fic module.

which one of the following classes does the user should use?

Module ConstructorInfo PropertyInfo Assembly Answer: Module 5. Which Namespace helps to find informations of an assembly? System.Globalization System.IO System.Reflection System.Data Answer: System.Reflection 6. Which of the given method does not belong to System.Object? Equals Clone GetType ToString Answer: Clone

7. Which code snippet should you use to make the runtime assign an unauthenticat ed principal object to each running thread? AppDomain^ domain = AppDomain::CurrentDomain;domain->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal); AppDomain^ domain = AppDomain::CurrentDomain;domain- >SetPrincipalPolicy (PrincipalPolicy::UnauthenticatedPrincipal); AppDomain^ domain = AppDomain::CurrentDomain;domain->SetThreadPrincipal( gcnew WindowsPrincipal(nullptr)); AppDomain^ domain = AppDomain::CurrentDomain;domain- >SetAppDomainPolicy (PolicyLevel::CreateAppDomainLevel()); Answer: AppDomain^ domain = AppDomain::CurrentDomain;domain- >SetPrincip alPolicy(PrincipalPolicy::UnauthenticatedPrincipal);

Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream() For i As Integer = 1 To 20 formatter.Serialize(ms, data(i - 1))Next Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream()format ter.Serialize(ms, data) Dim formatter As New BinaryFormatter()Dim buffer As New Byte(data.Count) {}Dim ms As New MemoryStream(buffer, True)formatter.Serialize(ms, data) Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream()While ms.CanRead formatter.Serialize(ms, data)End While

8. Which code snippet should be used to serialize an object by name List(Of Integer) in a binary format?

Data of type

Answer: Dim formatter As New BinaryFormatter()Dim buffer As New Byte(data.Count) {}Dim ms As New MemoryStream(buffer, True)formatter.Serialize(ms, data) 9. Which property of the Exception class should you use to find a line of code t hat caused an exception to be thrown? StackTrace Data Message Source Answer: StackTrace 10. Which code snippet should you use to gather regional information about custo mers in NewZealand? RegionInfo regionInfo = new RegionInfo("NZ")? // Output the region infor mation... foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.Spe cificCultures)) { // Output the region information...} RegionInfo regionInfo = new RegionInfo("")?if (regionInfo.Name == "NZ") { // Output the region information...} CultureInfo cultureInfo = new CultureInfo("NZ")? Answer: RegionInfo regionInfo = new RegionInfo("NZ")? // Output the region infor mation... 11. A custom event handler needs to be created to automatically print all open d ocuments. The event handler helps specify the number of copies to be printed. Which code s egment should you use to develop a custom event arguments class to pass as a par ameter to the event handler? public class PrintingArgs : EventArgs { private int copies? public Print ingArgs(int numberOfCopies) { this.copies = numberOfCopies? } public int Copies { get { return this.copies? } }} public class PrintingArgs { private EventArgs eventArgs? public Printing Args(EventArgs ea) { this.eventArgs = ea? } public EventArgs Args {get { return eventArgs? }}} public class PrintingArgs { private int copies? public PrintingArgs(int numberOfCopies) { this.copies = numberOfCopies? } public int Copies { get { retu rn this.copies? } }} public class PrintingArgs : EventArgs { private int copies?} Answer: public class PrintingArgs : EventArgs { private int copies? public Print ingArgs(int numberOfCopies) { this.copies = numberOfCopies? } public int Copies { get { return this.copies? } }} 12. Which type should you choose to identify a type that meets the following cri teria: Is always a number? Is not greater than 65,535? System.String System.UInt16 System.IntPtr int

Answer: System.UInt16 13. Which storage option should you use to Initialize each answer of a trueorfal se survey questionnaire to True? Also ensure to Minimize the amount of memory used by each survey? BitVector32 answers = new BitVector32(-1)? BitVector32 answers = new BitVector32(1)? BitArray answers = new BitArray(1)? BitArray answers = new BitArray(-1)? Answer: BitVector32 answers = new BitVector32(-1)? 14. Assume a class is created to compare a speciallyformatted string. The default collation comparisons do not apply.Which code segment should you use to implement the IComparable interfa ce? public ther){ ... }} public ther){ ... }} public other){ ... }} public other){ ... }} class Person : IComparable<string>{ public int CompareTo(object o class Person : IComparable<string>{ public int CompareTo(string o class Person : IComparable<string>{ public bool CompareTo(object class Person : IComparable<string>{ public bool CompareTo(string

Answer: public class Person : IComparable<string>{ public int CompareTo( string other){ ... }} 15. Which Code segment should you use to ensure that a class named Age is writte n such that collections of Age objects can be sorted? public class Age { public int Value? public object CompareTo(object obj) { if (obj is Age) { Age _age = (Age) obj? return Value.CompareTo(obj)? } throw new ArgumentException("object not an Age")? } } public class Age { public int Value? public object CompareTo(int iValue) { try { return Value.CompareTo(iValue)? } catch { throw new ArgumentException ( "object not an Age")? } } } public class Age : IComparable { public int Value? public int CompareTo( object obj) { if (obj is Age) { Age _age = (Age) obj? return Value.CompareTo(_ag e.Value)? } throw new ArgumentException("object not an Age")? } } public class Age : IComparable { public int Value? public int CompareTo( object obj) { try { return Value.CompareTo(((Age) obj).Value)? } catch { return 1? } } } Answer: public class Age : IComparable { public int Value? public int CompareTo( object obj) { if (obj is Age) { Age _age = (Age) obj? return Value.CompareTo(_ag e.Value)? } throw new ArgumentException("object not an Age")? } } 16. How do you prevent a class from being inherited? Mark it as abstract

Mark Mark Mark None

it it it of

as static as sealed as partial the above

Answer: Mark it as sealed 17. What would be the value of the variable y at the end of this code segment? int x = 3; object o = x; x = 4; int y = (int)o; 3 4 7 0 Answer: 3 18. Which copy Array.Clone() method perform? Shallow Copy Deep Copy Hard Copy None Answer: Shallow Copy 19. What is the difference between Convert.Tostring() and ToString()? Select Answer: both accept null values convert.to string accept null values & tostring do not accept null value s both do not accept null values convert.to string do not accept null values & tostring accept null value s none of them Answer: convert.to string accept null values & tostring do not accept null value s 20. The main reason to use operator overloading is... To allow arithmetic operations to run more efficiently To reduce the size of the executable program To allow client code to be more concise and readable than it might be wi th regular methods N/A Answer: To allow client code to be more concise and readable than it mig ht be with regular methods 21. The concept of parameterized datatypes like List is called in C# ...

Templates Generics Delegates Metatypes Hyperclasses Answer: Generics 22. There are five access levels in C#, private, internal, protected, protected internal, and public. True False N/A N/A Answer: True 23. Namespaces are used to ____ ? Avoid name clashes between data types Create a unique name for an assembly Separate assemblies N/A Answer: Avoid name clashes between data types 24. True or false: it is possible to use the const keyword on an reference param eter to prevent the method from modifying the parameter value. True False N/A N/A Answer: False 25. ICloneable interface is used to create new instance of the class with the same v alue as an existing instance. Yes No N/A N/A Answer: Yes 26. Which members can be accessed through an object reference? Only the object class members All members No members None of the Above Answer: Only the object class members 27.

A __________ control defaults to displaying the files in the current directory List Box Drive List Box Dir List Box File List Box None of the above Answer: File List Box 28. How can you come out from the c# windows Forms Application? Application.Exit(); Application.close(); Form.Exit(); Form.Close(); None of the above Answer: Application.Exit(); 29. What is an Abstract Class? A class A class A class A class None of that cannot that can be that cannot that can be the above be inherited instantiated be instantiated instantiated

Answer: A class that cannot be instantiated 30. Can we call a base class method without creating instance? It is possible It is possible It is possible It is possible Not possible if if if if its its its its a a a a partial method static method sealed method abstract method

Answer: It is possible if its a static method 31. Which of these string definitions will prevent escaping on backslashes in C#? string string string string s s s s = = = = #"Test ."Test @"Test &"Test string"; string"; string"; string";

Answer: string s = @"Test string"; 32. Unboxing of a null reference type will return a null. true false an exception is thrown N/A Answer: an exception is thrown 33.

The default type of enum is integer and has a default value 1 true false sometimes no one Answer: false 34. what is the default access specifier for a Top-level Class, which are not ne sted into other Classes public private protected internal Answer: internal 35. The statement that is used to replace multiple if statements is called The switch & case statement ?: (ternary operator) The nestedif statement The #endif statement Answer: The switch & case statement 36. Which Compiler is used for C# cc c++ cs csc Answer: csc 37. The ++ belongs to which operator Category of Operator Arithmetic Operator Arithmetic Assignment Operator Unary Operator Comparison Operator Answer: Unary Operator 38. Console is a ______ Namespace Class Function Escape sequence character Answer: Class 39. What are Arrays

Collection of Collection of Collection of None from the

values of different data type values of same data type values of mixed data type Above

Answer: Collection of values of same data type 40. How to compare case-insensitive string comparison? for ex - india and INDIA System.String.Compare( "india", "INDIA") System.String.Compare( "india", "INDIA", true) System.String.Compare( "india", "INDIA", false) System.String.Compare( "INDIA", "india") Answer: System.String.Compare( "india", "INDIA", true) 41. Can multiple catch blocks be executed? Yes, Next catch blocks will execute if one catch blocks fires off No, if one catch fires off the control is transferred to next catch bloc k No, If one catch code fires off, the control is transferred to the final ly block Answer: No, If one catch code fires off, the control is transferred to the final ly block 42. What are 1.public 2.public 3.public 4.public valid signatures for the Main function? static void Main() static int Main() static void Main( string[] args ) static int Main(string[] args )

Answer: All (void main, int main, void main(str..), int main(str..) 43. Constructor return value ? Select Answer: Constructor returns void Constructor returns any data type Constructor don t return values Answer: Constructor don t return values 44. What is the top .NET class that everything is derived from? system.data system.windows system.collection system.object Answer: system.object 45. Which property of datatable get status when conflict after update a row in D atatable

HasConflict HasError HasErrors HasCollision None Answer: HasError 46. Whether the follow code will occur deadlock if we call test(30)? public void test(int i) { lock(this) { if (i>10) { i--; test(i); } } } Answer: No 47. How to make an instance object of class be remotable and be passed by reference? Implements ISerializable interface. Has Serializable attribute. Implements IObjectReference interface. Inherited from MarshalByRefObject class. Answer: Inherited from MarshalByRefObject class. 48. How to make a class be serializable? Apply the ___________ attribute to a type to indicate that instances of this typ e can be serialized. Serializable Formatable Stream Normalable Answer: Serializable 49. Which Stream class does not support the Seek method? FileStream MemoryStream PipeStream NetworkStream BufferedStream Answer: NetworkStream 50. In the implement of Dispose method for a class, usually we use ___________ to re

quest that the system not call the finalizer for the specified object. GC.Collect(); GC.GetGeneration(this); GC.RegisterForFinalize(this); GC.SuppressFinalize(this); Answer: GC.SuppressFinalize(this); 51. About struct, what s the output of the following code: A struct is defined as: public struct Resources { public int data = 0; } What s the result of the following code: Resources[] list = new Resources[20]; for (int i = 0; i < 20; i++) { Console.WriteLine("data={0}", list[i].data); }

20 lines, each line displays: data=0 20 lines, each line displays: data=null 20 lines, the first one displays: data=0, the second displays: data=1... etc Compiler Error Answer: Compiler Error 52. How to define a read only property named Count in a class? (C# 3.5) public public public public int int int int Count Count Count Count {private get; set;} {get; set;} {private set;} {get; private set;}

Answer: public int Count {get; private set;} 53. If an assemble s version is 3.1.23.542, what s the minor version? 3 1 23 542 Answer: 1 54. Use which option to cause the C# complier to create an executable (EXE) Windows program? /target:exe /target:winexe /target:module /target:library Answer: /target:winexe 55.

Which is the base class of int in C#? Int32 Object ValueType Integer Answer: ValueType 56. How to copy all the items in an Array data type variable named array to an Array List variable named arrayList? arrayList = array.Clone(); foreach(object obj in array) arrayList.Add(obj); arrayList.Add(array); array.CopyTo(arrayList); Answer: foreach(object obj in array) arrayList.Add(obj); 57. The usage of new keyword in C#, which statements are correct? 1. new Operator, used to create objects and invoke constructors. 2. new Mofidior, used to hide an inherited member from a base class member. 3. new Constraint, used to restrict types that might be used as arguments for a type parameter in a generic declaration. Answer: All ( 3 new ) 58. We use try-catch block in C# for catching error of spelling syntax runtime logical Answer: runtime 59. According to the code, we define 2 methods with same name testParams: public void testParams(params int[] arr) { Console.Write("A"); } public void testParams(int x, int y) { Console.Write("B"); } And we use the following code to use them: MyClass x = new MyClass(); x.testParams(0); x.testParams(0,1); x.testParams(0,1,2);

What s the output result?

Answer: ABA 60. When we define a new class, we want a method of this class can be overridden in a derived class, which keyword should we use? sealed public virtual override Answer: virtual 61. We define 2 classes like this: class BaseClass { public int i; } class MyClass:BaseClass { public new int i; } What s the output of the follow code: MyClass y = new MyClass(); BaseClass x = y; x.i = 100; Console.WriteLine("{0}, {1}",x.i,y.i); 0, 0 100, 100 0, 100 100, 0 Answer: 100, 0 62. Considering the follow code, after create a new object named obj of class4 c lass, which statement is valid? public class class4 { private string _sData = ""; public string sData{set{_sData = value;}} } obj.sData = "It is funny!"; Console.WriteLine(obj.sData); obj._sData = "100"; obj.set(obj.sData);

Compiler Error ABA BAB AAA ABA

Answer: obj.sData = "It is funny!"; 63. Considering the follow codes: namespace ClassLibrary1 { class MyClass { class subClass { int i; } } } Please note that the MyClass class has no access modifier. If we need to add an access modifier to MyClass and keep the same accessibility, which modifier shoul d we use? private public (Your selection was wrong) internal protected Answer: internal 64. In C#, how to use a variable to save the string: Tom s Living Room

Answer: string str = "Tom s Living Room"; 65. If you want to declare a local temporary variable to store a money value in a fi nance application, which data type will you use? decimal theMoney; int theMoney; string theMoney; double theMoney; Answer: decimal theMoney; 66. How to declare a string variable in C#? CString str; string str; Dim str as string char* str Answer: string str; 67. How many Bytes are used to store an int data type variable?

string string string string

str = "Tom\ s Living Room"; str = "Tom s Living Room"; str("Tom s Living Room"); str("Tom"s Living Room");

1 2 4 8

Byte Bytes Bytes Bytes

Answer: 4 Bytes 68. Which is the tool window to display the contents of the current solution, includ ing the solution s projects and each project s items? Solution Explorer Project Designer Class View Object Browser Document Explorer Answer: Solution Explorer 69. Which is a CPU-independent set of instructions that can be efficiently conve rted to native code? CLR CLS MSIL XML Web Services Answer: MSIL 70. Which namespaces do the classes,allowing you to support COM Functionality , are located? System.InteropServices; System.ComponentModel; System.Collections.Generic; System.EnterpriseServices Answer: System.EnterpriseServices 71. You are writing a custom dictionary. The custom-dictionary class is named MyDictionary. You need to ensure that the dictionary is type safe. Which code segment should you use? Class Class Class Class MyDictionaryImplements Dictionary(Of String, String) MyDictionary Inherits HashTable MyDictionary Implements IDictionary MyDictionary

Answer: Class MyDictionaryImplements Dictionary(Of String, String) 72. Look at the code below, and mention which statements are true about the code ? intValue = myValue1 + myValue2 +

myValue3; No it is not valid, It will raise exception No it is not valid, it will raise warning only Yes it is valid Answer: Yes it is valid 73. Will the final block get executed if an exception has not occured? No Yes We cant say Answer: Yes 74. how to add a button control to form control from code file? this.controls.add(btn1) this.controls.add() this.controls.add(btn1); this.controls.add(); Answer: this.controls.add(btn1); 75. do events have return type? no yes maybe Answer: no 76. Does Main() always have to be public no yes Can t say Answer: no 77. What are valid signatures for Main function? public public public public static static static static void Main() (Your selection was wrong) int Main() void Main(String[] args) int main (String[] args)

Answer: public static void Main(String[] args) 78. Class String and the Char structure found in the: System.Strings namespace System.Chars namespace

System.Text namespace System. Data namespace Answer: System.Text namespace 79. What is the proper header for a class that intends to use an interface. class MyClass IFace class MyClass ; IFace class MyClass : IFace Answer: class MyClass : IFace 80. Is it possible to pass methods as arguments for other methods without modificati on. false true may be Answer: false 81. Defining two methods with the same name but with different parameters is called method Overloading Overloading parameter Overloading none of the above Answer: Overloading 82. Private Button print = new button(); creates a button control instantiates button control both 1 & 2 none of above Answer: both 1 & 2 83. Can Abstarct class have a constructor? A) Yes B)No C)Not a valid question Answer: Yes 84. lambda operator(=>) is a C# 2008 feature. Where is lambda operator mainly used ? Select Answer:

Database Operations Delegate Operations File Handling Operations Memory Stream Operations Answer: Delegate Operations 85. Given that you have a file containing XML orders.xml that contains both schema i nformation and data, which one of the following statements loads this into a Dat aSet ds correctly? ds.LoadXml("orders.xml", XmlReadMode.ReadSchema); ds.ReadXml("orders.xml", XmlReadMode.ReadSchema); ds.ReadXmlSchema("orders.xml"); ds.LoadXml("orders.xml"); None Answer: ds.ReadXml("orders.xml", XmlReadMode.ReadSchema); 86. Give Some Examples of Generic Classes? List<T>,HashSet<T> Queue<T> Stack<T> LinkedList<T> all the above Answer: all the above 87. Which one of the following column types provides selection or editing buttons in GridView control? ButtonField BoundField TemplateField CommandField HyperlinkField Answer: CommandField 88. Which two DataAdapter events fire for each row updated against a datasource RowUpdating, AfterUpdate BeforeUpdate, RowUpdating RowUpdating, RowUpdated BeforeUpdate, AfterUpdate BeforeUpdate, RowUpdated Answer: RowUpdating, RowUpdated 89. What is the size for double datatype in c#? 1 Byte

2 Bytes 4 Bytes 8 Bytes 16 Bytes Answer: 8 Bytes 90. What is the size for Signed integer and Unsigned integer in c#? 1 Byte 2 Bytes 4 Bytes 8 Bytes 16 Bytes Answer: 4 Bytes 91. What is the size for Signed short integer and Unsigned short in C#? 1 Byte 2 Bytes 4 Bytes 8 Bytes 16 Bytes Answer: 2 Bytes 92. What is the size for Signed byte and Unsigned byte in C#? 1 Byte 2 Bytes 4 Bytes 8 Bytes 16 Bytes Answer: 1 Byte 93. What is the range for Signed byte in c#? 0 to 255 -32768 to 32767 -128 to 127 0 to 65535 Answer: -128 to 127 94. What is the range for Unsigned short in c#? 0 to 65535 -2147483648 to 2147483647 32768 to 32767 0 to 4294967295 Answer: 0 to 65535

95. What is the range of Signed integer datatype in c#? -32768 to 32767 -128 to 127 0 to 255 -2147483648 to 2147483647 Answer: -2147483648 to 2147483647 96. What is the size of decimal datatype in c#? 1 Bytes 2 Bytes 4 Bytes 8 Bytes 16 Bytes Answer: 16 Bytes 97. UDDI Stands for? Universal discovery description integration Universal data discovery Integration (Your selection was wrong) Universal description discovery integration none of above Answer: Universal description discovery integration 98. What is the size of Unsigned long int in c#? 2 4 8 1 bytes bytes bytes bytes

Answer: 8 bytes 99. What is the range of Unsigned byte in c#? -128 to 127 -32768 to 32767 0 to 255 0 to 128 Answer: 0 to 255 100. Can we change the value while debugging a c# application? Select Answer: yes no -

Answer: yes

================================================================================ ======= 1. Under which of the following environments does your programs execution code run? A. MSIL B. CLS C. CLR D. VB .NET Answer: CLR 2. What is the compiler called that converts IL code into platform-specific code ? A. MSIL-converter B. JIT C. JTI D. Metadata Answer: JIT 3. What is the output format of the file the C# compiler produces? A. Byte code B. IL C. Hex dump D. Intel Assembler Answer: IL 4. Given the following program, what is the outcome when you try to compile and run it? using System; class Test { public static int Main() { Console.WriteLine("Hello World!"); } } A. It will compile and print Hello World! when run. B. It will compile and result in a runtime error indicating that the Console is an unknown object. C. It will fail to compile with an error CS0161: Test.Main( ) : not all code paths return a value. D. It will fail to compile with an "error CS0161: Test.Main( ): method cannot return an int".

Answer: not all code 5. Hiding the implementation and exposing the interface is a concept of OOP called: A. Polymorphism B. Encapsulation C. Overloading D. Static Answer: Encapsulation 6. Which of the following statements is true? A. A class is the implementation of an object. B. An object is the implementation of a class. C. A class is the instantiation of an object. D. An object is the instantiation of a class. Answer: object is instantiation 7. Which of the following is the correct way to declare the method GetPayCheck()? A. public int GetPayCheck() B. private int GetPayCheck() C. private void GetPayCheck(int a) D. public void GetPayCheck(int a) Answer: public int GetPayCheck() 8. Which is a definition of a static method? A. public static MethodA() B. public void MethodA() C. private static MethodA() D. public static void MethodA() Answer: public static void MethodA() 9. Which of the following languages is not part of the current .NET languages? A. Visual Basic B. C# C. C++ D. FoxPro Answer: FoxPro 10. In order to compile a C# program from the command line, what command would you use? A. cmd B. comp C. csc D. daml Answer: csc 1. Given the following code segment, what will the value returned from the method be? public int ViktorMove() { int x = 42; int y = 12; int w; object o; o = x; w = y * (int)o; return w; } A. 504 B. 491 C. 42 D. Runtime error, Null Pointer exception! Answer: 504

2. When will the garbage collector run? A. Every 15 minutes. B. Once every day at 13:00. C. When the application is low on memory. D. Randomly based on the resource load on the system. Answer: When the application is low on memory. 3. The statement that is used to replace multiple if statements is called: A. The case statement. B. The switch statement. C. The nestedif statement. D. The #endif statement. Answer: The case statement. 4. Which of the following is not a C# keyword? A. if B. delegate C. private D. implements Answer: implements 5. Choose the correct method for declaring a namespace: A. namespace Osborne.Chapter5 B. namespace Osborne.Chapter5; C. namespace Osborne.Chapter5.MyClass D. namespace Osborne.Chapter5.MyClass; Answer: namespace Osborne.Chapter5; 6. Determine the output of the following code segment: int x = 42; x++; x += --x; System.Console.WriteLine ("The value of x is : {0}", x); A. 84 B. 83 C. 86 D. 85 Answer: 85 1. Given the following code, what will the compiler do? class Test1 { sealed abstract void MyMethod1A() { System.Console.WriteLine ("This is MyMethod1"); } } A. The code will compile properly. B. The class visibility is incorrect. C. System.Console.WriteLine is specified incorrectly. D. MyMethod1() is not properly declared. Answer: MyMethod1() is not properly declared. 2. Which line causes a compile error in the following code? 1. interface Test2 2. { 3. int Int2; 4. void Method2A(int); 5. string Method2B (); 6. int Method2C(int, int); 7. int Method2A(char); 8. } A. Line 3 B. Line 4 C. Line 5

D. Line 7 Answer: Line 3 3. What is the outcome of compiling this program? 1 public class Test3 2 { 3 void Method3A () 4 { 5 System.Console.WriteLine ("In Method3A"); 6 } 7 } 8 class Test3a: Test3 9 { 10 void Method3B () 11 { 12 Method3A(); 13 } 14 } 15 class Test3b 16 { 17 public static void Main() 18 { 19 Test3a a = new Test3a(); 20 a.Method3B(); 21 } 22 } A. It compiles successfully. B. Lines 12 and 20 are in error. C. Line 12 is an error. D. Line 20 is the error. Answer: 12 and 20 are in error. 4. What will happen on line 24? 1 class Test4 2 { 3 int test4a; 4 string test4b; 5 float test4c; 6 virtual public void Test4D () 7 { 8 System.Console.WriteLine("Hello") 9 } 10 } 11 class Test4a: Test4 12 { 13 override public void Test4D () 14 { 15 System.Console.WriteLine ("Goodbye"); 16 } 17 } 18 class Test4b 19 { 20 public static void Main() 21 { 22 Test4a t = new Test4a(); 23 Test4 t1 = t; 24 t.Test4D(); 25 } 26 } A. The compiler finds an error. B. A runtime error occurs. C. It prints Goodbye.

D. It prints Hello. Answer: Goodbye. 5. What is the result of the following code? class Test5 { public Test5 ( ) { System.Console.WriteLine ("Test5 1"); } public Test5 (int num) { System.Console.WriteLine ("Test5 2"); } } class Test5a { public Test5a (): base(5) { } public Test5a(int numb): base() { } } class Test5b { public static void Main() { Test5a t = new Test5a(12); } } A. It prints Test5 1. B. It prints Test5 2. C. It does not compile. D. It does not run. Answer: Test5 1. 1. Given the following code segment, what is the content of the string s in line 4? 1 string s = "Hello"; 2 string r; 3 r = s; 4 r += " World!"; A. Hello World! B. Hello C. Nothing, it is garbage collected D. The code will not compile Answer: Hello 2. Which of the following array declarations will produce a compiler error? A. int[] Integers = new int[] (1,2,3,4,5,6,7,8,9,0}; B. int[] Integers = new int[42]; C. int[] Integers = {1,2,3,4,5,6,7,8,9,0}; D. int I = 4; int[] Integers = new int[I] {1,2,3,4}; Answer: new int[I] 3. In the following code, what will be printed by the Console.WriteLine() method? string[] str = {"Hello", "!", "World"}; Array.Reverse(str); Console.WriteLine(str[0]); A. !

B. Hello C. olleH D. World Answer: World 4. In the following code, what will be printed by the Console.WriteLine() method? string[] str = {"Hello", "!", "World"}; Array.Sort(str); Console.WriteLine(str[0]); A. ! B. Hello C. olleH D. Hello World ! Answer: "!" 5. What is the outcome of the following code? 01 public void MethodB () 02 { 03 int [] MyInts = new int [2]; 04 try 05 { 06 for ( int i = 0; i < 3; i++) 07 { 08 MyInts[i] = i; 09 } 10 } catch (System.Exception e) 11 { 12 System.Console.WriteLine ("Some error occurred"); 13 } 14 } A. The code will not compile because there is an incorrect catch block. B. The code will not compile because of an error on line 6. C. The code will compile and displays Some error occurred. D. The code will compile and will abort upon execution. Answer: Some error occurred 6. What is the outcome of the following code? 01 public void MethodB () 02 { 03 int [] MyInts = new int [2]; 04 try 05 { 06 for ( int i = 0; i < 3; i++) 07 { 08 MyInts[i] = i; 09 } 10 } finally 11 { 12 System.Console.WriteLine ("This is executed"); 13 } 14 } A. The code will not compile because there is a missing catch block. B. The code will compile and abort upon execution. C. The code will compile and displays This is executed. D. The code will compile and will abort upon execution and then display This is executed. Answer: This is executed 7. You need to define a delegate for the following method: public class Class1 { public static int Method42(int i) {

return i*42; } } How is the delegate for Method42() declared? A. delegate Class1.Method42; B. delegate int Met42(int i); C. delegate void Method42(string s); D. delegate int Class1.Method42(int i); Answer: delegate int Met42(int i); 8. What kind of delegate will be created for the following method? public void Method12(object sender, System.EventArgs e) { } A. Single delegate B. Event delegate C. Multicast delegate D. Proxy delegate Answer: Multicast delegate 9. The following code segment creates an event handler. What text must be inserted in place of <<replace text here>> for the event to work? // declare the delegate for the event public delegate void SendFaxEventHandler(); public class Fax { // declare the SendFax event public <<replace text here>> event SendFaxHandler SendFax; // } A. void B. delegate C. Combine D. static Answer: static 10. You are building an event handler for the SendFax event from the sFax component, and you have written the following code. When you test the event handler, you find that it never runs. What code must you add to your application to make the event execute in response to the SendFax event? private void Send_Fax() { Console.WriteLine("Fax is sent!"); } A. public delegate SendFax(Send_Fax); B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); C. public event SendFax(Send_Fax); D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax); Answer: SendFax += new SendF 1. You want to see all the methods of a particular class that you are using in y our application. Which tool would you use? A. Class Viewer B. Object Browser C. Class Explorer D. Object Explorer Answer: Object Browser 2. You want to change the color of the text in the code window. Which menu item would you select? A. View | Options B. Tools | Customize

C. View | Customize D. Tools | Options Answer: Tools | Options 3. Which key combination will allow you to compile your console application and leave the console window open? A. CTRL-F5 B. ALT-F5 C. F5 D. SHIFT-F5 Answer: CTRL-F5 4. To create a class file that can be added to a library, you would select which project type? A. ASP.NET Web Application B. Class Library C. Console Application D. Web Control Library Answer: Class Library 1. What is the name given to the type of assembly that contains localized resources? A. Spoke B. Hub C. Sputnik D. Satellite Answer: Satellite 2. What is the correct name for a resource file with images for the English cult ure, in the United States subculture? A. images.US-en.resources B. images.en-US.resources C. resources.images.en-US D. images.en-US.dll Answer: es.en-US.resources 3. What is the minimum number of assemblies a .NET application can have? A. 0 B. 1 C. 2 D. 3 Answer: 1 4. How is the metadata for an assembly stored? A. In the Registry. B. In .ini files. C. As XML in the manifest. D. As a Type Library (.tlb) file. Answer: As XML in the manifest. 5. What tool is used to manage the assemblies in the Global Assembly Cache? A. gacmgr.exe B. gacutil.exe C. gassy.exe D. al.exe Answer: gacutil.exe 1. What is the code for the German language? A. ge B. gb C. de D. dk Answer: de 2. What namespace contains the ResourceManager class? A. System.Localization

B. System.Resources C. System.Globalization D. System.Threading Answer: Resources 3. What is the process called that converts a primitive to a class? A. Primary B. Boxing C. Conversion D. Encoding Answer: Boxing 4. Which of the following code segments will correctly display the string resour ce txtHello? (All objects are correctly created.) A. Console.Write(rm.ToString("txtHello"); B. Console.WriteLine(rm.Strings("txtHello"); C. Console.Write(txtHello.ToString("s")); D. Console.Write(rm.GetString("txtHello")); Answer: rm.GetString("txtHello") 5. What does the following command do? csc /res:strings.resources HelloGlobalWorld.cs A. Builds only the HelloGlobalWorld program. B. Builds the HelloGlobalWorld and links the fallback resource. C. Creates an assembly for the HelloGlobalWorld program. D. Creates a name resolution report for the HelloGlobalWorld program. Answer: Builds the HelloGlobalWorld and links the fallback resource. 6. When localizing a web application, you find that you need to encode Unicode characters that are sent to the client. What attribute would you set? A. ResponseEncoding="UTF-8" B. Encoding="UTF-8" C. ResponseCode="UTF-8" D. EncodedResponse="UTF-8" Answer: ResponseEncoding="UTF-8" 7. What happens when the Resource Manager fails to find the localized resource for a locale? A. It uses the closest locale. B. It throws an exception. C. Nothing, the resource will be blank. D. It uses the fallback resource. Answer: the fallback resource 8. What namespace contains the CultureInfo class? A. System.Localization B. System.Resources C. System.Globalization D. System.Threading Answer: Globalization 9. Do you have to produce all the locale-specific assemblies before deploying th e application? A. Yes, the assemblies must be present for the final compile of the application. B. Yes, the fallback manifest must be built from all the satellite assemblies. C. Yes, the .NET Framework must update the registry with all the information at deployment. D. No, the satellite assemblies can be deployed at will after initial deployment . Answer: No, the satellite assemblies can be deployed at will after initial depl oyment. 10. In the following code segment, what is the significance of the "Strings" lit eral? static ResourceManager rm = new ResourceManager("Strings", Assembly.GetExecutingAssembly());

A. Arbitrary name for the assembly. B. The base name of the resource to be loaded. C. The base name of the assembly to be loaded. D. Alias for the Resource Manager. Answer: the resource to be loaded 11. Where in the object model is the information relating to the date format sto red for a specific locale? A. ResourceManager B. CultureInfo C. LocalFormat D. Reflection Answer: CultureInfo 12. Your application is called AccountingOne.exe. What must the name of the French string resource be? A. AccountingOne.resources.dll B. strings.resources C. strings.fr.resources.dll D. strings.fr.resources Answer: strings.fr.resources 13. What does the attribute dir="rtf" stand for? A. The direction of RTF files. B. The encoding of RTF files. C. The direction for the display of characters. D. A directory listing of all RTF files. Answer: for the display of characters. 14. Your application is called AccountingOne.exe. What must the name of the satellite assemblies be? A. Accountingone.resources.dll B. accounting.Resources.dll C. AccountingOne.resources.dll D. Accounting.resources.dll Answer: untingOne 1. Which command will cause an XML file to be generated from documentation comments? A. csc MyClass.cs /doc:MyClass.cs B. cscd MyClass.cs /doc:MyClass.xml C. cscd MyClass.cs /doc:MyClass.cs D. csc MyClass.cs /doc:MyClass.xml Answer: csc .xml 2. Which line causes the following XML to be not well-formed? <VideoList> <tape> <name>XML is cool!</name> </VideoList> </tape> A. <tape> B. </VideoList> C. </tape> D. <name>XML is cool!</name> Answer: </VideoList> 3. Which XML rule does the following break? <employees> <Employee> <name>Kenneth S. Lind</name> </Employee> <employee> <name>Marj Rempel </employee>

</employees> A. There must be a single root element. B. There must be matching opening and closing tags. C. XML is case-sensitive. D. All attributes must be in quotes. Answer: be matching opening and closing tags. 4. Which XML rule does the following break? <employees> <employee> <name id=123>Kenneth S. Lind</name> </employee> <employee> <name id=456>Marj Rempel</name> </employee> </employees> A. There must be a single root element. B. There must be matching opening and closing tags. C. XML is case-sensitive. D. All attributes must be in quotes. Answer: All attributes must be in quotes. 5. Visual Studio .NET provides a tool to generate HTML from the XML documentation file. It is found where? A. Tools | Generate XML B. Tools | Generate HTML C. Tools | Build Comment Pages D. Tools | Build Comment Web Pages Answer: Web Pages 6. Which XML line(s) generates an employee attribute? A. <employee name="Ken"> B. <employee attribute name="Ken"> C. <employee Name= Ken > D. <employee attribute Name= Ken > Answer: ee name=/ee Name= Ken 7. Which of the following lines is an XML declaration? A. <xml version="1.0"> B. ?xml version="1.0"? C. <?xml version=1.0?> D. <?xml version="1.0"?> Answer: <?xml version="1.0"?> 8. Why will the following XML code not be rendered by a browser? <name> <lastname>Dowdy</lastname> <firstname>Howdy</firstname> </lastname> A. The browser is not specified. B. The root element is missing. C. The root element is not closed properly. D. The firstname element is incorrect. Answer: not closed properly. 9. Assess the following XML. Which answer correctly describes the code? <addresses> <listing> <name> <lastname>Dowdy</lastname> <firstname>Howdy</firstname> </name> <address> <street>123 Anywhere St</street> <city>MyCity</city> </address>

</listing> </addresses> A. The name element is described incorrectly. B. The address element is described incorrectly. C. The addresses root element is described incorrectly. D. Nothingthis is well-formed XML. Answer: Nothingthis is well-formed XML. 10. Which of the following documentation comments is correct? A. /// summary This is a summary comment summary B. /// <summary> This is a summary comment </summary> C. /// <summary> This is a summary comment D. /// summary This is a summary comment Answer: <summary></summary> 1. You have been asked to debug a Web-based ASP.NET application. For some reason, the debugging information is not presented. What could be missing? A. <%@ Page Debug="true" %> B. <%@ Application Debug="true" %> C. <%@ Page Trace="true" %> D. <%@ Application Trace="true" %> Answer: Page Debug="true" %> 2. You want to examine and change the value of a variable in your C# application . You are developing using Visual Studio .NET. What window will allow you to change the value during execution? A. Locals window B. Call Stack window C. Immediate window D. Watch window Answer: Immediate window 3. You want to compile a console-based program at the command line. What is the correct syntax of the command-line compiler that will allow you to see debugging information? A. csc /b:debug MyApp.cs B. csc /d:debug MyApp.cs C. csc MyApp.cs /b:debug D. csc MyApp.cs /d:debug Answer: MyApp.cs /b:debug 4. Trace switches can be set using which class? A. System.Diagnostics.Trace B. System.Diagnostics.DefaultTraceListener C. System.Diagnostics.TraceSwitches D. System.Diagnostics.TraceSwitch Answer: TraceSwitches 5. The correct syntax for adding a trace listener to the Listeners collection is : A. TraceListeners.Add (new TextWriterTraceListener("myfile.txt"); B. Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); C. Trace.Add (new TraceListener ("myfile.txt"); D. TraceListener.Add (new TraceListener("myfile.txt"); Answer: Trace.Listeners.Add (new TextWriterTraceListener("myfile.txt"); 6. To debug an ASP.NET application, you need to attach to which process? A. aspnet.exe B. asp.net.exe C. aspnet_debug.exe D. aspnet_wp.exe Answer: aspnet_wp.exe 7. How would you create a breakpoint in your code within Visual Studio .NET?

A. Press F9. B. Right-click in the margin and select Insert Breakpoint. C. Choose Debug | New Breakpoint from the menu system. D. All of the above. E. None of the above. Answer: All of the above. 1. What does the following SQL statement return, assuming that all tables and column names are correct? SELECT FirstName, StreetAddress FROM Employees JOIN AddressBook ON Employees.EmpID = AddressBook.EmpID A. Nothing, the JOIN syntax is wrong. B. All the records from the Employees table, and only the matching ones from the StreetAddress table. C. All the records from the StreetAddress table, and only the matching records from the Employees table. D. Only the matching records from the two tables. Answer: Only the matching records from the two tables. 2. What is a transaction? A. A banking term. B. A concept used to describe a step in the business process. C. A combination of DML steps that must succeed or the data is returned to its initial state. D. A combination of DDL steps that must succeed or the data is returned to its initial state. Answer: of DML steps that must succeed or the data is returned to its initial s tate. 3. What object is used to encapsulate a data source? A. XxxConnection B. XxxCommand C. XxxDataAdapter D. DataSet Answer: XxxConnection 4. What object is used to encapsulate a rowset? A. DataSet B. DataAdapter C. DataRowSet D. DataTable Answer: DataTable 5. What property is used on the DataTable to indicate a conflict after an update ? A. HasConflict B. HasError C. HasCollision D. HasDataError Answer: HasError 6. What is a DiffGram? A. An XML file containing both the original and current values for the data. B. An XML file containing the difference between original and current data. C. A DataSet loaded with two XML files, resulting in the difference being current. D. A DataSet loaded with an XML file and the original values from the data source. Answer: both the original and current values for the data. 7. How is the data represented in an XmlDataDocument? A. Relational B. Flat C. Hierarchical

D. Tabular Answer: Hierarchical 8. When would you not use the OleDbConnection object? A. To connect to an SQL 7.0 database. B. To connect to a DB/2 database. C. To connect to an Access database. D. To connect to an SQL 6.5 database. Answer: an SQL 7.0 database. 9. What connection is used in ADO.NET to connect to an SQL Server 6.0? A. Use the OleDbConnection class. B. Upgrade the server to SQL 7.0 and use the OleDbConnection class. C. Upgrade the server to SQL 2000 and use the OdbcConnection class. D. Upgrade the server to SQL 6.5 and use the SqlConnection class. Answer: Use the OleDbConnection class. 10. On what object is the transaction in ADO.NET focused on? A. The command object B. The DataSet object C. The connection object D. The DataAdapter object Answer: The connection object 11. What is the SQL argument that sorts the data returned by an SQL SELECT statement? A. GROUP BY B. SORT BY C. SORTED D. ORDER BY Answer: ORDER BY 12. What combination of methods are used to improve the speed of the Fill() method of the DataAdapter? A. BeginFillData() and EndFillData() B. StartFillData() and EndFillData() C. BeginLoadData() and EndLoadData() D. StartLoadData() and EndLoadData() Answer: BeginLoadData() and EndLoadData() 13. The following SQL INSERT statement fails. What is the most probable reason for the failure? INSERT INTO Employees VALUES (42, Bob , Carol , 12) A. Syntax error in the INSERT statement. B. The columns in the Employees table are not in the indicated order (int, char, char, int). C. The Employees database does not have a default table defined. D. The SELECT INTO permission is not set. Answer: (int, char, char, int). 14. In the following code, what is the result of compilation? using System; using System.Data; using System.Xml; class question14 { public static void Main() { DataSet dsNw = new DataSet(); string strCn = "data source=(local);user id=sa;" + "initial catalog=northwind;"; SqlConnection cnNw = new SqlConnection(strCn); string strSQL = "SELECT * FROM Employees"; SqlDataAdapter daNw = new SqlDataAdapter(strSQL, cnNw); daNw.Fill(dsNw, "Employees"); XmlDataDocument doc = new XmlDataDocument(dsNw); doc.Save(Console.Out);

} } A. No errors B. One error C. Two errors. D. Three errors. Answer: Three errors. 15. What is the result of the following SQL statement? USE Northwind DELETE Employees A. The Employees table is emptied. B. The current record is deleted. C. Syntax error, the USE command is wrong. D. The Employee database in the Northwind server is deleted. Answer: table is emptied. 1. What definition correctly defines a label server control with the name set to lblHoop? A. <asp:Label name="lblHoop" runat="server" /> B. <Label id="lblHoop" runat="server" /> C. <asp:label id="lblHoop" runat="server" /> D. <server label name="lblHoop" runat="asp" /> Answer: <asp:label id="lblHoop" runat="server" /> 2. What ASP.NET object encapsulates the users data as it is sent from a form in a page? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: The Request object. 3. What important standard is used to connect client browsers with web servers? A. HTTP B. TCP/IP C. ASP.NET D. HTML Answer: TCP/IP 4. What ASP.NET object is used to get information about the web servers hostname? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Server object. 5. When writing server-side code, what marks are used to indicate the code block ? A. <% %> B. <!-- --> C. <@ language="c#" @> D. <asp:script runat="server" /> Answer: <% %> 6. What computer language is installed with the .NET Framework, by default? A. JavaScript B. Quick Basic C. C D. LiveScript Answer: JavaScript 7. What is the name of the process the browser uses to find the address of a web server?

A. DMZ B. DNS C. Active Directory D. Database lookup Answer: DNS 8. How many rules are there regarding a well formed XML document? A. Nine B. Three C. Six D. Two Answer: Six 9. What line in the following XML document will generate an error? 1 <?xml version="1.0"> 2 <employees> 3 <employee> 4 <name>Bob Andcarrol</Name> 5 </employee> 6 <employee> 7 <Name>Robert Burns</Name> 8 </employee> 9 </employees> A. 6 B. 4 C. 1 D. There is no error. Answer: 4 10. What language is the standard web script language ECMAScript based on? A. JavaScript B. Java C. Perl D. Jscript Answer: JavaScript 11. What is the behavior of a web browser when it receives an invalid element? A. The web browser will display the element in raw form. B. The web browser will send a report to the webmaster detailing the error by using the Request object. C. The web browser will report the error, letting you debug the page. D. The browser will ignore the invalid section. Answer: ignore the invalid section. 12. What ASP.NET object encapsulates the state of the client and the browser? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Session object. 13. What object would you use if you need to support Netscape Navigator and Microsoft Internet Explorer? A. ActiveX control B. Intrinsic controls C. XML D. Java applet Answer: Java applet 14. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time? A. Synchronize() B. Lock() and UnLock() C. Lock() and Unlock() D. SingleUse() Answer: UnLock()

15. What ASP.NET object encapsulates the web site? A. The Session object. B. The Application object. C. The Response object. D. The Request object. E. The Server object. Answer: Application object. 1. When working with ASP.NET server controls, it is important to use the right event handlers to capture the event for the application to function properly. What event would you use to capture the selection of a new item in a DropDownList control? A. The Click event. B. The SelectionChanged event. C. The SelectedIndexChanged event. D. The ChangedSelection event. Answer: SelectedIndexChanged event. 2. What code segment represents the event handler registration for the click eve nt of the btnA Button control? A. this.btnA.Click.Register(new System.EventHandler (this.setList)); B. this.btnA.Click.Add(new System.EventHandler (this.setList)); C. this.btnA.ClickEvent += new System.EventHandler (this.setList); D. this.btnA.Click += new System.EventHandler(this.setList); Answer: btnA.Click += 3. When an ASP.NET server control is added to a Web Form, Visual Studio .NET adds one item to the class for the form. What item is added? A. The event registration. B. A protected class member for the control. C. A default event handler for the click event. D. A default class that inherits from the controls base class. Answer: protected class member for the control. 4. When a browser requests an .aspx file and the file is displayed, what is actually returned to the browser from the server? A. HTML B. XML C. ASPX D. ASP Answer: HTML 5. What is the function of the CustomValidator? A. It allows for custom C# client-side code to validate entries in a control. B. It allows for a custom mixture of validator controls to use one central control for the display of messages. C. It uses scripted client-side code to validate the entry in a control. D. It uses server-side code to validate the entry in a control. Answer: It uses scripted client-side code to validate the entry in a control. 6. What attribute must be set on a validator control for the validation to work? A. Validate B. ValidateControl C. ControlToBind D. ControlToValidate Answer: ControlToValidate 7. The Items property of a ListBox is a reference to what kind of object? A. Item B. ListItem C. String D. Index value

Answer: ListItem 8. What is the use of the WebForm.aspx.cs file? A. Holds the HTML code for the form. B. Holds the control configuration for the form. C. Holds the C# code for the codebehind module. D. Holds the C# code that will be translated into HTML on the client. Answer: for the codebehind module. 9. Given an ASP.NET Web Form called WebForm1, what class does the WebForm1 class inherit from by default? A. System.Web.Form B. System.Web.GUI.Page C. System.Web.UI.Page D. System.Web.UI.Form Answer: UI.Page 10. What layout mode is the default when a new Web Form is created? A. GridBagLayout B. GridLayout C. FlowLayout D. FormLayout Answer: GridLayout 11. When does the DropDownListBox control reload its list? A. Every time the server-side codebehind module is called. B. Every 2 minutes by default. C. When the user clicks on an entry in the control. D. Never. Answer: Every time the server-side codebehind module is called. 12. What is the Web.config file used for? A. To store the global information and variable definitions for the application. B. Configures the time that the server-side codebehind module is called. C. To configure the web server. D. To configure the web browser. Answer: To store the global information and variable definitions for the applic ation. 13. What happens if an ASP.NET server control with event-handling routines is missing the runat="server" attribute from its definition? A. The control will operate as usual; the default is runat="server". B. The control will revert to being a client-side control and function as such. C. The control will not function; the default is runat="client". D. The compilation of the application will fail. Answer: The compilation of the application will fail. 14. What happens if an ASP.NET server control with no event-handling routines is missing the runat="server" attribute from its definition? A. The control will operate as usual; the default is runat="server". B. The control will revert to being a client-side control and function as such. C. The control will not function; the default is runat="client". D. The compilation of the application will fail. Answer: not function; the default is runat="client". 15. After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesnt execute. What could the problem be? A. The AutoEventWireup attribute is set to False. B. The AutomaticPostBack attribute is set to False. C. The codebehind module is not properly compiled. D. The ListBox must be defined WithEvents. Answer: AutomaticPostBack attribute is set to False. 1. A. B. C. D. What must be done before Build a proxy library by Build a proxy library by Build a proxy library by Build a proxy library by you can consume a web service? using the TblImp.exe utility. using the Disc.exe utility. using the csc.exe utility. using the wsdl.exe utility.

Answer: wsdl.exe utility. 2. You need to use the web service TempConvService. Where should you place the proxy file? A. In the lib directory off the root directory of the application. B. In the root directory of the application. C. In the bin directory off the root directory of the application. D. In the bin directory of .NET Framework. Answer: bin off the root directory of the application. 3. You need to use the web service TempConvService. What page directives correctly expose the web service? A. <%@ Page Language="c#" Debug="true" %> <%@ Import = "TempConvService" %> B. <%@ Page Language="c#" Debug="true" %> <%@ Import namespace="TempConvService" %> C. <%@ Page Language="c#" Debug="true" %> <%@ Import ProxyNameSpace="TempConvService" %> D. <%@ Page Language="c#" Debug="true" %> <%@ Import namespace="bin/TempConvService" %> Answer: <%@ Page Language="c#" Debug="true" %><%@ Import namespace="TempConvSer vice" %> 4. You need to call a function that is located in a library named MyLibrary.dll, and this is the function signature: int MyFunc(int intAction, int intOption, uint uValue) You also need to rename the function to Func42 to avoid name conflicts in the application. Which code segment will correctly make the function available to your application? A. [DllImport("MyLibrary.dll")] public static extern int Func42 (int intAction, int intOption, int uValue); B. [DllImport("MyLibrary.dll", EntryPoint = "Func42")] public static extern int Func42 (int intAction, int intOption, uint uValue); C. [DllImport("MyLibrary.dll")] D. [DllImport("MyLibrary.dll", EntryPoint = "MyFunc")] public static extern int Func42 (int intAction, int intOption, uint uValue); Answer: "MyFunc" 6. You have been given the task of designing a web service to expose the data that is stored in a database on the server. In order to successfully build the web services, you need to import some namespaces. What is the minimum namespace you need to import? A. System.Web B. System.WebServices C. System.Web.Services D. System.Web.ServiceModel Answer: Web.Services 7. You have designed an event for the class you are working on, and the event is declared as follows: // declare the delegate for the event public delegate int MugEmptyHandler(int RefillVolume); // declare the event public static event MugEmptyHandler OnMugEmpty; When you try to register the event in the client code by using the following line, you receive a syntax error: this.OnMugEmpty += new MugEmptyHandler(this.Mug_Empty); You need to make the OnMugEmpty event functional. What will you do? A. Change the declaration of the event to indicate the parameter. B. Change the declaration of the event to indicate the return type. C. Change the declaration of the delegate to have no parameters. D. Change the declaration of the delegate to have a void return type.

Answer: a void return type. 8. You are building an event handler for the SendFax event from the sFax component, and you have written the following code: private void Send_Fax() { Console.WriteLine("Fax is sent"); } When you test the event handler, you find that it never runs. What code must be added to your application to make the event execute in response to the SendFax event? A. public delegate SendFax(Send_Fax); B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); C. public event SendFax(Send_Fax); D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax); Answer: Fax += new SendFaxHandler(this.Send_Fax); 9. Your manager has asked you to describe what you would use application variables for. What statement best describes the use of application variables? A. Application variables are used to keep state for each connected user. B. Application variables are used to keep state for the web site. C. Application variables are used to keep state for all the applications on the server. D. Application variables are used to keep state for all application objects in the web site. Answer: the web site. 10. You are using Visual Studio .NET to set up a reference to a COM component, but the reference operation fails. What is one possible solution? A. Register the COM component with .NET using TlbImp.exe. B. Register the COM component using wsdl.exe. C. Move the COM component to the bin directory of the application. D. Register the COM component in the Registry using Regsvr32.exe. Answer: Regsvr32.exe. 11. What information do you need to have in order to successfully reference a we b service using the Add Reference dialog box? A. The URI for the web services .asmx file. B. The URL for the web services .asmx file. C. The URL for the web services disco file. D. The URI for the web services disco file. Answer: URL .asmx file. 12. You have defined some web service methods, but when you test the web service, you do not have the methods available. The web service is defined as follows: [WebMethod] private void email(string to, string[] message, int option) { } What will you do to solve the problem? A. Replace the attribute with [WebServiceMethod]. B. Make the method public. C. Change the string[] to an object array. D. Change the return type to int. Answer: Make the method public. 13. You find that after running the following command line commands from the root directory of your web site that the web service is not available: >wsdl /l:cs /o:Address.cs http://localhost/Address/Address.asmx?WSDL /n:AddressService >csc /out:AddressProxy.dll /t:library /r:system.web.dll, system.dll, system.xml.dll, system.web.services.dll, system.data.dll Address.cs What will you do to make the web service available with the least amount of

code and work? A. Run the following command: regsvr32 /.NET AddressProxy.dll B. Rerun the csc command specifying /o:bin/AddressProxy.dll. C. Rebuild the AddressProxy.dll file using the /AutoPost option. D. Rebuild your application after adding the reference to the web service. Answer: Rerun the csc command specifying /o:bin/AddressProxy.dll. 14. You have designed a web form that has one listbox control. You have implemented the SelectedIndexChanged event handler, and you have verified that all required declarations are in place and that the event handler is registered. During testing of the form, you find that the event does not execute . What is the most efficient way to make the event execute? A. Set the AutoPostBack attribute of the listbox control to False. B. Set the AutoPostBack attribute of the @ Page directive to True. C. Set the AutoPostBack attribute of the listbox control to True. D. Change from the listbox control to the DropDownList control. Answer: to True. 1. What HTML element is the asp:Label control rendered as when the target is Internet Explorer? A. <label> B. <span> C. <div> D. <table> Answer: <span> 2. What HTML element is the asp:Label control rendered as when the target is Netscape Communicator? A. <label> B. <span> C. <div> D. <table> Answer: <span> 3. What is the result when a Web Form containing the following line is compiled and executed? <asp:Button id="theButton" onClick="theEvent" /> A. The button control is created; theEvent is the Click event handler. B. Compiler error; the control must be set to runat="server". C. Compiler error; onClick is not a valid attribute. D. Runtime exception; the control must be set to runat="server". Answer: Runtime exception; the control must be set to runat="server". 4. What HTML element is the asp:panel control rendered as? A. <span> B. <table> C. <div> D. <p> Answer: <div> 5. How do you specify the parameters for the ads in the AdRotator control? A. By programmatically setting the properties. B. By using an initialization file in .xml format. C. By using an initialization file in .txt format. D. By using an initialization file in .ini format. Answer: .xml format. 6. What of the following best describes a user control? A. A collection of server controls gathered in a web file with the <%@ Control %> directive. B. A collection of controls that are compiled into an assembly. C. A control that is built from multiple user-defined COM-based controls. D. A simple lightweight control that can display text only.

Answer: <%@ Control %> 7. Which of the following is valid after adding the following directive to a Web Form? <%@ Register TagPrefix="WWW" TagName"WWWControl" Src="WWWControl1.ascx" %> A. <WWW:WWWControl1 id="theControl" runat="server" /> B. <asp:WWWControl id="theControl" runat="server" /> C. <WWW:WWWControl id="WWWContr" runat="server" /> D. <asp:WWWControl1 id="WWWContr" runat="server" /> Answer: WWW:WWWControl 8. You have correctly added the <%@ Register %> directive and the user-control definition in the <asp:Form> tag, but when you run the application it fails. What is the most likely cause of the failure? A. The protected class variable for the control is missing from the codebehind module. B. The event registration is not performed; you must manually add it to the InitializeComponent event handler. C. There must be a call to the controls constructor in the Page_load() method. D. The control must be added to the Web Forms Controls collection. Answer: The protected class variable for the control is missing from the codebe hind module. 9. After building a custom control, you test it by adding an ASP.NET web applica tion to the solution. You add a correct <%@ Register %> directive and a proper declaration of the control in the <asp:Form> tag to the Web Form, but when you execute the application you get an error. What is the most likely reason for the problem? A. The custom control must be compiled first. B. The web application must have a reference to the control. C. The custom control must be registered with Windows first. D. The assembly from the custom control is not in the applications bin directory. Answer: The assembly from the custom control is not in the applications bin dire ctory. 10. You have successfully created a custom control and a web application project to test the control. The application runs with no problems, but when you look at the Design view of the Web Form, the control is displayed using an error display . What is the most efficient way to resolve the error display? A. Move the control to the web applications bin directory, and recompile the application. B. Add a reference to the control to the web application. C. Change the Bindable attribute for the Default property in the control to have a value of True. D. Manually enter the 128-bit GUID for the control in the applications configuration file. Answer: Add a reference to the control to the web application. 11. What method must be overridden in a custom control? A. The Paint() method. B. The Control_Build() method. C. The Render() method. D. The default constructor. Answer: The Render() method. 12. Your manager has asked you if ASP.NET can be used with dynamic control creation, and if it requires any extra software to make dynamic controls possibl e. What would you answer your manager? A. Yes, dynamic controls are possible using the standard control containers from ASP.NET.

B. No, dynamic controls are not possible in ASP.NET. C. Yes, dynamic controls are possible in ASP.NET using a third-party assembly. D. Yes, dynamic controls are possible in ASP.NET by using the Web Services. Answer: using the standard control containers from ASP.NET. 1. What property is used to control how the user can press ALT-F to set the focu s to a control? A. AccessKey B. ControlOrder C. TabOrder D. TraceOrder Answer: AccessKey 2. You have created a localized web application that supports English, French, German, and Spanish. After building the resource files, you code all the strings to come through the ResourceManager.GetString() method. You test the application by using the browser on your development computer, and as you switch languages in the Regional Settings, everything functions as expected. After deploying the application, you receive a message from a client saying that the application does not change when the client accesses it with a computer configured to use the French locale. You need to fix the application. What will you do? A. Rebuild the resource assembly. B. Add code to change the current threads culture to the users culture. C. Add code to change the location of the resource assembly. D. Instruct the user to upgrade to a newer browser. Answer: current threads culture to the users culture. 3. What is used to validate complex string patterns like an e-mail address? A. Extended expressions. B. Regular expressions. C. Irregular expressions. D. Basic expressions. Answer: Regular expressions. 4. What is the default language for the fallback culture? A. English. B. Swedish. C. Users setting. D. Neutral. Answer: Neutral. 5. What namespace is needed for Event Log support? A. System.Event B. System.Diagnostics C. System.EventLog D. System.Diagnostics.Event Answer: Diagnostics 6. What property controls whether the text in a TextBox control is displayed in clear text or as a collection of * characters? A. PasswordCharacter B. Hide C. Encrypt D. TextMode Answer: TextMode 7. You need to customize the error messages from your web application. What file will you modify to customize the error messages? A. Web.config B. Error.config C. Application.config D. global.asax Answer: Web.config 8. What property is set in order to display the text in reverse flow order?

A. rtl B. ltr C. dir D. reverse Answer: dir 9. You have configured custom error pages for your application. When you test the pages from a co-workers computer, they display properly, but when displayed in your browser on the development computer, they display incorrectly. What will you do to correct the display of the error pages on your computer? A. Install Internet Explorer 6.0. B. Change the mode attribute to localhost in the Web.config file. C. Change the mode attribute to RemoteOnly in the Web.config file. D. Change the mode attribute to On in the Web.config file. Answer: On in the Web.config file. 10. After adding messages to the trace log, you need to locate the output. What section contains the messages a developer has added to the trace log? A. Trace Information. B. Control Tree. C. Cookies. D. Headers Collection. E. Server Variables. Answer: Trace Information. 11. What file would you modify to implement application-wide error processing for all unhandled errors? A. Web.config B. Error.config C. Application.config D. global.asax Answer: global.asax 12. What property is used to control the order in which the controls are accesse d? A. AccessKey B. ControlOrder C. TabIndex D. TraceOrder Answer: TabIndex 13. How do you enable tracing? A. Set the Trace property of the Web Form to True. B. Set the Trace property of the Server object to True. C. Set the Session variable Trace to True. D. Set the Applications variable Trace to True. Answer: Web Form to True. 14. What control is used to validate that two fields are equal? A. RequiredFieldValidator B. RegularExpressionValidator C. CompareValidator D. The equals() method of the field. Answer: CompareValidator 15. What method is used to insert a highlighted entry in the trace output? A. Trace.Write() B. Trace.HighLight() C. Trace.Error() D. Trace.Warn() Answer: Trace.Warn() 1. A. B. C. What is the SQL equivalent of the DataSet relation object? XOR JOIN CROSS JOIN OUTER JOIN

D. INNER JOIN Answer: INNER JOIN 2. Why should you close all database objects and set them to NULL before leaving the method where the objects were created? A. To ensure that the objects destructors are called. B. To ensure that the connection to the database is closed as soon as possible. C. To ensure that the objects can be reused. D. Good coding practice. Answer: connection to the database is closed as soon as possible. 3. What is the purpose of the following code segment? if ( !IsPostBack ) { sqlDataAdapter1.Fill(dsUsers1); DataGrid1.DataBind(); } A. To populate the DataAdapter the first time the web page is displayed. B. To populate the DataSet every time the web page is displayed. C. To populate the DataAdapter every time the web page is displayed. D. To populate the DataSet the first time the web page is displayed. Answer: DataSet the first time the web page is displayed. 4. Where are stored procedures saved? A. The GAC. B. The web server. C. The database server. D. The central store. Answer: The database server. 5. What is the root exception for the ADO.NET objects? A. DataException B. ADOException C. Exception D. DBException Answer: DataException 6. What best describes the xxxDataReader? A. A disconnected collection of tables. B. A manager that manages the connection to a data source, using four SQL statements. C. A connected, read-only, forward-only representation of the data source. D. The component that encapsulates the database driver. Answer: A connected, read-only, forward-only representation of the data source. 7. You are the developer of a Web Form, and you need to display data from a Microsoft SQL Server 6.5 in a DataGrid on your form. What DataAdapter is the most appropriate? A. sqlDataAdapter B. oleDbDataAdapter C. odbcDataAdapter D. adoDataAdapter Answer: oleDbDataAdapter 8. What is the purpose of the last string ("{0}") in the following code segment? DataBinder.Eval(dS1, "Tables[SP_SelUsers].DefaultView.[0].LastName", "{0}"); A. It is the formatting string for the bound data. B. It is the default value that will be used when the data is NULL. C. It is the parameter sent to the stored procedure SP_SelUsers. D. It is the placeholder for a DataBinding object. Answer: formatting string for the bound data. 9. What is the correct namespace for use with the SQL .NET Data Provider objects ? A. System.SQL B. System.Data.SqlConnections C. System.Data.SqlClient

D. System.SqlConections Answer: Data.SqlClient 10. What is the correct statement to use for declaring that an xxxCommand object is used with a table? A. aCmd.CommandType = CommandType.Table; B. aCmd.CommandType = Table; C. aCmd.CommandType = "Table"; D. aCmd.CommandType = "CommandType.Table"; Answer: CommandType.Table; 11. How many sqlDataReader objects can be open on one Connection at one time? A. 4 B. 3 C. 2 D. 1 Answer: 1 12. What is the SQL wildcard character? A. * B. % C. & D. @ Answer: % 13. You need to connect to a Microsoft SQL Server version 6.5. What Connection object is the best choice? A. sqlConnection B. oleDbConnection C. ODBCConnection D. You must upgrade; there is no connection object for this database. Answer: oleDbConnection 14. You are using the try... catch block seen in the following code segment, but no exceptions are ever caught by the catch block. What is the problem? sqlConnection cn =new sqlConnection(strSQL); sqlDataSet ds; try { cn.Open(); //perform the data processing steps ... }catch(OleDbException e){ ... } A. The exception class is wrong; it should be SqlErrors. B. The exception class is wrong; it should be SqlSyntaxExceptions. C. The exception class is wrong; it should be SqlExceptions. D. The exception class is wrong; it should be SQLExcptions. Answer: SqlExceptions. 15. You are designing a Web Form that needs to have data available for as long a s eight hours at a time. Your manager has raised some concern that the database server will be unable to provide services to a large number of connected users. What object in the ADO.NET architecture will you bring to your managers attention as a possible solution? A. SQL disconnected recordsets. B. oleDbDataReader C. ODBCRecordSet D. oleDbDataSet Answer: oleDbDataSet 1. You are the developer of a web application that is retrieving historical spor

ts information from a database server and displays it to the users of your applicat ion. What cache strategy will give you the best performance? A. Use the output cache. B. Use the cache object. C. Use the ASP.NET central cache. D. Use the client cache. Answer: output cache. 2. You are the developer of a web application and have decided to use the output cache in ASP.NET. Which of the following statements correctly defines the Web Form if you want to use the output cache, cache all items for 14 minutes, and store different versions of the cached objects for each customer ID? A. <%@ OutputCache Duration="840" VaryByCustom="true" %> B. <%@ OutputCache Duration="14" VaryByCustom="true" %> C. <%@ OutputCache Duration="840" VaryByParam="Customer ID" %> D. <%@ OutputCache Duration="14" VaryByParam="Customer ID" %> Answer: 840 ustomer ID 4. You are configuring security for a web application that will be used on your company intranet. Your company is using Intel-based as well as Apple computers running Windows and other operating systems. The following is part of the Web.config file for the application: <configuration> <authentication mode="<<Enter Answer Here>>"> <forms> loginUrl="login.aspx" protection="All" timeout="30" path="/" </forms> </authentication> </configuration> What will you replace "<<Enter Answer Here>>" with to successfully have all users authenticate to the application? A. Forms B. Basic C. Digest D. Windows Answer: Forms 5. What should be added to basic authentication? A. FTP B. TCP C. SSL D. NHL Answer: SSL 6. You are deploying a web application using the XCOPY method, and you are now selecting the files that should be included in the deployment. What file extensions must be included in the deployment? Select all that apply. A. .resx B. .aspx C. .cs D. .ini Answer: .aspx 7. You have just installed IIS on your desktop computer that is running Windows 2000 Professional. Directly after the installation, you try to create a web appl ication and you are given error messages indicating that the Internet server is incompat ible with the .NET Framework. You need to create a web application, so what is the fastest way to be able to do so?

A. Configure the FrontPage Server Extensions. B. Repair the .NET Framework installation from the Visual Studio .NET Windows Component update CD. C. There is no solution. Windows 2000 does not support .NET Framework web application development. D. Re-boot the computer. Answer: Repair the .NET Framework install 8. What is required in order to be able to install and use SSL on a web server? A. Export permission. B. The SSL add-on CD. C. Server certificate. D. Encryption key. Answer: Server certificate. 10. True or false. The Web.config file can be used to store configuration data f or properties of some controls. A. True. B. False. Answer: True. 11. What tool is used to manage the GAC? A. GacMgr.exe B. GacSvr32.exe C. GacUtil.exe D. RegSvr.exe Answer: GacUtil.exe 12. What is the effect of the following code snippet from the Web.config file? ... <system.web> <authorization> <deny users="?" /> </authorization> </system.web> A. Anonymous access is denied. B. Only anonymous access is allowed. C. Users in the default group are denied access. D. There will be a syntax error when the application is executed. Answer: Anonymous access is denied. 13. You are deploying the web application you have been developing to a production server. Your application uses a number of resource assemblies and also one utility assembly that has been developed for the web application. You deploy the application by using a file-archiving utility to package all the .asp x and Web.config files into the archive, and the application is installed on the production server by un-packing the archive in the target directory. The deployment did not generate any error messages; but when you are testing the application, you find that it does not work. None of the localized resources display anything, and there are a large number of errors displayed. You need to make the application function normallywhat is the most efficient way to achieve that goal? A. Enable tracing for the application, trace to an XML file, analyze the output, and correct the source of the problems. B. Copy the /bin directory from the development system to the production server. C. Install Visual Studio .NET on the production server; enable debugging; and single-step through the application, correcting all problems as they appear. D. Abort the deployment, and inform the customer that you will be back as soon as you have found the problem. Answer: Copy the /bin directory f 14. True or false. The GAC cannot store multiple versions of the same assembly. A. True.

B. False. Answer: False. 15. You are configuring your web application to require digest-based authenticat ion. What must you have in place before you can use digest-based authentication? A. A DNS server. B. Active Directory. C. Strong encryption keys. D. A strongly named Web.config file. Answer: Active Directory. 1. Which of the following methods are ways to create a Windows Form? A. Visual inheritance. B. Building a derived class from System.Windows.Forms.Form. C. Extending a prebuilt form. D. Selecting a form class from the Inheritance Picker. E. All of the above. Answer: All of the above. 4. You want to add a control to your form that allows you to set a particular option on or off. Which control would you choose? A. Button B. CheckedListBox C. CheckBox D. ListBox E. RadioButton Answer: CheckBox 7. When you set the Localization property of a form to True, which of the following happens? A. You allow the application to accept localization resources. B. The form is translated into the language specified in the Language property. C. The property asks you for the translation language. D. The program prompts you to provide a language resource. Answer: You allow the applicat 8. By setting the Text property on the form, you will cause the value of the Tex t property to display on which part of the form? A. Bottom-right corner B. Top-right corner C. Title bar D. Status bar Answer: Title bar 10. What would the outcome of an application that contained this code be? private void Form1_Load (object sender, System.EventArgs e) { Form1.Hide(); } A. The application would not compile. B. The program would run but no form would display. C. The program would run and display the form. D. A runtime error would occur. Answer: application would not compile. 11. What would the outcome of an application that contained this code be? private void Form1_Load (object sender, System.EventArgs e) { this.Hide(); } A. The application would not compile. B. The program would run but no form would display. C. The program would run and display the form.

D. A runtime error would occur. Answer: and display the form. 13. Which of the following are not methods of a System.Windows.Forms.Form object? A. Activate() B. Deactive() C. Form() D. OnCreate() Answer: Deactive() 14. Which of the following are not events of a System.Windows.Forms.Control? A. KeyPress B. KeyDown C. MousePress D. MouseMove E. MouseEnter Answer: MousePress 15. In which namespace would you find the class Application? A. System.Application B. System C. System.Window.Forms D. System.Windows.Forms Answer: Windows.Forms 1. If you want to ask the user to select between two or more mutually exclusive options, you would employ which of the following controls? A. TabControl B. Button C. RadioButton D. CheckBox Answer: RadioButton 2. The following piece of code is intended to create a new TabPage in a TabControl. What will happen when you try to run this code? TabPage tpMyNewTabPage = new TabPage(); tpMyNewTabPage.Caption = "Add Students"; tpMyNewTabPage.Size = new System.Drawing.Size (536, 398); Button b = new Button(); tpMyNewTabPage.Controls.Add (b); A. The program compiles and executes properly. B. The program compiles and causes a runtime error. C. The program does not compile because it is unable to add the button. D. The program does not compile because of a syntax error. Answer: syntax error. 3. The following piece of code is intended to create a new TabPage in a TabControl. What will happen when you try to run this code? TabPage tpMyNewTabPage = new TabPage(); tpMyNewTabPage.Text = "Add Students"; tpMyNewTabPage.Size = new System.Drawing.Size (536, 398); Button b = new Button(); tpMyNewTabPage.Controls.Add (b); A. The program compiles and executes properly. B. The program compiles but the tab page does not show. C. The program compiles and causes a runtime error. D. The program does not compile because of a syntax error. Answer: does not show. 4. You want to validate the user input that is retrieved in a text box. Which co ntrol will assist you in displaying the error message without moving off the form? A. RichTextBox B. NotifyIcon

C. HelpProvider D. ErrorProvider Answer: ErrorProvider 5. You want to validate the user input that is retrieved in a text box. Which ev ent will assist you in the validation of the data? A. UponValidation B. Validation C. Validating D. OnValidation Answer: Validating 6. Which of the following lines of code will produce a message box for the user? A. MessageDialogBox.Show ("This is your message"); B. MessageDialogBox.Show ("Message", "This is your message"); C. MessageBox.Show ("This is your message); D. MessageBox.Show ("Message", "This is your message"); Answer: MessageBox.Show 7. To dynamically add a context menu to your application, which section of code should be used? A. MenuItem m = new MenuItem(); contextMenu1.MenuItems.Add (m); B. MenuItem m = new MenuItem(); contextMenu1.MenuItem.Add (m); C. MainMenu m = new MainMenu(); contextMenu1.MenuItems.Add (m); D. MainMenu m = new MainMenu(); contextMenu1.MenuItem.Add (m); Answer: .MenuItems. 8. To produce a dialog box similar to the Windows Print dialog box, which of the following controls would you use? A. PrintPreviewDialog B. PrintDialog C. PrintBox D. SetupPrintDialog Answer: PrintDialog 9. Which property of the CheckedListBox allows you to preset the maximum number of items that can be selected? A. MaxItems B. MaximumItems C. SelectionItems D. SelectionMode Answer: SelectionMode 10. What is wrong with the following piece of code? Assume no other code has been written and you are creating the status bar dynamically. this.sbMyStatusBar.Panels[1].Text = "Panel 1"; this.sbMyStatusBar.Panels[2].Text = "Panel 2"; this.sbMyStatusBar.Panels[3].Text = "Panel 3"; A. Nothing is wrong with the code. B. It will cause a runtime error. C. There will be a syntax error found. D. The Text property is incorrect for a StatusBar. Answer: It will cause a runtime error. 11. Which line of code must be added in order to show a StatusBar? A. sbMyStatusBar.Show(); B. sbMyStatusBar.Display(); C. sbMyStatusBar.Show = true; D. sbMyStatusBar.Display = true; Answer: Show = true; 12. Which line of code will set the Link data for a LinkLabel? A. this.linkLabel1.Text = "http:\\www.microsoft.com";

B. this.linkLabel1.Link = "http://www.microsoft.com"; C. this.linkLabel1.HyperLink = "http://www.microsoft.com ; D. None of the above. Answer: None of the above. 14. Which property will allow the user to enter more than one line in a text box ? A. MaxLines B. MultipleLines C. MultiLines D. MultiLine Answer: MultiLine 15. Which control would you use to group a lot of controls together? A. GroupControl B. GroupBox C. FrameControl D. FrameBox Answer: GroupBox 1. Which code segment will populate a DataSet? A. sqlDataProvider1.Fill (dsUsers1); B. sqlDataProvider.Fill (dataAdapter1); C. sqlDataAdapter.Fill (dsUsers1); D. sqlDataAdapter.Fill (dataAdapter1); Answer: Adapter (dsUsers1); 2. What type of commands can you create? A. Text, stored procedures, and tables. B. Text, stored procedures, and TableRows. C. Text, stored procedures, and TableDirect. D. Text, stored procedures, and TableColumns. Answer: TableDirect. 3. Data access exceptions all derive from which base class? A. Sql.Data.Exceptions B. Sql.SqlDataExceptions C. Exception D. DataException Answer: DataException 4. You need to get access to a database that is stored on a server running Microsoft Access 2002. Which data adapter would you use? A. SqlDataAdapter B. OleDbDataAdapter C. OleDataAdapter D. ODBCDataAdapter Answer: OleDbDataAdapter 5. You need to get access to a database that is stored on a server running Microsoft SQL Server 2000. Which data adapter would you use? A. SqlDataAdapter B. OleDbDataAdapter C. OleDataAdapter D. ODBCDataAdapter Answer: SqlDataAdapter 6. You want to return XML data from a Microsoft SQL Server 7.0 database. Which method would you execute? A. ExecuteXmlReader() B. ExecuteXmlData() C. ExecuteOleReader() D. ExecuteOldData() Answer: ExecuteXmlReader() 7. The Parse event is triggered after which of these occurrences? A. Data is sorted. B. Data is filtered.

C. Data is bound to a control. D. Data is returned to the data source. E. All of the above. F. None of the above. Answer: returned to the data source. 8. The Format event is triggered after which occurrences? A. Data is sorted. B. Data is filtered. C. Data is bound to a control. D. Data is returned to the data source. E. All of the above. F. None of the above. Answer: All of the above. 12. Which of the following object types allow you to view read-only, forward-only data? A. DataAdapter B. DataSet C. DataReader D. DataCommand Answer: DataReader 13. Which of the following statements is correct? A. The DataSource property refers to the dataset object, and the DisplayMember refers to the field. B. The DataMember property refers to the dataset object, and the DataSource refers to the field. C. The DataMember property refers to the field, and the DataSource refers to the dataset object. D. The DisplayMember property refers to the dataset object, and the DataSource refers to the field. Answer: DataSource 14. Why does the data not display using the following code? studentConnection.Open(); studentCommand = studentConnection.CreateCommand(); studentCommand.CommandType = CommandType.Text; studentCommand.CommandText = "SELECT * FROM Student"; studentAdapter = new SqlDataAdapter (studentCommand); studentSet = new DataSet(); this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName"); A. The command object is instantiated incorrectly. B. The dataset object is instantiated incorrectly. C. The data binding is done incorrectly. D. The dataset has not been populated. Answer: has not been populated. 1. Where should a web service proxy file be located? A. In the \bin directory of My Documents. B. In the \lib directory of the application. C. In the \bin directory of the application. D. In the \lib directory of My Documents. Answer: \bin application. 3. Which command-line tool will create a web service proxy? A. isdlam.exe B. ildasm.exe C. tlbimp.exe D. wsdl.exe Answer: wsdl.exe 4. Which command-line tool will allow you to view an assembly? A. isdlam.exe B. ildasm.exe C. tlbimp.exe

D. wsdl.exe Answer: ildasm.exe 5. Which command-line tool will generate the proxy for a COM component? A. isdlam.exe B. ildasm.exeC. tlbimp.exe D. wsdl.exe Answer: wsdl.exe 6. Which of the following will display the Web Services on a remote IIS server (named www.hmr.com) in an assembly called MyServices? A. http://hmr.com/MyServices/ServiceName B. http://www.hmr.com/MyServices/ServiceName C. url://hmr.com/MyServices/ServiceName D. url://www.hmr.com/MyServices/ServiceName Answer: http://www 8. What must be done to be ready to consume a web service? A. Build a proxy library using wsdl.exe. B. Build a proxy library using csc.exe. C. Build a proxy library using TblImp.exe. D. Build a proxy library using pl.exe. Answer: wsdl.exe. 11. Which namespace is added to a program that calls a web service? A. using System.WebServices; B. using System.Web.Services; C. using System.Web.Services.List; D. using System.Web.Services.All; Answer: Web.Services; 12. Which URL will provide access to the web service called MyWebService, located in the WebServices web on the local machine? A. http://localhost/MyWebService/WebServices.asmx?WSDL B. http://localhost/WebServices/WebServices.asmx?WSDL C. http://localhost/MyWebService/MyWebService.asmx?WSDL D. http://localhost/WebServices/MyWebService.asmx?WSDL Answer: ices/MyWebS 13. A discovery file used to locate Web Services would have which extension? A. .discovery B. .discover C. .vdisco D. .disco Answer: .vdisco 14. When you test a web service, what do you expect to see as output? A. The web service running. B. The web site. C. The XML of the web proxy. D. The XML of the web service. Answer: web proxy. 15. Which attribute must be added to create an exposed web service method? A. [System.WebServices.WebMethod] B. [System.Web.Services] C. [System.Web.Services.Web.WebMethod] D. [System.Web.Services.WebMethod] Answer: Services.WebMethod] 1. Which file must be included in the assembly in order to provide a list of licensed controls within the application? A. xxxx.LIC B. xxxx.LCX C. xxxx.LICX D. xxxx.Licenses Answer: xxxx.LICX 2. You are planning to create a new control that will be used in place of the

Button control. The new control will blink and change color whenever the user moves the mouse over the control. Which control type would you use? A. Derived control from the Button class. B. Derived control from the Control class. C. Derived control from the UserControl class. D. Customized control using GDI+. Answer: Button class. 1. Which tool allows you to install an assembly into the GAC? A. Ngen.exe B. Mscorcfg.msc C. Setup.exe D. sn.exe Answer: Ngen.exe 2. Which of the following accurately describes a strong named assembly? A. A private assembly with a unique name within an application domain. B. A private assembly with a unique name within a global domain. C. A shared assembly with a unique name within an application domain. D. A shared assembly with a unique name within a global domain. Answer: private global 3. Which template must be chosen from the Add New Project dialog boxs Templates list in order to have an application downloaded from an IIS (Internet Information Server) server? A. Windows Setup Project. B. CAB Project. C. IIS Project. D. Web Setup Project. Answer: Web Setup Project. 4. You have followed the steps in creating a Windows Installer Setup project, an d after deployment you notice that it does not install properly on the client. Which of the following could be the problem? A. You forgot to run the sn.exe utility. B. The shortcut was not configured properly. C. The release type is set to Debug. D. The Registry entry is incorrect. Answer: The release type is set to Debug. 5. Why did Microsoft invent assemblies? A. To allow applications to take care of their own components. B. To speed up processing. C. To confuse developers studying for the .NET development exams. D. To ensure that all components register properly in the Registry. Answer: To allow applications to take care of their own components. 7. What can be configured using the .NET Configuration tool? A. GAC cache. B. Assemblies. C. Security. D. Policy levels. E. All of the above. F. None of the above. Answer: All of the above. 8. Which of the following command-line entries would allow you to install an assembly into the GAC? A. gacutil /l myAssembly.exe B. gacutil /i myAssembly.exe C. gacutil /s myAssembly.exe D. gacutil /h myAssembly.exe Answer: Ngen.exe /cache 9. Which command would you use to list the existing files in the native image cache?

A. Ngen.exe /list B. Ngen.exe /cache C. Ngen.exe /debug D. Ngen.exe /show Answer: Ngen.exe /show 11. If the redistributable package is to be installed on a server, what must be in place? A. .NET Framework B. SQL Server C. MDAC 2.6 D. CLR Answer: MDAC 2.6 12. Why is the Setup project name important? A. Setup looks for files under that name. B. It is the name in the Add/Remove Programs dialog box. C. There cannot be any spaces in the name. D. The name goes in the Registry. Answer: It is the name in the Add/Remove Programs dialog box. 14. Which line must exist in the AssemblyInfo.cs file in order to sign the assembly? A. [assembly: AssemblyKeyFile("")] B. [key: AssemblyKeyFile("")] C. [assembly: AssemblyKeyFile("myKeys.snk")] D. [key: AssemblyKeyFile("myKeys.snk")] Answer: assembly myKeys.snk 15. Where is the GAC located by default? A. Windows directory. B. Programs directory. C. Documents and Settings directory. D. Application directory. Answer: Windows directory. 1. You are responsible for adding localization to an existing Windows Form. What class will determine the locale of the runtime environment? A. ResourceManager B. Localization C. Globalization D. CurrentUICulture Answer: CurrentUICulture 2. Which tool can you use to configure the security settings for an application? A. mscorcfg.msc B. ngen.exe C. caspol.exe D. caspol.msc Answer: mscorcfg.msc 3. Which tool can you use to precompile a Windows application? A. mscorcfg.msc B. ngen.exe C. caspol.exe D. caspol.msc Answer: ngen.exe 4. Which security file will override the machine configuration file? A. Enterprise configuration B. Application configuration C. Security configuration D. User configuration Answer: Application configuration 9. What are the three different policy-configuration files? A. Enterprise, Machine, User. B. Enterprise, Machine, Local.

C. Enterprise, Security, Local. D. Enterprise, Security, User. Answer: Ent Mac User. 11. What type of array is the most efficient to work with? A. Rectangular array B. One-dimensional array C. Two-dimensional array D. Jagged array Answer: Jagged array 12. Which code-access class can be used to represent permissions related to network access? A. NetworkPermission B. RemotePermission C. URLPermission D. SocketPermission Answer: SocketPermission 13. Which of the following represents a union of permissions? A. A collection of code groups. B. A collection of permissions. C. A collection of intersections. D. A collection of evidence. Answer: code groups. 15. What must be done to create a ToolTip on a new Windows control? A. Add a ToolTip control and set the ToolTip property of the new control. B. Set the ToolTip property of the new control. C. Set the Help property of the new control. D. Create a MessageBox that displays when the user clicks the new control. Answer: Create a MessageBox 3. Which namespace must be added to the XML web service in order to write to an event log? A. System.EventLog B. System.Events C. System.Diagnostics D. System.Diagnostics.Event Answer: Diagnostics 4. Which technology allows you to publish XML web services? A. XMLPub B. XSLT C. XPath D. UDDI Answer: UDDI 6. Which of the following describes the elements that make up a SOAP message? A. Envelope, Header, Body, Fault. B. Envelope, Header, Body, Error. C. Envelope, Body, Fault. D. Envelope, Header, Fault. Answer: En He Bo Fa 7. Which of the following technologies are used to describe a web service in ter ms of the messages that it creates and the messages that it accepts? A. XMLS B. XSLT C. CORBA D. WSDL Answer: WSDL 8. What is the default namespace for a new web service? A. http://localhost B. http://www.w3.org C. http://tempuri.org/

D. http://www.microsoft.com Answer: tempuri.org/ 10. How would you add a web service component to your Visual Studio .NET application? A. Project | Add Web Component B. Project | Add Component C. Project | Add Web Service D. Project | Add Service Answer: Add Service 11. A static discovery file will usually have a file extension of which of the following? A. .vsdisco B. .vdisco C. .sdisco D. .disco Answer: .disco 12. Which of the following technologies is a lightweight protocol for exchange o f information in a decentralized, distributed environment? A. XML B. WSDL C. XSD D. SOAP Answer: SOAP 13. Which of the following technologies is a file that defines the structure and data types for XML documents? A. XSD B. XMLD C. XSLT D. XSL Answer: XSL 14. You are creating an application that will employ the services of an applicat ion that resides on a remote server. Which of the following protocols should be used to encode the message to the remote server? A. SOAP B. XML C. RPC D. DCOM Answer: SOAP 15. A WSDL document is a file that contains definitions for which of the followi ng? A. Types, Messages, Bindings. B. Types, Messages, portTypes, bindings, services. C. Types, portTypes, bindings, services. D. Messages, portTypes, bindings, services. Answer: Ty Me po bi se 2.You are creating a Windows service for Windows ME. You want to install the service in the Registry. What utility will do this for you? A. gacutil.exe B. regsvsc.exe C. sc.exe D. installer.exe E. None of the above. Answer: None of the above. 3. Which project template will allow you to create a background service in Visual Studio .NET? A. Windows service. B. Web service.

C. Windows application. D. Service. Answer: Windows service. 5. You have created a serviced component that will interface with COM+ services. You want to register the component manually. Which utility will allow you to do this? A. gacutil.exe B. regsvsc.exe C. install.exe D. sc.exe Answer: regsvsc.exe 6. You have created a serviced component that will interface with COM+ services. You want to register the component automatically. Which utility will allow you to do this? A. gacutil.exe B. regsvsc.exe C. xcopy.exe D. sc.exe Answer: xcopy.exe 8. Where would you find the Add Installer link within Visual Studio .NET? A. Under the Project menu. B. Under the Build menu. C. In the Toolbox. D. In the Properties Explorer window. Answer: Explorer window. 9. Which of the following methods will install a Windows service? Choose all that apply. A. xcopy.exe B. regedit.exe C. setup.exe D. service.exe Answer: setup.exe 10. A Windows service must inherit from which class? A. System.Service.ServiceBase B. System.ServiceProcess.Service C. System.ServiceProcess.ServiceBase D. System.Service.Service Answer: ServiceBase 11. Which Registry key would lead you to find the installed Windows service? A. HKEY_LOCAL_MACHINE\Services B. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services C. HKEY_LOCAL_MACHINE\System\Services D. HKEY_LOCAL_MACHINE\CurrentControlSet\Services Answer: System\Curren 13. Which class will allow you to programmatically work with your Windows servic e? A. ServiceController B. ServiceConfiguration C. ServiceStatus D. ServiceControl Answer: Controller 14. Which method of the ServiceController class will allow you to send a command to the service? A. Stop() B. Start() C. Pause() D. ExecuteCommand() Answer: ExecuteCommand() 15. Which of the following services represent the services that together provide an enterprise application?

A. Business, Logic, Application B. Application, Business, Data C. Presentation, Business, Data D. Presentation, Logic, Data Answer: Pre Bu Data 2. In order to have your server component accept method calls that pass the object by value, your remote server object must implement which interface? A. IUnknown B. IMarshalByValue C. IMarshalByRef D. ISingleCall E. ISerializable Answer: ISerializable 3. You are in charge of creating a remote object that will return database recor ds to the caller of the method. You want to ensure that the object keeps track of the number of requests, and writes the number out to the database. Which activation mode would you use? A. SingleCall B. Singleton C. Client-activated D. Server-activated Answer: Singleton 4. You have created a remote object, ChatServer.dll, that is to be deployed to an IIS server. You need to create a configuration file that will provide locatio n and type information. Which file would you create? A. web.config B. machine.config C. application.config D. ChatServer.exe.config Answer: web.config 11. To which namespace does the Activator class belong? A. System B. System.Remoting C. System.Remote D. System.Remoting.Activation Answer: System 13. To which namespace does the HttpChannel class belong? A. System.Remoting B. System.Runtime.Remoting.Channels.Http C. System.Runtime.Remoting D. System.Runtime.Remoting.Channels Answer: Channels.Http 14. Which line of code will register a channel? A. ChannelServices.Register (channel); B. ChannelServices.RegisterChannel(4242); C. ChannelServices.Register (4242); D. ChannelServices.RegisterChannel(channel); Answer: Channel(channel); 15. In which directory does the <application_name>.exe.config file belong? A. In the bin directory of the application. B. In the root directory of the application. C. In the \Winnt\System32 directory. D. In the \Program Files\Microsoft.NET directory. Answer: root directory 2. Your manager has asked you about interoperability between XML Web Services and an existing CORBA environment. What wire protocol will you tell your

manager about that will interoperate with CORBA? A. RPC B. COM+ C. SOAP D. DCOM Answer: SOAP 3. When discussing the XML Web Services architecture, which sentence best describes the service broker node? A. Broadcasts the available services. B. Advertises the available services in Active Directory. C. Advertises the services that are registered in the Registry. D. Assists the consumer to find the provider that supplies a particular web service. Answer: consumer 5. You want to ensure that your web method uses the cache for results, so you change the web method attribute to [WebMethod(BufferResponse = true)]. When you investigate, you find that your web method still is not using the cache. What is the most efficient way of ensuring that your web method uses the cache? A. Add CacheTime=300 to the WebMethod attribute. B. Add Cache=true to the WebMethod attribute. C. Add EnableCache=true to the WebMethod attribute. D. Add CacheDuration=300 as a parameter to the WebMethod attribute. Answer: parameter to t 6. What is the name of the root element in a WSDL document? A. definition B. wsdl_root C. xml_root D. root Answer: definition 8. What sentence best describes loosely coupled components? A. Both components use a common event model to communicate. B. Both components use public variables and methods to communicate. C. Both components use only public methods to communicate. D. Both components use asynchronous methods to communicate. Answer: asynchronous 9. You need to build a proxy class for an XML web service. What tool will you us e? Select all that apply. A. cdc.exe B. wsdl.exe C. proxy.exe D. disco.exe Answer: wsdl.exe 10. When you create an XML web service, it is stored in a source file. What is t he extension of that source file? A. .xmls B. .asxm C. .asmx D. .asxml Answer: .asmx 11. By adding the [WebService(Namespace="http://xxx.yyy")] attribute in front of the class that defines the XML web service, you modify a namespace. What is that namespace? A. The namespace of the XML web service. B. The default namespace of the SOAP messages. C. The namespace of the ASP.NET server. D. The default URL that all redirections will go to. Answer: XML web service.

12. By setting the EnableSession property to True, you have access to what resources? A. Nothing. You need to create the session first. B. Session variables. C. Application variables. D. Local variables stored in the Web Method session. Answer: Session variables. 13. The XML Web service broker stores information about the XML web services that have published their services to the broker. What structure does the servic e broker store the information in? A. Broker registry. B. Windows Registry. C. UDDI registry. D. XML document. Answer: UDDI registry. 14. True or false? XML documents contain the data model of the data they contain . A. True B. False Answer: True 15. After creating a proxy class, you compile it. What type of file will the pro xy be compiled to? A. .dll B. .asmx C. .aspx D. .proxy Answer: .dll 1. What namespace must be used in order to use the DOM for XML support? A. System.Data.Xml B. System.Xml C. System.Xml.DOM D. System.DOM Answer: System.Xml 4. True or False. XML Transformations can be used to create a form letter. A. True. B. False. Answer: False. 6. You are parsing an XML document using an XmlReader. You find that the resulting node tree is very large compared to the number of elements and attributes in the XML document. Why would the result of the parsing produce a large node tree? A. The WhitespaceHandling parameter is set to WhitespaceHandling.All. B. The WhitespaceHandling parameter is set to WhitespaceHandling.None. C. The WhitespaceHandling parameter is set to WhitespaceHandling.Auto. D. The WhitespaceHandling parameter is set to WhitespaceHandling.Special. Answer: .All. 7. Which of the following classes supports XML schemas? Select all that apply. A. XmlReader B. XmlDocument C. XmlValidatingReader D. XmlNodeReader Answer: ValidatingReader 8. You are developing an application that will connect to a Microsoft SQL Server 6.5, and you need to select the appropriate ADO.NET connection object for this database server. What ADO.NET connection object is the most appropriate? A. XxxConnection B. SqlConnection

C. OleDbConnection D. OdbcConnection Answer: OleDbConnection 14. When you build the schema of a DataSet, you need to model the data types of the data that will reside in the DataColumn objects. What data type would you use to represent a date? A. date B. day C. System.DateTime D. variant Answer: DateTime 15. True or False. HTML must be well formed to be used with XML. A. True. B. False. Answer: True. 1. You need to create a UDDI registry for your company. What are your options regarding private UDDI registries? A. Use the Private UDDI SDK from Microsoft. B. Implement your own private UDDI registry by implementing the entire UDDI specification. C. Implement a custom publish/discover architecture. D. Hard-code the endpoints. Answer: UDDI registry statement is used to iterate through the collection to get the information that you want Answer: foreach Which of the following features are right to Value Types? Answer: Allocated on the stack.../Variables of reference. Data encapsulation can be implemented using: Answer: All of the others. Select correct statements about Inheritance in C#: Answer: An interface can.../A class can implement. If a base class wishes to define a method that may be overridden by a subclass, it must specify the method as? Answer: virtual Which of the following statements about casting are correct? Answer: None of the others. A .NET assembly contains the following elements: Answer: Type metadata/An assembly manifest/CIL code. The documents each module within the assembly, establishes the version of the assemb ly, and also documents any external assemblies referenced by the current assembly? Answer: manifest An assembly contains that completely describes the format of the contained types as well as the format of external types referenced by this assembly. Answer: metadata. are required to be located within the same directory as the client application ( termed the application directory) or a subdirectory thereof. Answer: Private assemblies

Which assemblies can be configured using client *.config file? Answer: Private assemblies/Shared Assemblies. A delegate type maintains three important pieces of information: Answer: The return value (if any) of this method. .NET Remoting can be applied to two objects communicating in any of the followin g manners: Answer: All of the others. In .NET Remoting, Clients and server objects do not communicate via a direct con nection, but rather through the use of an intermediary termed a . Answer: proxy Which of the following type is different from the others? Answer: Form Which method is designed specifically for singleton queries (such as result of a ggregate functions)? Answer: ExecuteScalar(). Which method help protect against SQL injection attacks? Answer: All of the others. Buttons, Textboxes, Listboxes are? Answer: Simple controls. Which control is used to determine a given value is in a predetermined range? Answer: RangeValidator. Which class enables you to share global information across all users (and all pa ges)? Answer: HttpApplicationState. Which of the following server-side methods can be used on the HttpServerUtility to navigate to a different Web page without requiring a round trip to the client ? Answer: Transfer. You need to write data to a database before a users session times out. Which even t should you respond to? Answer: Session_End. How do you execute multiple SQL statements using a DataReader? Answer: Set the Command.CommandText property to multiple SQL statements delimite d by a semicolon. What are the three main objects when working with a DataSet? Answer: DataTable, DataColumn, and DataRelation. What object would you set the properties on to create a primary key for a DataTa ble? Answer: DataColumn. Which statement that is used to replace multiple if statements is called? Answer: The case statement. Which of the following is not a C# keyword? Answer: implements.

Which is a definition of a static method? Answer: public static void MethodA(). Which of the following keyword is used to extend or modify the abstract or virtu al implementation of an inherited method, property, indexer, or event? Answer: override. Given the following program, what is the outcome when you try to compile and run it? Answer: ConsoleApplication1.Program.Main () : not all code paths return a value. Which of the following statements are false? Answer: A readonly field can be initialized only at compile time. The main features of a static class are: Answer: They only contain static members. Which of the following modifier cause arguments to need not be initialized prior to being passed? Answer: out. What type of object is required when starting a thread that requires a single pa rameter? Answer: ParameterizedThreadStart delegate. What method terminates a running thread? Answer: Thread.Abort. Select the reasons why you would use Windows Forms over Web Forms? Answer: All of the others. You want to add a control to your form that allows you to set a particular optio n on or off. Which control would you choose? Answer: RadioButton. Which of the following are not events of a System.Windows.Forms.Control? Answer: MousePress. What causes the following Load event to fire? Answer: The user starts the application if the form is the only form in the appl ication. Which controls is appropriate to dipsplay a list of suggested choices and allows multiseletion? Answer: Listbox. Which control allows typing in when choice is not in list of suggested choices? Answer: Combobox. What ASP.NET object encapsulates the users data as it is sent from a form in a pa ge? Answer: The Request object. What important standard is used to connect client browsers with web servers? Answer: HTTP What definition correctly defines a label server control with the name set to lb lHoop? Answer: <asp:label id="lblHoop" runat="server"/>

What ASP.NET object encapsulates the state of the client and the browser? Answer: The Session object. What event would be used to capture the selection of a new item in a DropDownLis t control? Answer: The SelectedIndexChanged event. Which code segment will populate a DataSet? Answer: sqlDataAdapter.Fill(dsUsers1); Which of the following object types allow you to view read-only, forward-only da ta? Answer: DataReader. How do you execute multiple SQL statements using a Datareader? Answer: Set the Command.CommandText property to multiple SQL statements delimite d by a semicolon. What is a DataSet? Answer: All of the others. What are the main objects that make up a DataAdapter? Answer: Connection and Command objects. Which line causes a compile error in the following code? Answer: Line 3. When you test the event handler, you find that it never runs. What code must yo u add to your application to make the event execute in response to the SendFax event? Answer: this.sFax.SendFax += new SendFaxHandler(this.Send_Fax); The following SQL INSERT statement fails. What is the most probable reason for t he failure? Answer: The columns in the Employees table are not in the indicated order (int, char, char, int). You are using the try... catch block seen in the following code segment, but no exceptions are ever caught by the catch block. What is the problem? Answer: The exception class is wrong; it should be SqlExceptions. Select the line of code that will create a new form. Answer: D-using System.Windows.Forms; Which line of code will set the Link data for a LinkLabel? Answer: None of the above. In which namespace would you find the class Application? Answer: System.Windows.Forms. Which of the following are not methods of System.Windows.Forms.Form object? Answer: Deactive(). Given the following code, what will the compiler do? class Test1 { sealed abstract void MyMethod1A() {

System.Console.WriteLine ("This is MyMethod1"); } } Answer: MyMethod1() is not properly declared. Which tool provides dozens of options that allow you to debug your assembly? Answer: Ildasm.exe System.Byte is: Answer: CTS Class type. What of the following are not core feature of .NET framework? Answer: Wrap a " sane subnet". What is output if the below code snippet is executed: Console.Writeline("C formal:{0;C}",99989.987); Answer: 9.999977E+004 Which of the following server-side methods can be used on the HttpServerUtility to navigate a different Web pagr without requiring a round trip to the client? Answer: Redirect. The easiest way to make a CheckBox causing PostBack is... Answer: Set the AutoPostBack. Which of the following would you do to prevent the user from being able to give focus to the control under circumstance? Answer: Set the control S Enabled. Some characteristics of C# are: Answer: None of the others. Which format property of the DateTimePickerForamt enumertion would you select to display dates in a format that is not depend on the operating system format? Answer: DateTimePickerFOrmat.Custom. An instance of the HttpRequest class type can not be used to: Answer: get a collection of cookies. With respect to constructors of a class. Answer: none of the others. The const keyword is used to modify a declaration of... Answer: a parameter of a return value. With respect to CLR. Answer: CLR is a set of. With respect to Events. Answer: Events are usually declared. What is the fastest way to return the total number of customer in a database? Answer: Create a stored procedure. with repset to advantages of single-file page model. Answer: All of the others. =====================================met vai=========================

=====================================the end=========================

Você também pode gostar