- 浏览: 621920 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
oldrat:
引用Special cases aren't special ...
武汉大学开源技术俱乐部 技术交流 第1期 -
yzsunlight:
试了试 ,不行
Android Studio SDK Manager无法正常下载如何设置 -
qianjigui:
更全面的文档:http://www.5wpc.info/it/ ...
Ruby正则表达式操作参考 -
qianjigui:
Anddy 写道Anddy 写道tag是自动创建的吗? 能手动 ...
vim的跳转 -
Anddy:
Anddy 写道tag是自动创建的吗? 能手动创建吗? 在sh ...
vim的跳转
这个题目和Exercise02 没什么区别,在这里把我的解答给出来,就不再赘述了。
Introduction
The purpose of this assignment is to become more familiar with bit-level representations and manipulations. As with the Data Lab, you'll do this by solving a small number of programming "puzzles."
Getting Started
Download and unzip dlabp-handout.zip to a directory in which you plan to do your work. This will cause the following files to be unpacked into the directory:
bits.c | The data puzzles that you will solve. This is the file you will be modifying and handing in. |
dlabp.vcproj
|
Project file |
README | Helpful information about the lab |
btest.c
btest.h decl.c test.c getopt.c bits.h getopt.h tailor.h |
The test driver and its helper files |
Open the dlabp.vcproj workspace from VC++ and you are ready to begin solving your puzzles. You can add this project to a pre-existing (or new) VC++.Net Solution
Your Task
The only file you will be modifying and turning in is bits.c . Looking at bits.c you'll notice a C structure called info into which you should insert your name and login ID. Do this right away so you don't forget, as the driver will not run without it.
The bits.c file also contains a skeleton for each of the 4 programming puzzles. As before, your assignment is to complete each function skeleton using only straightline code (i.e., no loops or conditionals) and a limited number of C arithmetic and logical operators. Specifically, you are only allowed to use the following eight operators:
! ~ & ^ | + << >>
A few of the functions further restrict this list. See the comments in bits.c for detailed rules and a discussion of the desired coding style.
The enclosed dlabp.vcproj project will help you compile your bits.c file, along with the other helper functions, and link them all together to form the executable driver program btest.exe . The btest.exe driver program allows you to evaluate the functional correctness of your code. Every time you modify one of the puzzles in bits.c , you can check its correctness by rebuilding and rerunning btest.exe .
Puzzles
The following table describes the 4 puzzles that you will be solving in bits.c . The ``Rating'' field gives the difficulty rating (the number of points) for the puzzle, and the ``Max ops'' field gives the maximum number of operators you are allowed to use to implement each function.
Name | Description | Rating | Max Ops |
tmin() | Returns the minimum two's complement integer | 1 | 4 |
minusFive() | Returns the integer value -5 | 1 | 4 |
copyLSB(x) | Sets all bits of result to least significant bit of x | 2 | 5 |
getBit(x, n) | Extract bit n from word x | 2 | 4 |
See the bits.c file for examples of the results returned by these functions.
Evaluation
Your score will be computed out of a maximum of 12 points based on the following distribution:
6 | Correctness of code as reported by
btest.exe
(no credit for a puzzle if your instructor determines that you have used an illegal operator). |
4 | Performance of code, based on number of operators used in each function (maximum of 1 point per puzzle). |
2 | Style points, based on your instructor's subjective evaluation of the quality of your solutions and your comments. |
The puzzles you must solve have been given a difficulty rating between 1 and 2, such that their weighted sum totals to 6. Your instructor will evaluate your functions using the same btest.exe driver that you are using. You will get full credit for a puzzle if it passes all of the tests performed by btest.exe , half credit if it fails one test, and no credit otherwise. You receive no credit if you use an illegal operator for your solution, so pay close attention to the list of allowed operators for each puzzle in bits.c .
As before, we've established a maximum number of operators that you are allowed to use for each function. You will receive one point for each function that satisfies the operator limit.
Finally, we've reserved two points for a subjective evaluation of the style of your solutions and your commenting. Your solutions should be as clean and straightforward as possible. Your comments should be informative, but they need not be extensive.
Advice
- Read the file README for information on running the btest.exe program.
- You'll find it helpful to work through the functions one at a time, testing each one as you go. You can use the -f flag to instruct btest.exe to test only a single function. For example, "btest.exe -f bitAnd ".
- The "-g " flag is very handy for producing a concise summary of your correctness results. For example, "btest -g ".
- btest.exe is a console application, so you'll need to run it from the Windows command line. On a Windows 2000 system, you can find this at "Start->Accessories->Command Prompt". If you try to run it using "Start->Run.." instead, you won't see any of the output.
Hand In Instructions
Before submitting your solution:
- Make sure you have included your identifying information in your file bits.c .
- Remove any extraneous print statements that you might have included for debugging.
- dlabp-handout.zip (19.4 KB)
- 下载次数: 11
- bits.c.zip (1.8 KB)
- 描述: 我的解答,没做测试
- 下载次数: 34
发表评论
-
Ruby 2.1 GC策略
2014-01-23 11:30 947对象管理主要涉及: Profiling support ... -
Google 持续集成介绍
2014-01-23 11:26 1563见附件PPT. 具体方案 构建描述 依赖分析 ... -
函数式编程 读后感
2013-12-30 15:24 1452一篇比较不错的文章: http://coolshel ... -
系统模块集成管理与版本控制学习
2013-12-27 12:01 1333论软件生命周期集成 http://www.infoq.com ... -
Ruby 动态特性鉴赏
2013-12-26 16:47 1334以下代码与代码学习来自<Ruby Best Prac ... -
Android应用插件化与动态部署 学习
2013-12-26 16:45 0通过REST将相关服务有语义的组合起来。 动态部署: ... -
用Markdown做文档的问题
2013-12-23 18:06 862一直有想一种语言能够解决文档编写问题。 一般文档编写 ... -
Android组件、通信与安全机制学习
2013-12-20 12:26 0现有问题: Android的组件间通信有哪些方法?其中的I ... -
Android root 原理学习
2013-12-15 23:51 2328学习资源: http://www.zhihu.com/qu ... -
global + Ruby
2012-11-16 13:07 1281http://simple-and-basic.com/200 ... -
Linux pthread线程同步相关的API学习
2012-11-12 18:43 1468原因 最近在深入理解Dalvik虚拟机的内部线程控制体系,其 ... -
MMTk代码学习(系统结构与流程)
2012-11-06 19:08 1650MMTk的整体结构和驱动模型主要由Plan, Collecto ... -
MMTk代码学习(RVM接口)
2012-11-06 14:52 1558前导 MMTk被RVM整个封装在后端,主要调用接口是 org ... -
MMTk代码学习(整体结构)
2012-11-05 17:03 2455必要的整体模块 对于一个完整的内存管理工具,主要涉及: ... -
嵌入式Java虚拟机 GC特性一览
2012-10-31 15:53 1297嵌入式Java虚拟机列表来源:http://en.wikipe ... -
Memory Analysis Tool OQL 用例汇总及语法学习
2012-10-28 16:36 2163典型用例 获取所有对象: SELECT * FROM $ ... -
Memory Analysis Tool 使用相关材料整理
2012-10-28 10:47 2008利用MAT分析问题 从转储(Dump)文件中调试并除错 ... -
手机设备操作系统架构图整理
2012-10-28 10:28 1537整体分析材料 Android,ChromeOS, WebO ... -
MMTk特性认识
2012-10-25 16:24 1761整体介绍 MMTk是一个内存管理的工具包 ,同时也是jik ... -
JavaScript V8 引擎相关资料
2012-10-25 14:54 1115V8 Javascript engine之所以快 针 ...
相关推荐
【SSD06 实践小测 2 个人解答】主要涵盖了两个关键知识点:源码分析和工具使用。在这个实践小测中,作者通过撰写博客(博文链接:https://qianjigui.iteye.com/blog/282718)分享了解答过程,这些内容可能涉及编程...
ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5
ssd3 practical quiz 3ssd3 practical quiz 3ssd3 practical quiz 3ssd3 practical quiz 3ssd3 practical quiz 3ssd3 practical quiz 3ssd3 practical quiz 3
ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8
SSD3,全称为“Solid State Drives 3”,通常是指...以上就是关于SSD3的一些关键知识点,对于解答"Practical Quiz 7"会有很大帮助。了解并掌握这些内容,不仅能够应对考试,还能在实际工作中更好地理解和应用SSD3技术。
ssd3 practical quiz 1ssd3 practical quiz 1ssd3 practical quiz 1ssd3 practical quiz 1ssd3 practical quiz 1 ssd3 practical quiz 1
【SSD04 实践测试4 个人解答】 在本次实践测试4中,我们主要探讨了与源码理解和工具使用相关的知识。通过个人的解答,我们可以深入理解这些关键概念,并提高在实际开发中的应用能力。以下是对每个部分的详细解析: ...
ssd3 practical quiz 2ssd3 practical quiz 2ssd3 practical quiz 2ssd3 practical quiz 2ssd3 practical quiz 2ssd3 practical quiz 2ssd3 practical quiz 2ssd3 practical quiz 2
标题"SSD04 Practical Quiz 1 个人解答"指的是一个实践测试,可能来自某个课程或培训计划,编号为SSD04的第1个实践环节。这个测试旨在检验参与者对于特定技术或概念的理解和应用能力。 描述中提到的“我的解答”...
【标题】"ssd3 practical quiz2"是一个与软件工程相关的实践测验,可能是课程"Software System Development 3"(SSD3)的一部分。这个测验可能涉及了软件开发过程中的实际操作和问题解决,旨在检验学生在项目管理和...
ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5ssd3 practical quiz 5
SSD3 Practical Quiz8 2009 StudentArrayList.java
"ssd3 practical quiz6"很可能是某个教育课程或培训项目的一部分,旨在测试或提升学员对SSD技术及其应用的理解。 在这个2007年的卡耐基软件工程网络教材中,"ssd3"可能指的是课程的序列号或者级别,暗示这已经是...
这个"practical quiz 7"是该课程中的第七次实践测验,旨在测试学生对SSD3理论知识的理解以及在实际操作中的应用。由于没有提供具体的文件内容,我将根据SSD3可能涵盖的主题来生成相关的知识点。 1. **固态存储基础*...
【标题】"ssd3 practical quiz4" 是一个与软件工程相关的实践测验,很可能源自2007年卡耐基梅隆大学的课程。这个测验可能旨在检验学生对软件开发过程、软件设计原则、编程技能以及项目管理的理解。 【描述】提及的...
【标题】:“ssd3 practical quiz8”是一个关于软件工程的实践测验,可能是课程“Software System Development 3”的第八次实践考核。这个标题暗示我们将探讨与软件开发过程中的实践问题相关的知识,可能涵盖编程、...
ssd4 practical Quiz1 PrQ1 ssd4 practical Quiz1 PrQ1 ssd4 practical Quiz1 PrQ1 ssd4 practical Quiz1 PrQ1