佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1071|回复: 12

拜托各位帮忙解决这张PAPER!!!TQ!

[复制链接]
发表于 6-4-2007 09:04 PM | 显示全部楼层 |阅读模式
我拥有一份paper急需要回答(共3题),希望各位可以帮忙!
拜托各位帮忙解决这张PAPER!!!TQ!

Paper: http://d.turboupload.com/d/1687614/Paper.doc.html

mayee_kitty@hotmail.com  如各位解决的话,请send给我!!!感激!!!
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 6-4-2007 09:08 PM | 显示全部楼层

题目1

Question 1 (Compulsory)

(A)        State the storage-class modifier that allows a variable to be created in one file and used in another file. [1 mark]

(B)        State the type modifier that allow a variable to store only positive values. [1 mark]

(C)  Define a union called TransportType that has the following elements:
-        PrivateCar : Character
-        Bus: Character
-        Train: Character
-        Taxi: Character
-        Bicycle: Character   [2 marks]

(D) Declare a structure called EmpRec consisting of the following elements:
-        EmpNum: 5 characters
-        Name: 30 characters
-        Transport: of Transport above  [2 marks]

(E)        State the output of the following statements:
-        Printf(“%d”, 32|16);                        [1 marks]
-        Printf(“%d”, 32 && 16);                [1 marks]
-        Printf(“%d”, 32>>16);                [1 marks]
-        Printf(“%d”, ~(32));                        [1 marks]
-        Printf(“%d”, ((32%4)-4));        [1 marks]

(F)        Given the following declaration:
Float *unknown_var;
Explain what kind of value unknown_var store and what is the purpose of this value [2 marks]

(G) (i) Given the following function:

Int MullBy5 (int num)
{
Return num*5;
}
Is the above function passing by Value or Passing by Reference? [1 mark]

(ii) Write a procedure that has same effect as the above function, except  that on exit, instead of returning the value, the result is passed back as the functions parameter. [2 marks]

(iii) Give the name for the type of parameter used in the above procedure. [1 mark]

(H) Is there a data type called string in C? Describe briefly how a string can be created in C. [2 marks]

(I) Write a function EncryptStr that take in a string parameters str, a integer parameter pos. The function EncryptStr changes all characters in str to the next pos characters. For Example, Encrypt (‘Hello’, 2) returns ‘jgnnq’

(J) (i) Write a recursive function MulMinMax that take in 3 value integer parameters min, max, and nextnum and return the product from min to max increasing min by nextnum up to and including max. For Example, MulMinMax(2, 10, 3) returns 80 (2x5x8).

The function header is given as

intMulMinMax (int min, int max, int nextnum)

(ii) Rewrite your solution to the above question, such that the parameters are passed in by reference, and the solution, which should be calculated iteractively, passed back as the first parameter. [3 marks]
回复

使用道具 举报

 楼主| 发表于 6-4-2007 09:10 PM | 显示全部楼层

题目2

(Question 2)

(A) Explain the difference between pass by value and pass by reference.  [1 mark]

(B) Explain the difference between iteration and recursion                [1 mark]

(C) Give an example where it may be preferable to choose either an iterative or recursive solution to a problem. Justify your answer.                [2 marks]

(D)  (i) What is wrong with the following function?

Int somethingwrong (int n)
{
        If (n == 1)
return 1;
return n * somethingwrong(n)                [1 mark]
}

(ii) How do we solve the above problem?                [1 mark]
(E) Write a procedure, called SumDiff, which takes in two references to floating point integers, a and b. On exit, a should refer to the difference between the two initial parameters, and b should refer to the sum of the two parameters.                [4 marks]

(F) Write procedure, called FibArray, which takes in a reference to an integer array, and an integer specifying the length of the array. Assuming the first element of the array is set to 0, and the second to 1, each subsequent element of the array should be set to the sum of the previous two elements. For example, the third element of the array would be (0+1)=1. You should assume that the array contains at least three elements, and you should not changes the first two. [5 marks]
回复

使用道具 举报

 楼主| 发表于 6-4-2007 09:11 PM | 显示全部楼层

题目3

(Question 3)

(A) BookWorm is a bookshop. Its owner Steve News asks you to develop an application to track his books.

BookWorm labls each of its books with an internal code. Create a structure called BWCodeType that stores the following information:

Category : a 2-character category type (like SF-Science Fiction, HR- Horros, etc)
ID: a10-digit number (you are not to store it as 10-character string)                [2 marks]

(B) What is the benefit of defining data interm of structures?                                [1 marks]
(C)Create a structure called BookRec that stroes the following information:
-        Title : can store up to a maximum of 100 characters
-        Author : can store up to a maximum of 100 characters
-        ISBN : 10-digit number (you are not to store as characters)
-        Publisher : can store up to a maximum of 50 characters
-        Price : floating point number
-        Code : of BWCodeType above         [4 marks]

(D) Declare an array called BWArray that can store up to 10000 BookRec records  [1 mark]

(E) What is the problem of a program that manipulate (create, update or delete)records in an array only.        [1 mark]

(F) What is the solution for the above problem?                [1 mark]

(G) Write a function called FindBookUsingISBN that take in BWArray array, an integer parameter NumOfBooks which holds the number of books information n the shop and ISBNinput (the ISBN number needed to find the book). The function should display the title, Author, Publisher, Price and Code of the book.         [5 marks]
回复

使用道具 举报

 楼主| 发表于 8-4-2007 03:08 PM | 显示全部楼层
没有人帮忙吗?拜托各位!!!
回复

使用道具 举报

发表于 8-4-2007 05:50 PM | 显示全部楼层
你在期待这边的人帮你做功课吗?
回复

使用道具 举报

Follow Us
 楼主| 发表于 9-4-2007 11:14 AM | 显示全部楼层

回复 #6 tensaix2j 的帖子

这是很多年前的习题,我需要答案来了解与预备!
回复

使用道具 举报

发表于 9-4-2007 08:43 PM | 显示全部楼层
先写出你的做的给我们看
回复

使用道具 举报


ADVERTISEMENT

发表于 10-4-2007 01:27 PM | 显示全部楼层
原帖由 糯米鸡 于 9-4-2007 08:43 PM 发表
先写出你的做的给我们看


对对..自己尝试做做先..
回复

使用道具 举报

 楼主| 发表于 12-4-2007 01:02 PM | 显示全部楼层
1)extern 2)static
1C) union Transport
{
      char ... ;
      char ... ;
      char ... ;
      char ... ;
      char ... ;
}

1D) struct EmpRec
    {
      char EmpNum [5];
      char Name[30];
      struct TransportType Transport;
    }
回复

使用道具 举报

 楼主| 发表于 12-4-2007 01:07 PM | 显示全部楼层
1E) 48,1,31,-4
1f)floating point number,decimal point, capture the fractional of the calculation
1g)(i)passing by value
(ii)void MulBy5 (int *num)
   { *num (*num *5);
   }
回复

使用道具 举报

发表于 14-4-2007 02:14 AM | 显示全部楼层
你自己都会做嘛。。。
只是1B,我可能会放unsigned..
回复

使用道具 举报

 楼主| 发表于 14-4-2007 11:13 AM | 显示全部楼层
因为我不懂我的是否完全正确....所以需要你们的来参考!!

还有就是,(1i)(1j)我不会做勒...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 7-9-2025 07:19 AM , Processed in 0.131105 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表