5/20/2013

DCT 1063 Programming 2

DCT1063 ASSIGNMENT 1

1. Answer each of the following.   Each part of question should use the result of previous part where appropriate. [18 marks]

a) Declare an array of type integer called markah with 10 elements, and initialize the element to the values 1,2,3,4,5,6,7,8,9,10,  [2 marks]


b) Declare a pointer Ptr that points to an object of type integer.[2 marks]


c) Print the element of array numbers using array subscript notation. Use looping structure (for/while/do..while) and assume the integer control variable i has been declared. [5 marks]


d) Assign the starting address of array numbers to the pointer variable Ptr.[2 marks]


e) Print the element of array numbers using pointer with the pointer Ptr. Use looping structure (for/while/do..while) and assume the integer control variable i has been declared.[5 marks]


f) Assuming that Ptr points to the beginning of array numbers, what address is referenced by nPtr + 2 (assumed that the address for nPtr + 0 is 1000) ? What value is stored at that location?[2 marks]

2. Write a program that counts the total number of vowels in a sentence. Output the frequency of each vowel.

For example:
Input: TATIUC Teluk Kalong
Output: A : 2
E : 1
I : 1
O : 1
U : 2



DCT1063 ASSIGNMENT 2

1. A file is opened by linking it to a stream. ( T / F )
2. There are three types of streams:  Input, Output and Input/output ( T / F )
3. To open an input stream, you must declare the stream to be of class ofstream. ( T / F )
4. The header defines several important classes and values for File Input and File Output. ( T / F )
5. To close a file, use the member function close( ). ( T / F )


2.  Assume that each of the following statements applies to the same program. ( 10 marks)

a) Write a program that prompts  user to enter:-

I. Name
II. Matric
III. Course
IV. CPA

b) Read the data above (a) and write into a file named student.txt as follows.

Name : Ahmad Ashraaf
Matric: 09A04035
Course: CIS
CPA: 3.6

3. Write a program that reads student.txt  (as created in 3 b), display its content to screen. (10 Marks)


5/19/2013

DCT1063 Programming 2 Pointer

Show output of the following program (Passing Arguments to Functions by value and Passing Arguments to Functions by Reference with Pointers )




5/18/2013

BCS1333 OS Jawapan Quiz 1 dan Quiz 2


QUIZ 1 -Solution

1.The service provided by an Operating System can be divided into two main categories. Briefly describe the two categories and discuss how they differ.

The service provided by an Operating System can be divided into two main categories, first services is for ease user such as user interface, program execution and I/O operations. The second services is for ensuring the efficient operation of the system itself such as resources allocation, accounting and protection.

2. List five services provided by an Operating System that are designed to make it more convenient for users to use computer system.

a)user interface,
b)program execution,
c)I/O operations,
d)File-system manipulation,
e)Communications



3.Describe the three general methods for passing parameters to the Operating System.

a) Simplest: pass the parameters in registers
b) Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register
c) Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system


4.What are the five major activities of an Operating System with regards to file management?

a)Create, b) delete, c) copy, d)rename, e)print, f)dump, e)list

Quiz 2 - Solution 

1) Which one is not one of the Scheduling algorithms mentioned earlier.
a) First-Come First-Serve
b) Round Bear
c) Shortest Job First

2) Using the FCFS algorithm, which process is allocated the CPU first?
a) The process that requests the CPU first.
b) The process that requests the CPU last.
c) Processes are allocated the CPU randomly.

3) Using the SJF algorithm, which process is allocated the CPU first?
a) The process that requests the CPU first.
b) The process that requests the CPU last.
c) The process with the smallest CPU execution time.

4) The SJF algorithm is not fair for which type of job?
a) Small jobs.
b) Any size job.
c) Large jobs.

5) Four processes are arrived at time 0, with the length of the CPU burst given in milliseconds:

Process           Burst Time                   * Priority
P1                                10                              3
P2                                5                                 1
P3                                7                                 3
P4                                10                               2

*smaller priority number implies a higher priority
Table1 List of processes that are arrived at time 0

  The processes are assumed to have arrives in order P1,P2,P3,P4 all at time 0.

I.                    Draw two (2) Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS and Priority.



















    II.          What is the waiting time of each process of the scheduling algorithms in part I?

Average waiting time for first come first serve = (0+10+15+22)/4
= 11.8

Average waiting time for Priority = (0+5+15+25) /4
=11.3


III.          Which of the algorithms in part II. results in the minimum average waiting time (over all processes)?

Priority Scheduling shows the most minumum average waiting time (11.3).

5/11/2013

BCS1333 OS Latihan Untuk Chapter 10 dan 15



Chapter 10 File System

    Consider a file system where a file can be deleted and its disk space Reclaimed while links to that file still exist. What problems may occur if a new file is created in the same storage area or with the same absolute path name? How can these problems be avoided?
a     
Chapter 15 Security
 
 A password may become known to other users in a variety of ways. Is there a simple method for detecting that such an event has occurred? Explain your answer.


a    The list of all passwords is kept within the operating system. Thus, if a user manages to read this list, password protection is no longer provided. Suggest a scheme that will avoid this problem. 


 Student may found the on Google since its a 'popular' question in OS.
Good Luck





Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...