Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Programming I

Exam I

QuestionAnswer
What is an expression? A combination of variables, constants, operators, and functions that produces a value.
What is a data type? A classification that determines what kind of value a variable can hold (e.g., int, float, double, char).
What is Structured Programming? A programming paradigm emphasizing sequence, selection, and repetition with clear, modular code.
What does int store? Whole numbers (usually 4 bytes).
What does float store? Single-precision decimal values (about 6 digits of precision).
What does double store? Double-precision decimal values (about 15 digits of precision).
What does char store? Single characters (1 byte, stored as ASCII).
What does short store and when to use it? Smaller integer range (usually 2 bytes), used when memory is limited.
What does long store and when to use it? Larger integer range than int (usually 4 or 8 bytes depending on system).
What does long long store and when to use it? Very large integer range (at least 8 bytes), used when numbers exceed long.
What rules must variable names follow? Start with a letter or underscore, no spaces, no special characters.
How should constants be named? Typically in ALL_CAPS per course standard.
What printf specifier is used for int? %d
What printf specifier is used for char? %c
What printf specifier is used for float? %f
What printf specifier is used for double? %lf
Why must you use & in scanf? It provides the memory address of the variable where input will be stored.
How do you print with 2 decimal places? printf("%.2f", value);
What does % (modulo) do? Finds the remainder of integer division.
What is the difference between ++x and x++? ++x increments before use (pre-increment), x++ increments after use (post-increment).
What happens when you divide two integers in C? The result is truncated (decimal part discarded).
Is dividing by zero valid? No, it is incorrect/invalid.
Can you use % on floating-point numbers? No, only integers.
What is implicit type promotion? Smaller types automatically convert to larger ones (e.g., int → double).
What is explicit conversion? A cast like (double)x / y.
What are relational operators? ==, !=, >, <, >=, <=
What are logical operators? && (AND), || (OR), ! (NOT)
What is a single-selection construct? if (condition) { }
What is a two-way selection construct? if (condition) { } else { }
What is a multi-way selection construct? if … else if … else …
Common errors in C programs include? Missing semicolons, wrong specifiers, missing & in scanf, misplaced braces, undeclared variables.
What should you check in broken sample programs? Missing keywords, braces {}, semicolons, or format specifiers.
Operator Precedence : Highest to lowest ++ / -- (pre/post increment & decrement) *, /, % (multiplication, division, modulo) +, - (addition, subtraction) ==, != (equality, inequality) && (logical AND) || (logical OR)
Which has higher precedence, * or +? * (multiplication before addition).
Which has higher precedence, && or ||? && (evaluated before ||).
Which has higher precedence, == or &&? == (evaluated before logical AND).
What does -- do? Decreases a variable’s value by 1.
What is the difference between ++x and x++? ++x increments before use, x++ increments after use.
Does implicit conversion require (type) casting? No, it happens automatically.
What happens in double y = 5 + 2.5;? 5 (int) is promoted to 5.0 (double).
What happens when you use a char in arithmetic? It is promoted to its ASCII integer value.
What does %5d mean? Print an integer in a field at least 5 characters wide (pads with spaces on the left).
Example: printf("%5d", 42); → Output? " 42" (3 spaces + 42).
What does %.2f mean? Print a floating-point number with 2 digits after the decimal.
Example: printf("%.2f", 3.14159); → Output? "3.14"
Example: printf("%8.2f", 3.14159); → Output? " 3.14" (4 spaces + 3.14).
Does the decimal point count toward minimum width in printf()? Yes, the decimal counts as 1 character.
What range can a signed short hold? –32,768 to 32,767.
Example of value that fits in short? Age in years (e.g., 25).
What range can a signed int hold? –2,147,483,648 to 2,147,483,647.
Example of value that fits in int? Population of a large U.S. city (e.g., 2,500,000).
Example of value that fits in long? World population (8,000,000,000).
Example of value that fits in long long? Distance in meters to the nearest star (40,208,000,000,000,000 m).
How do you print a long with printf()? printf("%ld", population);
How do you print an int and short with printf()? printf("%d", variable);
How do you print a long long with printf()? printf("%lld", distance);
What is the naming convention called when variables are written like numberOfShoes? camelCase (lower camel case).
: What is an IDE used for? It combines tools like a code editor, compiler/interpreter, and debugger to make writing, running, and debugging programs easier.
What does a compiler do? Translates the entire source code into machine code (or bytecode) before running the program.
What is the main difference between a compiler and an interpreter? A compiler translates the whole program at once (faster execution after compiling), while an interpreter runs the program step by step (slower execution but easier debugging).
What is an array in programming? An array is a collection of elements of the same data type stored in contiguous memory locations.
What is a string in programming? A string is a sequence of characters stored in an array, usually ending with a null character '\0'.
How do strings differ from normal arrays? Strings are arrays of char with a terminating '\0', while normal arrays can hold any data type without a required terminator.
What is an inline (single-line) comment in C? A comment that begins with // and continues to the end of the line.
What is a block (multi-line) comment in C? A comment that starts with /* and ends with */, which can span multiple lines.
What is the main difference between defined and memory constants? #define constants are handled by the preprocessor (text replacement, no memory used). const constants are handled by the compiler (they occupy memory like variables but cannot be modified).
Give an example of a defined constant. #define PI 3.14159 printf("%f", PI); // prints 3.14159
What is a character literal in C? A single character enclosed in single quotes (' '), representing an integer value from the ASCII table.
In C, how are Boolean values represented? By integers: 0 is false, and any non-zero value is true.
Are negative integral values considered true or false? Any negative (or positive) non-zero value is considered true.
Which values evaluate as false in C? Only 0 (zero).
Created by: evelynashe
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards