Monday, November 22, 2010

Silverlight training - some questions

After a while I had to conduct training in my company.Earlier it was WPF and now the topic is Silverlight.I dont know whether Silverlight training is relevant now because of HTML 5.According to me next version of ASP.Net may be 5.0 or 6.0 will emit html5 which may reduce the need of Silverlight in the RIA world.But in other context Silverlight is valuable because of Windows 7 mobile development.

Anyway I have started training and conducted one small test in order to evaluate my students.I am not going to share their scores but some questions I have asked.

  • Which code snippet determines whether the Silverlight application is running inside browser or OOB?
    1. App.GetState()
    2. System.Windows.Application.Current.IsRunningOutOfBrowser
    3. System.AppDomain.CurrentDomain.IsRunningOutOfBrowser
    4. Silverlight.IsRunningOutOfBrowser
  • Can we create folder in IsolatedStorage? (Yes/No)
  • Can we redirect the browser to a ASPX/HTML page from Silverlight?(Yes/No)
  • What is possible in OOB without using COM objects?
    1. Access registry
    2. Access file from C: drive
    3. Access file from MyDocuments
    4. All
  • Is it possible to refer a WPF 4.0 dll in Silverlight? (Yes/No)
  • Where we normally specify the window less mode?                           
    1. Hosting HTML page
    2. App.xaml.vb
    3. MainPage.xaml.vb
    4. None of the above                           
  • Where is isolated storage located?
    1. Main memory of server
    2. Hard disk of client
    3. Main memory of client
    4. Database
  • Can <Resources> tag in a xaml page contain a boolean value?(Yes/No)
  • Can we write code behind of ABC.xaml in XYZ.vb? (Yes/No)
  • Can Silverlight application access ASP.Net Session variable?
  • How Silverlight application gets values from its browser host at initialization time?                               
    1. Through constructor of App class                               
    2. Through Environment.CommandLine property                               
    3. Using ProvideInitValues event                               
    4. None of the above
  • How to add a resource programatically?
    1. Me.Resources.Add(1, New SolidColorBrush(Colors.Green))
    2. Me.Resources.AddResource(1, New SolidColorBrush(Colors.Green))
    3. Me.AddResource("mycolor", New SolidColorBrush(Colors.Green))
    4. None of the above
  • What is the base class of UserControl class?                           
    1. Control
    2. UIElement
    3. DependencyObject
    4. UserControlBase      
  • How Silverlight application can access SQL database ?
    • Through SQLDataAdapter
    • Through ODBC connection
    • Using WebService
    • Using Windows service     
  • Last question was to create a simple <Grid> based layout of a login page.

If you are a Silverlight developer you may feel that some questions are silly or too simple.But my students are in different categories.Some had projects in Silverlight others are hearing word Silverlight for the first time.So its a mix and people can just start learning concepts even if they are not able to answer.

Hope I don’t have to provide answers to these questions since all are known.Let me know if anybody needs clarification.

NB: These are not Silverlight interview questions and I think nobody will ask these type of questions in interview.