Monday, 24 February 2014

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

Which one of the following properties of the MediaElement control is used to get or set a value that determines whether the media source should again start playing on its own after its end is reached?

Which one of the following properties of the MediaElement control is used to get or set a value that determines whether the media source should again start playing on its own after its end is reached?
1. NaturalDuration
2. AutoPlay
3. IsLooping


4. PosterSource

Solution:
3. IsLooping

Which one of the following selection controls allows users to select a value from a continuous range of values?

Which one of the following selection controls allows users to select a value from a continuous range of values?
1. Slider
2. Toggle switch
3. List box
4. Radio button

Solution:
1. Slider

Which one of the following collection controls allows vertical scrolling?

Which one of the following collection controls allows vertical scrolling?
1. FlipView
2. ListView

3. GridView

Solution:
2. ListView

Which one of the following properties of the TextBox control is used to set the way of breaking a line of text if it extends beyond the available width of the control?

Which one of the following properties of the TextBox control is used to set the way of breaking a line of text if it extends beyond the available width of the control?
1. AcceptsReturn
2. TextWrapping
3. Foreground

4. IsReadOnly

Solution:

2. TextWrapping

Saturday, 22 February 2014

Sam has started learning how to create Windows Store apps. As his first app, he wants to create an app that displays the message, Hello World!!!, on the interface. Help Sam to create the required ap

6). Sam has started learning how to create Windows Store apps. As his first app, he wants to create an app that displays the message, Hello World!!!, on the interface. Help Sam to create the required app.
*      Solution:
*      To create an app that displays the message, Hello World!!!, on the interface, Sam needs to perform the following tasks:
1. Create a new Windows Store app.
2. Design the User Interface (UI).

3. Execute the app and verify the output.

The _________ file provides a set of default styles for your app.

5). The _________ file provides a set of default styles for your app.
1. App.xaml
2. <Project_Name>_TemporaryKey.pfx
3. StandardStyles.xaml
4. MainPage.xaml
*      Solution:

                      3. StandardStyles.xaml

The _________ keyword is used to declare methods that include a call to an asynchronous method

4). The _________ keyword is used to declare methods that include a call to an asynchronous method.
1. async
2. asynchronously
3. asynchronous
*      Solution:

                        1. async

Which one of the following layers of the Windows 8 platform includes the languages in which you can develop an app?

3). Which one of the following layers of the Windows 8 platform includes the languages in which you can develop an app?
1. Model Controller
2. View
3. System Services
*      Solution:

                   1. Model Controller

Which one of the following types of prototyping involves creating a prototype that will not be used to create the final system?

2). Which one of the following types of prototyping involves creating a prototype that will not be used to create the final system?
1.       Throwaway
2.       Evolutionary
3.       Incremental
*      Solution:

*      Throwaway

Which one of the following types of testing involves evaluation of the application by the customer?

1). Which one of the following types of testing involves evaluation of the application by the customer?
1.       Unit testing
2.       Integration testing
3.       System testing
4.       Acceptance testing
*      Solution:

*      Acceptance testing

Saturday, 25 January 2014

C++ Avg code

#include <fstream.h>
void main () {
ifstream f1;
ofstream f2;
f1.open("scores.96");
f2.open("final.96");
int s1, s2, s3;
float w1, w2, w3;
f1 >> s1 >> w1;
f1 >> s2 >> w2;
f1 >> s3 >> w3;
f2 << (s1*w1+s2*w2+s3*w3);
}

Thursday, 10 October 2013

18. Display the total unit price and the total amount collected after selling the products, 774 and 777. In addition, calculate the total amount collected from these two products. (Use the AdventureWorks database)

select productID,sum(UnitPrice) as TotalUnitPrice,sum (LineTotal) as TotalAmount from sales.salesOrderDetail
where productID in (777,774) group by cube(ProductID)

17. Write a query to display a report that contains the Product ID and its availability status in the following format.



The values in the Availability of Product column can be Available or Not Available. (Use the
AdventureWorks database)



select productID,iif(makeflag=1,'Available','NotAvailable') 
as 
AvailabilityOfProduct from Production.product

16. Display the sum of sales amount earned by each sales person and the sum of sales amount earned by the all the salespersons. (Use the AdventureWorks database)

select salesPersonID,sum(salesQuota)
as salesQuota from sales.salespersonQuotaHistory
group by rollup(salesPersonID)

15. Write a query to retrieve the list price of the products where the product price is between $ 360.00 and $ 499.00 and display the price in the following format: The list price of "Product Name" is "Price". (Use the AdventureWorks database)

select 'The list price of'+Name+'is'+ cast(ListPrice as varchar(20)) as ListPrice from Production.Product
where ListPrice BETWEEN 360.00 and 499.00;

14. Display the sales order ID and the maximum and minimum values of the order based on the sales order ID. In addition, ensure that the order amount is greater than $ 5,000. (Use the AdventureWorks database)

select salesorderID,MIN(LineTotal) as 'Minimum',MAX(LineTotal) as Maxinum
from sales.salesorderDeteil
where LineTotal>5000
group by salesorderID

13. Display the total amount collected from the orders for each order date. (Use the AdventureWorks database)

select * from sales.salesOrderDitail
select sum (amount) as 'total' from sales.salesorderdilail
group by date
having date='2001-07-12'

12. Consider the following SQL query containing the ROLLUP operator: SELECT ProductID, LineTotal AS 'Total' FROM Sales.SalesOrderDetail GROUP BY ROLLUP (ProductID) The preceding query generates errors during execution. Identify the possible causes of such errors and rectify? (Use the AdventureWorks database)

select ProductID,sum(LineTotal) as 'Total' from sales.salesorderDetail
Group by productID(productID)

11. Display a report containing the product ID and the total cost of products for the product ID whose total cost is more than $ 10,000. (Use the AdventureWorks database)

select ProductID,sum(LineTotal) as Total from sales.salesorderDetail
Group by productID
Having sum(LineTotal)>10000

10. What will be the output of the following code written to display the total order value for each order? (Use the AdventureWorks database) SELECT SalesOrderID,ProductID,sum(LineTotal) FROM Sales.SalesOrderDetail GROUP BY SalesOrderID

select salesorderID,ProductID,sum(LineTotal) as Total from sales.salesorderDetail
Group by salesorderID,productID

9.Display the maximum, minimum, and the average rate of sales orders. (Use the AdventureWorks database)

select 'Maximum'=MAX(TotalDue),'Mininum'=MIN(TotalDue),'Average'=AVG(TotalDue) from sales.salesorderHeader

8. Display the total value of all the orders put together. (Use the AdventureWorks database)

select 'Total value of the Order'=sum(TotalDue)
from sales.salesOrderHeader

7. Display the Order ID of the top five orders based on the total amount due in the year 2001. (Use the AdventureWorks database)

select Top 5 salesorderId from sales.salesorderHeader
where Datepart(yyyy,orderDate)=2001 order by totalDue desc

6.Display the customer ID, name, and sales person ID for all the stores. According to the requirement, only first 15 letters of the customer name should be displayed. (Use the AdventureWorks database)

select customerID, Name=Left(name,15),salesPersonId from sales.store

5.Display a report containing the sales order ID and the average value of the total amount greater than $ 5,000 in the following format. (Use the AdventureWorks database)



select * from Sales.SalesOrderDetail
select 'sales order ID'= SalesorderID,'Average value'=Avg(lineTotal) from Sales.SalesOrderDetail
Group by SalesOrderID

4. Display the details of all orders in the following format. (Use the AdventureWorks database)



select * from Sales.SalesOrderHeader
select 'Order Number'= salesOrderID,'Total Due'=TotalDue,'Day of order'=DATEPART(DD,OrderDate),'Week day'=DATEPART(DW,orderDate) from Sales.SalesOrderHeader

3. Write a query to display the full name of a person in a column named Person Name. (Use the AdventureWorks database)

select * from Person.Contact
select concat(FirstName,MiddleName,LastName) AS person_Name from Person.Contact

2.Display EmployeeID and HireDate of the employees from the Employee table. The month and the year need to be displayed. (Use the AdventureWorks database)

select * from HumanResources.Employee
select EmployeeID, MONTH=DATENAME(MM,HireDate),YEAR=DATENAME(YY,HireDate)
from HumanResources.Employee

1.Consider the following SQL query: SELECT ProductID, LineTotal AS 'Total' FROM Sales.SalesOrderDetail Group By Cube(LineTotal) Once executed, the preceding query generates errors. Identify the possible causes of such errors and rectify the same. (Use the AdventureWorks database)

select * from Sales.SalesOrderDetail
select productID, SUM (LineTotal) as 'Total' from Sales.SalesOrderDetail
Group by cube (ProductID)

6. Each time the salary slip for an employee is generated, the referral bonus (if present) has to be calculated and printed in the salary slip. The following tables are used for solving the preceding query.

11. Consider the following Purchase_Details table.


Cust_ID and StoreID make the composite primary key in the table. Identify the partial dependency
in the table, if any. How can you remove the partial dependency to attain the next normal form?

10. Consider the following Student table.


The preceding table is in the first normal form. How can this table be converted into the second
normal form?

9. Consider the following Product table.


The preceding table is not normalized. How can this table be converted into the first normal form?

8. New Heights is a training institute that provides courses on various nontechnical subjects, such as personality improvement and foreign languages. Xuan, the Database Designer, has made the following relations to represent the data about students, batches, and modules covered in the batches: STUD-ID: Student's id (unique) NAME: Name of student BATCH-NO: Batch number (one student can belong to only one batch) SLOT: Time and day when the batch of students attends the class MODULE: Module or subject (one batch will do several modules) MARKS: Marks obtained in a module test Xuan now needs to simplify the above relations by normalizing them

Monday, 7 October 2013

Q.5.

select * from [Sales].[SalesOrderDetail]
where [ModifiedDate]='2004-06-06'

Q.4. NIIT SQL LAB@ HOME 2,

select * from [Sales].[SalesOrderDetail]
where [UnitPrice]>2000

Q.3. NIIT SQL LAB@ HOME 2,

select [CustomerID],[AccountNumber] from [Sales].[Customer]
where [TerritoryID]=4

Q.2 .NIIT SQL LAB@ HOME 2,

select * from [Sales].[Customer]

Q.1

select [CreditCardID] as 'Credit CardID',[CardType] as 'Credit Card Type',[CardNumber] as 'Credit Card Number',[ExpYear] as'Expiry Year' from [Sales].[CreditCard]

Display a report that contains the employee ID, login ID, and the title of employees. The report should display the records for 10 employees after excluding the records of the first five employees. (Use the AdventureWorks database)

select top 10 EmployeeID,LoginID,Title from HumanResources.Employee
where EmployeeID not between 1 and 5

Display the different types of credit cards used for purchasing products. (Use the AdventureWorks database)

select distinct CardType from Sales.CreditCard

Display the top three sales persons based on the bonus. (Use the AdventureWorks database)

select top(3) Bonus,SalesPersonID from Sales.SalesPerson

Display the SalesPerson ID, the Territory ID, and the Sales Quota for those sales persons who have been assigned a sales quota. The data should be displayed in the following format. (Use the AdventureWorks database)

select SalesPersonID as 'Sales Person ID',
TerritoryID as 'Territory ID',
SalesQuota as 'Sales Quota' from Sales.SalesPerson

Display all territories whose names begin with 'N'. (Use the AdventureWorks database)


select * from Sales.SalesTerritory
where Name like 'N%'

Display the details of those stores that have Bike in their name. (Use the AdventureWorks database)

select * from Sales.Store
where Name like '%Bike%'