1. Question: You are writing a method that accepts a string parameter named message. Your method must break the message parameter into individual lines of text and pass each line to a second method named Process. Which code segment should you use?

    A
    Dim reader As New StringReader(message)
    ProcessMessage(reader.ToString())
    reader.Close()

    B
    Dim reader As New StringReader(message)
    While reader.Peek() <> -1
    ProcessMessage(reader.ReadLine())
    End While
    reader.Close()

    C
    Dim reader As New StringReader(message)
    While reader.Peek() <> -1
    Dim line as String = reader.Read().ToString()
    ProcessMessage(line)
    End While
    reader.Close()

    D
    Dim reader As New StringReader(message)
    ProcessMessage(reader.ReadToEnd())
    reader.Close()

    Note: Not available
    1. Report
  2. Question: You are writing an application that uses isolated storage to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same computer. You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly. Which code segment should you use?

    A
    Dim objStore As IsolatedStorageFile objStore = IsolatedStorageFile.GetUserStoreForAssembly objStore.CreateDirectory("Preferences")

    B
    Dim objStore As IsolatedStorageFile objStore = IsolatedStorageFile.GetUserStoreForApplication objStore.CreateDirectory("Preferences")

    C
    Dim objStore As IsolatedStorageFile objStore = IsolatedStorageFile.GetMachineStoreForAssembly objStore.CreateDirectory("Preferences")

    D
    Dim objStore As IsolatedStorageFile objStore = IsolatedStorageFile.GetUserStoreForDomain objStore.CreateDirectory("Preferences")

    Note: Not available
    1. Report
  3. Question: You create a class library that contains the class hierarchy defined in the following code segment. (Line numbers are included for reference only.)
    01 Public Class Group
    02 Public Employees As Employee()
    03 End Class 05 Public Class Employee
    06 Public Name As String
    07 End Class 09 Public Class Manager
    10 Inherits Employee
    11 Public Level As Integer
    12 End Class
    You create an instance of the Group class. You populate the fields of the instance. When you attempt to serialize the instance by using the Serialize method of the XmlSerializer class, you receive InvalidOperationException. You also receive the following error message: "There was an error generating the XML document."
    You need to modify the code segment so that you can successfully serialize instances of the Group class by using the XmlSerializer class. You also need to ensure that the XML output contains an element for all public fields in the class hierarchy.
    What should you do?

    A
    Insert the following code between lines 1 and 2 of the code segment:
    <XmlArrayItem(Type:=GetType(Employee))> _ <XmlArrayItem(Type:=GetType(Manager))> _

    B
    Insert the following code between lines 1 and 2 of the code segment:
    <XmlArray(ElementName:="Employees")> _

    C
    Insert the following code between lines 5 and 6 of the code segment:
    <XmlElement(Type:=GetType(Employee))>
    and
    Insert the following code between lines 10 and 11 of the code segment:
    <XmlElement(Type:=GetType(Manager))>

    D
    Insert the following code between lines 1 and 2 of the code segment:
    <XmlElement(Type:=GetType(Employee))> _

    Note: Not available
    1. Report
  4. Question: You are developing a fiscal report for a customer. Your customer has a main office in the United States and a satellite office in Mexico. You need to ensure that when users in the satellite office generate the report, the current date is displayed in Mexican Spanish format. Which code segment should you use?

    A
    Dim strDate As String = _
    DateTime.Today.Month.ToString("es-MX")

    B
    Dim DTFormat As DateTimeFormatInfo = _
    New CultureInfo("es-MX", False).DateTimeFormat
    Dim DT As New DateTime( _ DateTime.Today.Year,
    DateTime.Today.Month, DateTime.Today.Day) Dim strDate As String = _ DT.ToString(DTFormat.LongDatePattern)

    C
    Dim objCalendar As Calendar = _
    New CultureInfo("es-MX", False).Calendar
    Dim DT As New DateTime( _
    DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day) Dim strDate As String = DT. ToString

    D
    Dim strDate As String = _
    DateTimeFormatInfo.CurrentInfo.GetMonthName( _
    DateTime.Today.Month)

    Note: Not available
    1. Report
  5. Question: You are creating an application that lists processes on remote computers. The application requires a method that performs the following tasks:
    Accept the remote computer name as a string parameter named strComputer.
    Return an ArrayList object that contains the names of all processes that are running on that computer.
    You need to write a code segment that retrieves the name of each process that is running on the remote computer and adds the name to the ArrayList object.
    Which code segment should you use?

    A
    Dim al As New ArrayList()
    Dim procs As Process() = Process.GetProcesses(strComputer) Dim proc As Proces
    For Each proc In procs
    al.Add(proc)
    Next

    B
    Dim al As New ArrayList()
    Dim procs As Process() = _ Process.GetProcessesByName(strComputer) Dim proc As Process
    For Each proc In procs
    al.Add(proc.ProcessName)
    Next

    C
    Dim al As New ArrayList()
    Dim procs As Process() = Process.GetProcesses(strComputer) Dim proc As Process
    For Each proc In procs
    al.Add(proc.ProcessName)
    Next

    D
    Dim al As New ArrayList()
    Dim procs As Process() = _
    Process.GetProcessesByName(strComputer)
    Dim proc As Process
    For Each proc In procs
    al.Add(proc)
    Next

    Note: Not available
    1. Report
  6. Question: You need to return the contents of an isolated storage file as a string. The file is machine-scoped and is named Settings.dat. Which code segment should you use?

    A
    Dim objStream As IsolatedStorageFileStream
    objStream = New IsolatedStorageFileStream( _
    "Settings.dat", FileMode.Open)
    Dim result As String = New StreamReader(objStream).ReadToEnd

    B
    Dim objFile As IsolatedStorageFile
    objFile = IsolatedStorageFile.GetMachineStoreForAssembly Dim objStream As
    IsolatedStorageFileStream
    objStream = New IsolatedStorageFileStream( _
    "Settings.dat", FileMode.Open, objFile)
    Dim result As String = objStream.ToString

    C
    Dim objFile As IsolatedStorageFile
    objFile = IsolatedStorageFile.GetMachineStoreForAssembly Dim objStream As
    IsolatedStorageFileStream
    objStream = New IsolatedStorageFileStream( _
    "Settings.dat", FileMode.Open, objFile)
    Dim result As String = New StreamReader(objStream).ReadToEnd

    D
    Dim objStream As IsolatedStorageFileStream
    objStream = New IsolatedStorageFileStream( _
    "Settings.dat", FileMode.Open)
    Dim result As String objStream.toString

    Note: Not available
    1. Report
  7. Question: You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?

    A
    Dim objSecurity As New FileSecurity( _ "MyData.xml", AccessControlSections.All) objSecurity.SetAccessRuleProtection(True, True) File.SetAccessControl("MyData.xml", objSecurity)

    B
    Dim objSecurity As FileSecurity = _ File.GetAccessControl("MyData.xml") objSecurity.SetAccessRuleProtection(True, True)

    C
    Dim objSecurity As New FileSecurity() objSecurity.SetAccessRuleProtection(True, True) File.SetAccessControl("MyData.xml", objSecurity)

    D
    Dim objSecurity As FileSecurity = _ File.GetAccessControl("MyData.xml") objSecurity.SetAuditRuleProtection(True, True) File.SetAccessControl("myData.xml", objSecurity)

    Note: Not available
    1. Report
  8. Question: You are developing an application that dynamically loads assemblies from an application directory. You need to write a code segment that loads an assembly named Assembly1.dll into the current application domain. Which code segment should you use?

    A
    Dim domain As AppDomain = AppDomain.CurrentDomain
    Dim asm As [Assembly] = domain.GetData("Assembly1.dll")

    B
    Dim domain As AppDomain = AppDomain.CurrentDomain
    Dim myPath As String = _
    Path.Combine(domain.BaseDirectory, "Assembly1.dll")
    Dim asm As [Assembly] = [Assembly].Load(myPath)

    C
    Dim domain As AppDomain = AppDomain.CurrentDomain
    Dim myPath As String = _
    Path.Combine(domain.BaseDirectory, "Assembly1.dll")
    Dim asm As [Assembly] = [Assembly].LoadFrom(myPath)

    D
    Dim domain As AppDomain = AppDomain.CurrentDomain
    Dim myPath As String = _
    Path.Combine(domain.DynamicDirectory, "Assembly1.dll") Dim asm As [Assembly] = _ AppDomain.CurrentDomain.Load(myPath)

    Note: Not available
    1. Report
  9. Question: You are developing a method to encrypt sensitive data with the Data Encryption Standard (DES) algorithm. Your method accepts the following parameters:
    The byte array to be encrypted, which is named message
    An encryption key, which is named key
    An initialization vector, which is named iv
    You need to encrypt the data. You also need to write the encrypted data to a MemoryStream object.
    Which code segment should you use?

    A
    Dim objDES As New DESCryptoServiceProvider
    objDES.BlockSize = message.Length
    Dim objCrypto As ICryptoTransform = objDES.CreateDecryptor(key, iv) Dim cipherStream As New MemoryStream
    Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write)

    B
    Dim objDES As New DESCryptoServiceProvider
    Dim objCrypto As ICryptoTransform = objDES.CreateDecryptor(key, iv) Dim cipherStream As New MemoryStream
    Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write) cryptoStream.Write(message, 0, message.Length)

    C
    Dim objDES As New DESCryptoServiceProvider
    Dim objCrypto As ICryptoTransform = objDES.CreateEncryptor(key, iv) Dim cipherStream As New MemoryStream
    Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write) cryptoStream.Write(message, 0, message.Length)

    D
    Dim objDES As New DESCryptoServiceProvider
    Dim objCrypto As ICryptoTransform = objDES.CreateDecryptor() Dim cipherStream As New
    MemoryStream
    Dim cryptoStream As New CryptoStream(cipherStream, objCrypto, CryptoStreamMode.Write) cryptoStream.Write(message, 0, message.Length)

    Note: Not available
    1. Report
  10. Question: You are creating an undo buffer that stores data modifications. You need to ensure that the undo functionality undoes the most recent data modifications first. You also need to ensure that the undo buffer permits the storage of strings only. Which code segment should you use?

    A
    Dim undoBuffer As New Queue()

    B
    Dim undoBuffer As New Stack()

    C
    Dim undoBuffer As New Queue(Of String)

    D
    Dim undoBuffer As New Stack(Of String)

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd