Showing posts with label NIIT Window app Question. Show all posts
Showing posts with label NIIT Window app Question. Show all posts

Tuesday, 25 February 2014

Identify the method that ensures that the content of the stream is cleared.

Identify the method that ensures that the content of the stream is cleared.
1. FlushAsync()
2. SaveAsync()

3. WriteAsync()

Solution:

1. FlushAsync()

Identify the code snippet that is used to save the session data of an app.

Identify the code snippet that is used to save the session data of an app.
1. SuspensionManager.SaveAsync();
2. MainPage.SaveAsync();

3. App.SaveAsync();

Solution:
1. SuspensionManager.SaveAsync();

Identify the file in which the Suspending event handler is defined.

Identify the file in which the Suspending event handler is defined.
  1. App.xaml.cs
  2. MainPage.xaml.cs
  3. App.xaml

Solution:
App.xaml.cs

Identify the circumstances in which an app is switched to the Suspended phase.

Identify the circumstances in which an app is switched to the Suspended phase.
1. The app is idle for at least 10 seconds.
2. A new app is launched by the user.

3. The system is running low on resources.

Solution:2. A new app is launched by the user.



Which one of the following instances is returned by the ShowAsync() method of the MessageDialog class?

Which one of the following instances is returned by the ShowAsync() method of the MessageDialog class?
1. Tapped
2. TextBlock
3. IUICommand

4. Button

Solution:
3. IUICommand

Which one of the following code snippets can be used to style a Button control with the numericButtonStyle style?

Which one of the following code snippets can be used to style a Button control with the numericButtonStyle style?
1. <Button Content="1" Style="{StaticResource   numericButtonStyle}"></Button>
2. <Button Content="1" Style="{Binding   numericButtonStyle}" ></Button>
3. <Button Content="1"   Style="{numericButtonStyle}"></Button>

4. <Button Content="1"   Style="numericButtonStyle"></Button>

Solution:
Solution:
1. <Button Content="1" Style="{StaticResource
  
numericButtonStyle}"></Button>

Which one of the following files is a resource dictionary?

Which one of the following files is a resource dictionary?
1. App.xaml.cs
2. StandardStyles.xaml
3. MainPage.xaml

4. Package.appxmanifest

Solution:
     2. StandardStyles.xaml

Monday, 24 February 2014

Ian is working as an app developer at SuperTech Solutions Ltd. He has been assigned the task to develop an app that allows the user to save the daily exercise details and view the calories burned during each exercise.

Problem Statement:
Ian is working as an app developer at SuperTech Solutions Ltd. He has been assigned the task to develop an app that allows the user to save the daily exercise details and view the calories burned during each exercise.
To accomplish the preceding requirements, Ian decides to create the following pages in the app:
Exercise Logs: Displays the list of exercises containing the name of exercise, date, duration, and calories burnt, as shown in the following figure.


In addition, the page contains controls on the App bar to add new details and view the summarized report of the calories burnt.
Exercise Details: This page allows a user to enter the exercise details. In addition, the page contains a control on the App bar to save the specified details in the app and another control to cancel the adding details action. The following figure shows the UI of this page.



Report: This page displays a control to select a date for which the report of calories burnt needs to be viewed. In addition, the page displays the details of exercises and the total calories burnt on the selected date. The following figure shows the UI of this page.



Ian has created the UI of the app. Help him to add the required functionalities.
Solution:

To add functionalities to the ExerciseLogger app, Ian needs to perform the following tasks:

  1. Make the Exercise Details page functional.
  2. Make the Exercise Logs page functional.
  3. Make the Report page functional.
  4. Execute the app and verify the output.




Identify the property of the ListBox control that is used to assign a data template.

Identify the property of the ListBox control that is used to assign a data template.
1. DataContext
2. ItemsSource
3. ItemTemplate


4. Items

Solution:

3. ItemTemplate

Which one of the following namespaces contains the ObservableCollection class?

Which one of the following namespaces contains the ObservableCollection class?
1. System.Collections
2. System
3. System.Data


4. System.Collections.ObjectModel

Solution:
4. System.Collections.ObjectModel

Identify the correct code snippet that can be used to pass the question variable to the SearchResults page during navigation.

Identify the correct code snippet that can be used to pass the question variable to the SearchResults page during navigation.
1. Frame.Navigate(typeof(SearchResults),    question);
2. Frame.Navigate(SearchResults, question);
3. Frame.Navigate(question,   typeof(SearchResults));
4. Frame.Navigate(question, SearchResults);

Solution:
1. Frame.Navigate(typeof(SearchResults),   question);

Sunday, 23 February 2014

William works as a Windows Store app developer at WegaApps Co. He has a new assignment for creating a basic paint app.

Problem Statement:
William works as a Windows Store app developer at WegaApps Co. He has a new assignment for creating a basic paint app.
The paint app should have the following features:
  • Paint area: A full screen area for drawing lines and shapes.
  • Drawing toolbar: A toolbar that allows drawing an ellipse, a rectangle, and a straight line. In addition, the toolbar should contain a button for clearing the screen.
  • Color toolbar: A toolbar that allows selecting a color for stroke and fill of the shapes with the help of the various color buttons.
  • In addition, a toggle button allows to switch between the stroke and fill colors. To select a stroke/fill color, first the toggle button needs to be clicked, and then a color needs to be selected by clicking a color. Further, the app allows the user to change the stroke thickness from 1 to 100.
  • Both the toolbars should be displayed to the user on demand.

The interface of the app should look like the one shown in the following figure.



Solution:
To create a basic paint app, William needs to perform the following tasks:
Create a blank Windows Store app.
Create the paint area.
Create the color toolbar.
Create the drawing toolbar.
Verify the created app.

XAML CODE:

<AppBar n:Name="appBarColors" HorizontalAlignment="Right" Background="Black" Width="1250">
<GridView SelectionMode="None" Tapped="1boxColors_Tapped" x:Name="1boxColors" HorizontalAlignment="Center" Width="1250">
VerticalAlignment="Center" Background="Black" ScrollViewer.HorizontalScrollMode="Auto"
ScrollViewer.VerticalScrollMode="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="10,0,7,210"

<Button Background="Aqua" Heigh="300" Width="300"></Button>
<Button Background="Black" Heigh="300" Width="300"></Button>
<Button Background="Blue" Heigh="300" Width="300"></Button>
<Button Background="Chocolate" Heigh="300" Width="300"></Button>
<Button Background="Crimson" Heigh="300" Width="300"></Button>
<Button Background="Cyan" Heigh="300" Width="300"></Button>
<Button Background="DarkGreen" Heigh="300" Width="300"></Button>
<Button Background="DarkMagenge" Heigh="300" Width="300"></Button>
<Button Background="DarkOrange" Heigh="300" Width="300"></Button>
<Button Background="DarkRad" Heigh="300" Width="300"></Button>
<Button Background="ForestGreen" Heigh="300" Width="300"></Button>
<Button Background="Fuchsia" Heigh="300" Width="300"></Button>
<Button Background="Gold" Heigh="300" Width="300"></Button>
<Button Background="Gray" Heigh="300" Width="300"></Button>
<Button Background="Green" Heigh="300" Width="300"></Button>
<Button Background="GreenYellow" Heigh="300" Width="300"></Button>
<Button Background="HotPink" Heigh="300" Width="300"></Button>
<Button Background="Indigo" Heigh="300" Width="300"></Button>
<Button Background="LavenderBlush" Heigh="300" Width="300"></Button>
<Button Background="LightBlue" Heigh="300" Width="300"></Button>
<Button Background="LightPink" Heigh="300" Width="300"></Button>
<Button Background="Lime" Heigh="300" Width="300"></Button>
<Button Background="LimeGreen" Heigh="300" Width="300"></Button>
<Button Background="Magenta" Heigh="300" Width="300"></Button>
<Button Background="Maroon" Heigh="300" Width="300"></Button>
<Button Background="OrangeRed" Heigh="300" Width="300"></Button>
<Button Background="Pink" Heigh="300" Width="300"></Button>
<Button Background="Purple" Heigh="300" Width="300"></Button>
<Button Background="Red" Heigh="300" Width="300"></Button>
<Button Background="RosyBrown" Heigh="300" Width="300"></Button>
<Button Background="RoyalBlue" Heigh="300" Width="300"></Button>
<Button Background="SandyBrown" Heigh="300" Width="300"></Button>
<Button Background="Silver" Heigh="300" Width="300"></Button>
<Button Background="SkyBlue" Heigh="300" Width="300"></Button>
<Button Background="Tomato" Heigh="300" Width="300"></Button>
<Button Background="Violet" Heigh="300" Width="300"></Button>
<Button Background="White" Heigh="300" Width="300"></Button>
<Button Background="Yellow" Heigh="300" Width="300"></Button>
<Button Background="YellowGreen" Heigh="300" Width="300"></Button>

<ToggleButton Background="Blue" x:Name="tglBtnStrokeFill" Content="Stroke" FontSize="70" Tapped="tglBtnStrokeFill_Tapped" Wigth="300" Height="300"/>
<Slider x:Name="sldrstrokeThickness" Orientation="Vertical" Minimum="1" Maximum="100" Height="250" ValueChanged="sldrStrokeThickness_ValueChanged"/>
<TextBlock Text="Thickness" FontSize="70" Height="300" Width="300"/>
</GridView>

</AppBar>

------------------------------------------------------------------------------------------------------------------
CS page:

privare void 1boxColors_Tapped(object sender, TappedRoutedEventArgs e)
{
UIElement controls = e.OriginalSource as UIElement;
while (controls != null && controls !=sender as UIElement)
{
if (controls is Button)
{
Button bttn = controls as Button;
if (tglBtnStrokeFill.Content.ToString() == "Stroke")
strokeColor = (SolidColorBrush) bttn.Background;
else
fillColor = (SolidColorBrush)bttn.Background;
break;
}
controls  = VisulTreeHelper.GetParent(controls) as UIElement;
}
}
private void tglBtnStrokeFill_Tapped(object sender, TappedRoutedEventArgs e)
{
if (tglBtnStrokeFill.Content.ToString() == "Stroke")
{
tglBtnStrokeFill.Content = "Fill";
}
else
{
tglBtnStrokeFill.Content = "Stroke";
}

}


Which one of the following classes contains the GetParent()method?

Which one of the following classes contains the GetParent()method?
1.  UIElement
2.  VisualTreeHelper
3.  FrameworkElement

4.  DependencyObject

Solution:
2.  VisualTreeHelper

Sam, the Application Developer at MegaMusic Co. Ltd., has been assigned a task to develop a Windows Store app for playing audio files. As an initial step, he has created the UI of the app, as shown in the following figure.

Problem Statement:

Sam, the Application Developer at MegaMusic Co. Ltd., has been assigned a task to develop a Windows Store app for playing audio files. As an initial step, he has created the UI of the app, as shown in the following figure.

Now, he has to add functionalities to the app so that the users are able to:
Select any of the audio files from the list provided to the users in the Playlist section.
Play or pause the music.
Navigate back and forth in the Playlist section.
Repeat the currently playing song.
Adjust the volume.
Seek to any position in the currently playing song.
In addition, Sam has to ensure that the users are notified about the progress of the currently playing song in the hh:mm:ss format along with the total length of the music file. 

Further, he has to ensure that a thumbnail or video is displayed for the selected music file.
Help Sam to add the preceding functionalities to the app.
Prerequisite: To perform this activity, you need to use the MusicPlayer app that you have created while performing Activity 2.1 in Chapter 2. In addition, the following files are required to complete this activity:
  • Flo_Rida_-_Whistle.mp3
  • Katy.mp3
  • NoThumbnail.PNG

Solution:
To add functionalities to the MusicPlayer app, Sam needs to perform the following tasks:
         Add the song and image files in the project.
Define a class to represent songs.
Add songs to the playlist.
Initialize the controls with the default values.
Add functionality to load the selected song from the playlist.
Add functionality to the Play button.
Add functionality to the Pause button.
Add functionality to the Next button.
         Add functionality to the Previous button.
Add functionality to the song progress slider.
Add functionality to the volume slider.
Add functionality to the repeat song switch.
Execute the app and verify the output.

Peter, the Application Developer at SoftTech Ltd., has been assigned a task to develop a Windows Store app that allows the user to enter his/her name and click the Submit button. Once the user clicks the Submit button, the app should display a greeting message, as shown in the following figure.

Problem Statement:

Peter, the Application Developer at SoftTech Ltd., has been assigned a task to develop a Windows Store app that allows the user to enter his/her name and click the Submit button. Once the user clicks the Submit button, the app should display a greeting message, as shown in the following figure.


Solution:
To create the required app, Peter needs to perform the following tasks:
Create the UI of the app.
  1. Define handler for the click event of the button control.
  2. Associate the handler with the button control.
  3. Verify the created app.

Which one of the following statements represents the correct syntax to associate an event handler with a UI element?

Which one of the following statements represents the correct syntax to associate an event handler with a UI element?
1. <ControlName>.<EventName>+=<EventHandlerName>;
2. <ControlName>(<EventName>)+=<EventHandlerName>;
3. <EventHandlerName>=<ControlName>.<EventName>;

4. <EventHandlerName>=<ControlName>(<EventName>);

Solution:
1. <ControlName>.<EventName>+=<EventHandlerName>;

Which one of the following code snippets will you use to define an event handler for the click event of a button named bttnSubmit?

Which one of the following code snippets will you use to define an event handler for the click event of a button named bttnSubmit?
1. private int bttnSubmit_Click(object sender,
 
RoutedEventArgs e)
2. private void bttnSubmit_Click(ClickEventArgs e,
  object
sender)
3. private void bttnSubmit_Click(object sender,
 
RoutedEventArgs e)

4. private int bttnSubmit_Click(ClickEventArgs, object
  sender
)

Solution:

3. private void bttnSubmit_Click(object sender,
 
RoutedEventArgs e)

Which one of the following controls possesses the ValueChanged event?

Which one of the following controls possesses the ValueChanged event?
1. CheckBox
2. Slider
3. ToggleSwitch

4. Button

Solution:
2. Slider

Which one of the following Panel controls allows you to arrange UI elements in row and column layouts?

Which one of the following Panel controls allows you to arrange UI elements in row and column layouts?
1. Canvas
2. Grid

3. Stack panel

Solution:
2. Grid

Which one of the following progress controls can be used to depict an approximate percentage of completion of an operation?

Which one of the following progress controls can be used to depict an approximate percentage of completion of an operation?
1. Indeterminate progress bar
2. Determinate progress bar

3. Progress ring

Solution:
2. Determinate progress bar