Networking Chapter 10 1 Provide at least three rules that should be followed when naming variables in C

subject Type Homework Help
subject Pages 7
subject Words 1288
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
CHAPTER 10: DEVELOPING UNIX/LINUX APPLICATIONS IN C AND C++
TRUE/FALSE
1. The C language was partly developed to resolve the more lengthy requirements of assembly language.
2. Dennis Ritchie and Brian Kernighan rewrote most of UNIX using C++ in the early 1960s.
3. C can be described as a language that uses relatively short, isolated functions to break down large,
complex tasks into small and easily resolved subtasks.
4. A variable’s data type determines the upper and lower limits of its range of values.
5. The word “null” is used to indicate that a function returns no data.
6. fgetch() reads a single character from the file and points to it.
7. Unlike many other library input functions, readf() can be used to input values of a variety of data
types.
8. C++ uses // to denote a comment line.
MULTIPLE CHOICE
1. ____ is the language in which UNIX was developed and refined.
a.
C
c.
Perl
b.
C++
d.
Awk
2. The original UNIX operating system was written in ____.
a.
C
c.
assembly language
b.
C++
d.
Awk
page-pf2
3. ____ is a low-level language that provides maximum access to all the computer’s devices, both
internal and external.
a.
C
c.
Assembly language
b.
C++
d.
Awk
4. The source code of a C program file is stored in a file with the ____ extension.
a.
.C
c.
.gc
b.
.c
d.
.src
5. A compiler is a program that translates the source code into ____ code, which consists of binary
instructions.
a.
compiled
c.
binary
b.
binary
d.
object
6. The output of a linker is a(n) ____ file.
a.
executable
c.
object
b.
binary
d.
source code
7. ____ have special meanings, so you cannot use them as names for variables or functions.
a.
Labels
c.
Constants
b.
Tags
d.
Keywords
8. The ____ data type occupies a single byte.
a.
char
c.
float
b.
int
d.
double
9. You can use three modifiers with int data types: short, long, and ____.
a.
scalar
c.
array
b.
unsigned
d.
double
10. When you represent character data in a program as a character constant, you enclose the character in
____.
a.
curly braces
c.
single quotation marks
b.
angle braces
d.
double quotation marks
11. A(n) ____ is a group of characters, such as a name.
a.
array
c.
scalar
b.
string
d.
hash
page-pf3
12. When you use string constants in your C program, they must be enclosed in ____.
a.
curly braces
c.
single quotation marks
b.
angle braces
d.
double quotation marks
13. ____ is an example of how you can declare a string in C.
a.
string name;
c.
String name;
b.
string name[20];
d.
char name[20];
14. The ____ of a variable is the part of the program in which the variable is defined and, therefore,
accessible.
a.
aim
c.
length
b.
reach
d.
scope
15. Variables that are declared inside a function are called ____ variables.
a.
global
c.
scalar
b.
automatic
d.
independent
16. Automatic variables are ____ to the function in which they are declared.
a.
global
c.
local
b.
assigned
d.
unique
17. C’s increment operator is ____.
a.
++
c.
+=
b.
+
d.
=+
18. The decrement operator is a(n) ____ operator.
a.
unary
c.
primary
b.
binary
d.
arbitrary
19. The ____ format specifier is used to denote a signed decimal integer.
a.
%c
c.
%f
b.
%d
d.
%s
20. The ____ format specifier is used to denote a floating point number in decimal notation.
a.
%c
c.
%u
b.
%d
d.
%f
21. C provides three looping mechanisms: the for loop, the while loop, and the ____ loop.
a.
do-while
c.
while-do
page-pf4
b.
switch
d.
repeat-until
22. ____ are continuous streams of data.
a.
Arrays
c.
Files
b.
Strings
d.
Pointers
23. The ____ utility tracks what needs to be recompiled by using the time stamp field for each source file.
a.
compile
c.
configure
b.
gcc
d.
make
24. The ____ scanf() format specifier is used to indicate that scanf() should interpret the input value as a
pointer.
a.
%p
c.
%r
b.
%P
d.
%R
COMPLETION
1. A C program consists of separate bodies of code, known as ____________________.
2. Many compilers translate source code into assembly code. This requires that a(n)
____________________ be called up to translate the assembly code into object code.
3. C’s ____________________ header file contains information the compiler needs to process standard
input or output statements.
4. ____________________ are names given to variables and functions.
5. When you ____________________ a function, you declare the function’s name and create the lines of
code that make up the function’s block of code.
page-pf5
6. C++ enables function ____________________, which makes the functions respond to more than one
set of criteria and conditions.
MATCHING
Match each item with a statement below.
a.
main()
f.
stdio.h
b.
a.out
g.
{
c.
null
h.
gcc
d.
%
i.
#include <stdio.h>
e.
/*
1. executable file which, by default, contains a compiled C program
2. every C program must contain this function
3. denotes the beginning of a block of code
4. denotes the beginning of a comment
5. is a preprocessor directive
6. is a header file
7. a single byte in which all bits are set to zero
8. modulus operator
9. command for the C compiler in Linux operating systems
SHORT ANSWER
1. What is a daemon?
2. What is a source code file?
page-pf6
3. What is the role of the C preprocessor?
4. What is the role of a linker program?
5. What does the C library contain?
6. Provide at least three rules that should be followed when naming variables in C.
7. What is the scope of a global variable?
8. What is the role of the control string in the printf() function?
page-pf7
9. What is the role of the if statement?
10. What is the difference between the while loop and the do-while loop?
11. What is the role of a function prototype?
12. What is an object?

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.