COP Exam 1

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

||

; If any of the two operations is non-zero, then the condition becomes true

A function

A group of statements that together perform a task

False

A program stops its execution when break statement is encountered

float

A single-precision floating point value

Valid name Semi-colon Data type

A variable definition must include as a minimum which of the following? Select all that apply. int variableName = 53; Initial value Assignment operator Valid name Semi-colon Data type

+

Add two operands

for loop

Allows you to efficiently write a loop that needs to execute a specific number of times; a valid implementation may contain only two semi-colons.

Basic types

Arithmetic types and are further classified into integer and floating-point types

Aggregate Types

Array and structure types

True

C programming language assumes any non-zero and non-null values as true

False

C programming language assumes any zero or null values as false

Assembly language

C runs nearly as fast as which other language?

continue

Causes the loop to skip the remainder of his body and immediately retest its condition prior to reiterating

==

Checks if two operands are equal

?:

Conditional expression; if condition is true ? then value X : otherwise value Y

A function definition

Consists of a function header and a function body

False

Constants can be altered during program execution

Function Body

Contains a collection of statements that define what the function does

Decrement integer by one

main()

Every C program has at least this one function.

5

Given the source code below, how many tokens make up the statement? printf("Hello COP 3223!");

One

How many characters does function getchar() read?

One

How many characters does function putchar() output at a time?

True

In a C program, an individual statement must be ended with a semicolon

do... while loop

Is guaranteed to execute at least one time

False

Literals are not equivalent to fixed values in regard to computer programming in the C language

#include <stdio.h> - preprocessor command int main() - The main function where the program execution begins /* my first program in C */ - comments printf("Hello world!\n"); - function available in C return 0; - terminates the main() function

Match the parts of the program with its definition. #include <stdio.h> int main() { /* my first program in C */ printf("Hello world!\n"); return 0; }

*

Multiples two operands

Void

No value is available

nested loops

One or more loops inside any other while, for, or do..while loop.

Derived types

Pointer, array, structure, union, function types

upper case

Professional best practices states that when using constants in source code the syntax should be in which format?

Parameter list

Refers to the type, order, and number of the parameters of a function

Calling

Regarding calling a function, arguments are used when _________ a function

VARIABLE, _variable, var23iable, variable

Regarding identifiers for variables, functions, or any other user-defined items, which of the following are acceptable?

False

Regarding keywords in the C programming language and creating identifiers. Keywords are reserved in all lowercase AND all uppercase

stderr

Regarding standard file in the C programming language which of the following is used for standard error?

stdin

Regarding standard files in the C programming language, which of the following is used for standard input?

stdout

Regarding standard files in the C programming language, which of the following is used for standard output?

False

Regarding white space in the C programming language, spaces are required between the operators in the following source code in order to compile, run, and provide the correct output. int sum=2+3/2-12*15

%

Remainder after integer division

while loop

Repeats a statement or group of statements while a given condition is true. Can execute 0 times

sizeof()

Return the size of a variable

A function declaration

Tells the compiler about a function's name, return type, and parameters

Break

Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch.

Function return type

The Data type of the value the function returns.

Function Name

The actual name of the function

int

The most natural size of integer for the machine

/* comment */ and // comment

There are multiple forms of an acceptable comment in C, select all that apply

True

To call a function, you simply need to pass the required parameters along with the function name

goto

Transfers control to the labeled statement

char

Typically one byte and is an integer type

Enumerated types

Used to define variables that can only assign certain discrete integer values

Sizeof()

What C operator is used to yield the storage size of the object or type in bytes

"char * format"

What does function scanf() require as a first argument to receive data from stdin?

Machine language

What is source code compiled into?

.c

What is the file extension of a C language source code file?

C compiler Text editor

What tools are required to set up an environment in order to write, compile, and run a program written in the C language? Select all that apply. C++ compiler Java compiler C compiler Text editor

Source files

What type of file contains the source code?

Copies the actual value of an argument into the formal parameter of the function

When calling a function, call by value refers to what behavior?

outside all functions

When defining a constant as a macro where should it be located?

const int LENGTH = 10;

When defining a constant in the main() function which of the following is the correct implementation? const int LENGTH = 10; #define LENGTH 10 const int LENGTH 10; const int LENGTH = 10

1972

When was C first implemented?

B

Which language is C the successor of?

All of these

Which of the following is branching statement of C language? if statement if ... else statement switch statement All of these

#define RATE 25

Which of the following is the correct implementation for defining a constant as a macro? #define int RATE 25 #define int RATE = 25; #define RATE 25 #define int RATE 25;

The data type determines the size of the variable has a specific type the data type determines the range of values that can be stored the data type determines the layout of the variable's memory the data type determines the set of operations that can be applied to the variable

Which of the following is true regarding a variable in C? Select all that apply. The data type determines the size of the variable has a specific type All variables use for bytes of membor the data type determines the range of values that can be stored the data type determines the layout of the variable's memory The data type determines how it can be named the data type determines the set of operations that can be applied to the variable

Has its meaning at the time of compilation only Provides assurance to the compiler that there exists a variable within the given type and name Is useful when you are using multiple files

Which of the following is true regarding variable definition in C? Select all that apply. Has its meaning at the time of compilation only Provides assurance to the compiler that there exists a variable within the given type and name Cannot declare a variable multiple times in a C program Is useful when you are using multiple files

Dennis M. Ritchie

Who developed the C programming language?

It can be compiled on a variety of computer platforms Easy to learn Structured language It can handle low-level activities

Why is C widely used? Select all that apply. It can be compiled on a variety of computer platforms Object -oriented language It produces inefficient programs Easy to learn Structured language It can handle low-level activities

If

______ is the built in multi-way decision statement in C

double

a double-precision floating point value

&

bitwise AND

Function arguments as void

int rand(void);

int max(int num1, int num2); Given the function declaration above, which parts of the function comprise the function signature?

parameter int num1 parameter int num2 Function name max

void

represents the absence of type

Pointers to void

void * malloc (size_t size);

Function returns as void

void exit (int status);


संबंधित स्टडी सेट्स

الخلافة الراشدة والأموية

View Set

Chapter 11 The Nervous System: Autonomic and Motor Systems

View Set

Chapter 47: Management of Patients With Intestinal and Rectal Disorders 2

View Set

Avoiding Group Harms - U.S. Research Perspectives (ID 14080)

View Set

Life and Health, missed questions

View Set

concept 54 Health Disparities b234

View Set