cs12 quiz 1

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

As a signed integer, the bit pattern 0xFFFFFFFFFFFFFFFF in 64 bits is more commonly known as:

-1

Write the decimal value that represents all 1s for 64 bits as a signed value

-1

Convert 0x5 to binary:

0101

Assuming a 4 bit unsigned word, convert the binary number 0101 to hexadecimal:

0x5

Convert 0xd to binary:

1101

T or F: Control-D input works the same whether stdin is empty or not.

F

T or F: For full credit in CSE 12, if you didn't change a file that is part of your assignment, you still need to provide a file header.

F

T or F: For full credit in CSE 12, you should have one inline comment for every line of code in your program.

F

T or F: For all programming assignments, you need to run turnin.

T

T or F: For full credit in CSE 12, all inline comments need to be at the same indent level as the code being documented.

T

T or F: For full credit in CSE 12, descriptions of the algorithm for a method/function normally belong in the "Description" field of a function/method header.

T

T or F: For full credit in CSE 12, if a file contains only one class or struct definition, you can have a combined file and class/struct header as long as all information is present.

T

T or F: For full credit in CSE 12, if a function/method body has only one line of code, a function/method header isn't needed.

T

An output statement to standard output starts with what word in C++?

cout

What sequence of keystrokes causes CSE 12 programs to terminate normally:

ctrl D

stderr is used to display what two kinds of messages:

debug and error

In Java, C or C++ code, when a number begins without a prefix, what do you know about that number: (example: int zzz =12;)

decimal

Professional interactions involve what basic criteria?

it benefits you

When the standard input buffer is empty and your program calls fgetc, what is the resultant behavior of your program:

it waits for user input

What two commands must you enter at the UNIX command line from the ~/../public/hw2 directory to begin working on hw2?

make directories make install

In C, assuming 0xFF is stored in a signed char, it the number positive or negative?

negative

Should you print a NULL character in writeline?

no

Should you store the newline character as part of the string formed by getaline?

no

List two situations that cause the standard output buffer to be displayed to the screen when running a C program?

1. Buffers full (uncommon) 2. Printing newline "\n" (common) 3. Program terminates normally (uncommon) 4. Asking for user input (common)

Convert 0x9 to binary:

1001

What is the length of the string "ABC"?

3

How many binary digits are needed to represent one hexadecimal digit?

4

In C, what is the minimum character array size need to store the string: "ABC"?

4

What is the hexadecimal value for the largest signed positive number that can be stored using 64 bits?

7FFFFFFFFFFFFFFF

T or F: If your program passes all execution test cases, you will always get full credit for that assignment.

F

Write the hexadecimal value that represents all 1s for 64 bits

FFFFFFFFFFFFFFFF

What is displayed to the terminal by the following C code: writeline ("Hello World "", stdout); writeline (""Goodbye World "", stderr);

Goodbye World Hello World

What is displayed to the terminal by the following C code: writeline ("Hello World ", stderr); writeline ("Goodbye World ", stdout);

Hello World Goodbye World

Under what circumstance can you wait longer than one week to raise issues about the grading on a program or quiz?

If it affects your grade

Is the array parameter to your writeline method in hw1 an input or an output parameter or both?

Input

Is the array parameter to your getaline method in hw2 an input or an output parameter or both?

Output

What is the one best word to describe an unsigned value in C or C++?

Positive

T or F: For full credit in CSE 12, for file, class/struct and function/method headers, as long as the content is complete, you can follow a header style of your choice.

T

T or F: For full credit in CSE 12, implementing a method for a class or struct mean that you need to have a class/struct header.

T

T or F: For full credit in CSE 12, you should have one inline comment for every idea that you implement in your program.

T

T or F: For full credit in CSE 12, your inline comments should justify the existence of code that follows.

T

T or F: For full credit in CSE 12, your name always belongs in the file header for those files that you authored or updated.

T

T or F: For full documentation credit in CSE 12, you need to have a comment describing the purpose of every variable, object and data field that you declare.

T

What character exists at the end of all strings in C and C++:

\0 (null)

In C, in your writeline function, you have a loop of printing characters terminating when processing what character:

\0 (the null character)

Assuming the user inputs a short valid string, in your getaline function, you have a loop of processing characters terminating when processing what character:

\n (newline or if overflow then ctrl D)

Assuming the user inputs a valid number, in your decin function, you have a loop of processing characters terminating when processing what character:

\n (newline)

What character is the last one entered in every user response in C, C++ and Java when reading from standard input:

\n newline

An output statement to standard error starts with what word in C++?

cerr

An input statement from standard input starts with what word in C++?

cin

In Java, C or C++ code, when a number begins with a leading 0x, what do you know about that number: (example: int zzz =0x12;)

hexadecimal

"using namespace" in C++ is most similar to what keyword in Java

import

Assuming the following line of code in C executed, list one situation where the string is not displayed to the user: fprintf (stdout, "Hello World");

infinite loop or run-time error

In the following assignment in C, what is the type of the "character" variable: character = fgetc (stdin);

int

What is the effect on the stdin buffer when the only the following keystrokes are entered: A B backspace

nothing (you have to press enter)

In Java, C or C++ code, when a number begins with a leading 0, what do you know about that number: (example: int zzz = 012;)

octal

What word best describes when adding two positive numbers give a negative result?

overflow

Should you store the NULL character as part of the string formed by getaline?

yes

In C and C++, what is the numeric value of NULL?

0

In C and C++, what is the numeric value of false?

0

Convert 0xa to binary:

0101

Convert to hexadecimal: 0000 1100 0000 1111 1111 1110 1110 0000

0C0FFEE0

Convert to hexadecimal: 0000 1111 1110 1110 1101 1101 1010 1101

0FEEDDAD

Assuming a 4 bit unsigned word, convert the binary number 1000 to hexadecimal:

0x8

Assuming a 4 bit unsigned word, convert the binary number 1111 to hexadecimal:

0xf

In C and C++, what is the numeric value of true?

1

How long do you have after a graded program or quiz is returned to you for you to raise issues about the grading on that program or quiz?

1 week

How long does a faculty member at UCSD have to easily make a correction to an assigned course grade?

1 year

In your basout function, when processing a small positive number, you have a loop of processing that number terminating when what condition is met?

quotient is 0


Kaugnay na mga set ng pag-aaral

Google Certification Exam Study Questions

View Set

Pediatrics Test #1 - End of Chapter Questions

View Set

Strategic management Test 2 (60-120)

View Set

Codes - Ch.7 Fire Protection Systems

View Set

Business Ethics Vocabulary-Chapter 1

View Set