Thursday, October 23, 2014

Question of Computer Science part2

No comments:

7. Describe the program (code) segment, resulting in the above figure
Program Segment

>> x = 0:.1:2*pi; >> y = sin(x); >> plot (x,y, '--rs')

8. >> pie([1 .2 5 2 3],[1 0 0 1 0],{'a','b','c','d','e'}
9. >> ezcontour('sqrt(x^2+y^2)')
10.
>> angle = 0:.01:2*pi;
>> radius = sin(6*angle)+pi;
>> polar (angle, radius)
11.
>> x= 0:.1:2*pi;
>> y1= sin(x)
>> y2= cos(x)
>> plot (x,y1)
>> hold on
>> plot(x,y2,'r')
>> hold off
12.
>> sphere
>> daspect([1 1 1])
>> alpha (.5)

13. Given a circle with one unit radius contained inside a square such that the circle's circumference touch sides of the square. Write a script in MATLAB to calculate the proportion of the area of circle and area of the square by using Monte Carlo Simulation

14. Problem number 13, write a MATLAB program using GUIDE consisting of Menu Bar; Context Menu and GUI Window-based Toolbox to calculate the proportion of circle and square area using Monte Carlo Simulation

END OF QUESTIONS
Read More

Question of Computer Science part1

No comments:
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
Read More

Saturday, October 11, 2014

AI. informed search

No comments:
Note: Course was conduct at Khon Kaen University
Lecturer : Assoc.Prof.Dr.Sartra Wongthanawasu
September 23th 2014

Informed Search

Informed search is often referred toHeuristic Search. This algorithm searching use specific knowledge to the problems, this method able to find solutions more efficient than Uninformed strategy

Read More

Artificial Intelligence

No comments:

Question and Assignment

The Flashlight Puzzle

Four people are on one side of a bridge. They wish to cross to the other side, but the bridge can only take the weight of two people at a time. It is dark and they only have one flashlight, so they must share it in order to cross the bridge. Assuming each person moves at a different speed (able to cross in 1, 2, 5 and 10 minutes, respectively), find a series of crossings that gets all four across in the minimal amount of time.

Solution

the point of this question is to find the fastest way to take 4 people to the other side of bridge
A : 1 minute
B : 2 minutes
C : 5 minutes
D : 10 minutes

A and B across the bridge 2 minutes
B bring back the flashlight 2 minutes
C and D across the bridge 10 minutes
A bring back the flashlight 1 minutes
A and B travel over 2 minutes
total 17 minutes

Code implementation using DrSceme

State representation must identify the locations of each person and the flashlight
((1 2 5 10) left ())
note : must be careful of permutations/ pertukaran urutan
e.g., (1 2 5 10) = (1 5 2 10) so must make sure there only one representation per set
Solution : maintain the list in sorted order, so only one permutation is possible
only 3 possible moves:
1. if the flashlight is on left and only 1 person on left, then
move that person to the right (cost is time it takes for that person)
2. if flashlight is on left and at least 2 people on left, then
select 2 people from left and move them to right (cost is max time of the two)
3. if the flashlight is on right, then
select a person from right and move them to left (cost is time for that person)
Heuristic:
H: number of people in wrong place

bla bla

Read More

Tuesday, October 7, 2014

Web. Design tech. (question & answer)

No comments:

Part 1


Note: below questions based on course for the subject "Web Design Technology"
Conduct at khon kaen university 2014

1. Whar is Html?
HTML stand for hypertext markup language, that lets you identify common sections of a Web page

2. Write structure of a basic web page?
answer

3. What is head section?
the container for all of the descriptive information about the document

4. How the way Browser display Html?
  • The browser interprets the HTML markup elements and displays the results, hiding the actual markup from the user
  • Each browser interprets HTML in its own way, based on its rendering enginebased on its rendering engine
  • It is essential that you test your work in different Web browsers

4. Write sort story about the Past HTML?
Tim Berners-Lee first proposed HTML at the European Laboratory for Particle Physics (CERN) in 1989

5. What is organitation which sets standars for HTML and other markup languages
World Web Consortium (W3C)

6. What is XML
XML stand for Extensible Markup Languages, it's essentiail to creating applications for the Web

7. 6 XML syntax rules
  • Documents must be well-formed
  • All tags must net properly and not overlap
  • Use all lowercase for element names
  • Always use closing tags
  • Empety elements are signified by a closing slash
  • Attribute values must be continued in quotation marks

8. 3 problem of using XHTML?

1. Relaxed syntax rules still must be applied because of legacy code 2. Newer versions of XHTML moved too far away from existing Web development 3. XHTML was not well received by the development community

9. What is WHATWG?
Web Hypertext Application Technology Working goup the one that purpose HTML 5

10. 2 types of HTML 5 syntax?
An HTML compatible syntax > more relaxed syntax, Code shortcut allowed
An XML compatible syntax > Consistent with XHTML, Uses XML syntax rules
Read More

7 Set Question of "COMPUTER ARCHITECTURE"

No comments:
1. Simplify the following expressions in (1) sum-of-producs formand (2) Product-of-sums form.
    x'z'+y'z'+yz'+xy

2. The width of the bus is 2 bits, calculate
  • Size of the register
  • How many multiplexer that must be used for the bus construction? How many input leg output log for a multiplexer
  • How many Decoder that must be used for the bus construction? How many input leg output log for a multiplexer
  • Draw the diagram showing the connection between all the device

3. Explain and draw the block of diagram bus Transfer of the basic computer below
  • The bus selected 2 devices source and destination
  • Selected device give the data to the bus (Bus < Reg)
  • Selected device destination recieved
Destination Received
S2 S1 S0 Source Device
0 0 0 no selection
0 0 1 AR
0 1 0 PC
0 1 1 DR
1 0 0 AC
1 0 1 IR
1 1 0 TR
1 1 1 Memory

4. Construct the Arithmetic circuit which work as in the given functions in the table below, all the information will be used for the circuit construction
Draw your Arithmetic circuit
S1 S0 cin y output Microoperation
- - - - D=A+Bi Subtract with borrow
- - - - D=A+Bi+1 Subtract
- - - - D=A+B Add
- - - - D=A+B+1 Add with carry
- - - - D=A+1 Increment A
- - - - D=A Transfer A
- - - - D=A-1 Decrement A

5. figure image below
  • How many conditions that effect to the Data Register? list all of them
  • How many conditions for loading data into DR? list all of them
  • How many conditions for Increment data into DR? list all of them
  • How many conditions for clearing data DR? list all of them
  • Draw the logic diagram for control signals of the DR

6. Image figure below
  • How many conditions For E Register? list all of them
  • What is the equation for log J of the flip flop?
  • What is the equation for log K of the flip flop?
  • Draw the diagram for generating the control signals for E register using the following figure

7. Construct the diagram for controlling the selection of the common bus when the memory is selected as the source
X1 X2 X3 X4 X5 X6 X7 S2 S1 S0 Selected register
- - - - - - - - - - None
- - - - - - - - - - AR
- - - - - - - - - - PC
- - - - - - - - - - DR
- - - - - - - - - - AC
- - - - - - - - - - TR
- - - - - - - - - - TR
- - - - - - - - - - Memory
Set of the basic computer instruction
  • The list of machine code is for and addition of two number
  • Translate the binary machine code to the equivalent hexadecimal
  • Show the list code using OP.code symbol and explain the action of the OP.code
  • What is the final result of the execution
Read More