Thursday, October 23, 2014

Question of Computer Science part1

Answer the question below

1. >> A = Magic (5)
A = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9
a. >> A(________)
ans = 17 24 1 8 15
b. >> A(________)
ans = 1 7 13 19 25
c. >> A(________)
ans = 5 7 6 13
c. >> A(________)
ans = 5 7 16 6 13 22 18 25 9

2. Code speed up the Computation

for i = 1:100
for j = 1:200 B = sqrt(i^2+j^2); A(i,j) = B end end

3. A function called "DayofWeek" to return the day label from Monday to Sunday when users enter a number in range 1 to 7. For example, if users enter "1" or "7" the program could return "Monday" or "Thursday" respectively

4. Write a program to create 2 dimension animation of sine(y=sin(2ΠΧ)) from left to right?

5. Discribe Command(s)/ function(s)

a. >> uicontrol
b. >> answer = inputdlg({'What is your Name?,...
'What is your Occuption?'}) b. >> list = {'Ant', 'Bat', 'Cat'};
>> s = listdlg('liststring', list) b. >> answer = questdlg({'What is your favorite color?',...
'personal data: 'Red', 'Green', 'Blue', 'Green')

6. Given linear equation system following

3*x+2*y-z = 10
2*x-y+2*z = 8
x+2*y+2*z = 12
Solve the Equation to calculate the values of X, Y and Z by using Mupad
a. solve(_______)
{[x = 8/3, y = 20/9, z = 22/9]} b. A:=Matrix(_______)
Image coming soon c. B:=Matrix(_______)
Image coming soon d. X:=________
Image coming soon

next QUESTIONS Part 2

No comments:

Post a Comment