CH 10 Review Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following are examples of data types in the C language?

int, double, float

Which of the following are important characteristics of C++ programming?

object-oriented programming and c. use of classes for specialized programming needs

Your program to calculate values in physics requires working with positive and negative whole numbers between -14,242 and 12,528. What data types would you use to work with these numbers in a C program?

short int

A daemon is a _

specialized system process that runs in the background

Which of the following functions is used to open a file in the C language?

fopen()

Which of the following is the right way to use the string constant, Enter your ID:, in the C language?

"Enter your ID:"

Which of the following is an acceptable way to insert a comment line in a C++ program? (Choose all that apply.)

// Program Name: calc.C

A new programmer whom you are training is writing a C program and he wants to place comment lines in the program. Which of the following characters should be used at the beginning and end of the comments?

Use /* at the beginning of the comments and */ at the end.

Which of the following is in the proper format for a character constant?

'C' and 'c'

Your C++ program needs to access the system date in different ways. Which of the following enables you to do this?

<ctime> library

What is an automatic variable?

An automatic variable is a variable declared inside a function and local to the function in which it is declared.

Name a function that enables you to read the contents of a file and another function that enables you to write to the file in the C language.

The fgetc( ) function is used to read from a file and the fputc( ) function is used to write to a file.

What started as a simple C program has now turned into several program modules as you have refined it over the past several months. The problem is that now you do not always remember which modules you have changed at what time. What should you do?

Use the make utility and create makefiles.

Most programmers have to do some debugging of a C or C++ program at some point. Suggest a series of steps to follow when debugging a program

Write down the line number of each error and a brief description. Edit the source file, moving the cursor to the first line number the compiler reports. Within the source file, correct the error, and then move the cursor to the next line number. Most editors display the current line number to help you locate specific lines within the file. After correcting all the errors, save and recompile the file.

Which of the following are performed by functions in the C library?

a. screen operations, b. memory allocation operations, c. file operations, and d. math operations

What are three examples of looping logic structures that can be used in the C language?

case, for, while

In your C program, you want to use a while loop and decrement the value, counter, each time the program goes through the while loop. Which of the following operators enables you to decrement the value in counter?

counter--;

Which of the following statements enables you to print File updated on the screen when a C++ program is finished?

cout << "File updated.\n";

What compiler is started by using the g++ command?

the C++ compiler

What character shows that you are starting a block of code in the C and C++ languages?

{

You have written a C program using the variables num, enum, sum, and long. When you compile the program you get an error message about using a variable the compiler finds unacceptable. Which of the following is likely to be the problem?

enum and long are keywords and cannot be used as variables

You've written a C program, but are now getting an error message about the use of standard input and output statements when you compile the program. Which of the following might be the cause?

You omitted the preprocessor directive for the file stdio.h

A colleague of yours is just learning to use the C compiler in Linux. When she tries to compile a program called firststart.c using gcc firststart.c she is expecting the executable file to have the name firststart, but there is no firststart file. What is the executable file's name?

a.out

Which of the following functions must be in a C program?

main()

The programmer you are training wants to write code to determine when the end of a file has been reached. Which of the following can he use?

feof()


Kaugnay na mga set ng pag-aaral

IB BIO: C.2 Communities and ecosystems

View Set

IT 1113 Module 1: Introduction to Programming

View Set

Cardiovascular System, Blood, and Lymphatic Systems EAQs

View Set