NYSTCE Computer Science flashcards
NYSTCE Computer Science · Build recall with a focused review session.
34 cards. Read the term and the definition here. The deck at the top of this page is optional.
- Big-O of binary search
- O(log n), because each comparison halves the remaining search interval; the input array must be sorted before searching.
- Stack vs queue order
- A stack is last-in-first-out (LIFO), removing the most recently added item; a queue is first-in-first-out (FIFO), removing the oldest item.
- Hash table average complexity
- Average-case O(1) for insert, search, and delete when the hash function distributes keys well; worst case is O(n) with heavy collisions.
- BFS versus DFS
- Breadth-first search explores level by level with a queue and finds shortest unweighted paths; depth-first search goes deep first using a stack or recursion.
- Dijkstra algorithm requirement
- All edge weights must be non-negative; with a binary heap the running time is O(E log V), and negative edges require Bellman-Ford instead.
- Recursion base case
- A condition that stops recursive calls without further recursion; without it the call stack grows until a stack overflow error occurs.
- Value versus reference types
- Value types store the data directly and copy on assignment; reference types store an address, so assignment copies the reference and both names share one object.
- Short-circuit evaluation
- In A && B, B runs only when A is true; in A || B, B runs only when A is false. This prevents unnecessary or unsafe evaluation.
- Integer division and modulo
- Integer division discards the fractional part (7/2 gives 3); modulo returns the remainder (7%2 gives 1) and can be negative for negative operands.
- Compile-time vs run-time errors
- Compile-time errors are syntax or type violations caught before execution; run-time errors such as division by zero occur while the program runs.
- Variable scope and shadowing
- Scope is the region where a name is visible; a local variable with the same name as a field shadows the field inside that block.
- Unit versus integration testing
- A unit test exercises one method or class in isolation; an integration test verifies that multiple components work together correctly.
- For-to-while loop conversion
- Move the initialization before the loop, keep the condition in the while header, and place the update at the end of the body.
- n-bit value range
- Unsigned n bits span 0 to 2^n minus 1; two's complement signed n bits span negative 2^(n-1) to 2^(n-1) minus 1.
- Two's complement negation
- Invert every bit of the number and add one; the leading bit has weight negative 2^(n-1), which makes subtraction use the same adder as addition.
- Hex and binary grouping
- Each hexadecimal digit maps to exactly four binary bits and each octal digit to three; group from the right to convert binary to hex.
- ASCII versus Unicode
- ASCII defines 128 seven-bit codes for basic Latin characters; Unicode assigns code points for all scripts, and UTF-8 encodes them in one to four bytes.
- Fetch-decode-execute cycle
- The CPU fetches the instruction at the program counter, decodes its opcode, executes it, writes results back, and advances the program counter.
- Von Neumann bottleneck
- Instructions and data share one memory and bus, so the processor waits for memory transfers; Harvard architecture separates the two memories to reduce this.
- Cache locality
- Temporal locality means recently used data is reused soon; spatial locality means nearby addresses are accessed soon. Cache exploits both to cut average memory latency.
- Half adder outputs
- Sum equals A XOR B and carry equals A AND B; a full adder also accepts a carry-in and combines two half adders with an OR gate.
- OSI layer order
- Physical, Data Link, Network, Transport, Session, Presentation, Application from layer one to seven; TCP/IP merges these into Link, Internet, Transport, and Application.
- TCP versus UDP
- TCP is connection-oriented and reliable with handshake, sequencing, and retransmission; UDP is connectionless and unreliable but has lower overhead and latency.
- IPv4 versus IPv6 length
- IPv4 addresses are 32 bits written as four decimal octets; IPv6 addresses are 128 bits written as eight hexadecimal groups.
- Subnet host count
- A /24 mask leaves 8 host bits, giving 2^8 minus 2, or 254 usable hosts, after reserving the network and broadcast addresses.
- DNS, DHCP, and ARP
- DNS maps names to IP addresses, DHCP assigns IP configuration automatically, and ARP resolves an IP address to a MAC address on the local link.
- Symmetric versus asymmetric encryption
- Symmetric encryption uses one shared secret key and is fast; asymmetric encryption uses a public/private key pair and supports signatures and key exchange.
- Hashing versus encryption
- A cryptographic hash is one-way and used to verify integrity; encryption is reversible with a key and used to protect confidentiality.
- SQL injection mitigation
- Use parameterized queries or prepared statements and validate input, so user data is treated as values rather than executable SQL code.
- Digital divide
- Unequal access to devices, reliable broadband, and digital literacy across income, geography, age, or disability groups, affecting participation in school and work.
- Net neutrality
- The principle that internet service providers treat all traffic equally, without blocking, throttling, or paid prioritization of specific content.
- FERPA, COPPA, and HIPAA
- FERPA protects student education records, COPPA limits data collection from children under 13, and HIPAA safeguards protected health information.
- Permissive versus copyleft licenses
- MIT and BSD allow reuse with few conditions; GPL is copyleft and requires derivative works distributed publicly to remain under the same open license.
- Algorithmic bias
- Systematically unfair model outcomes caused by biased training data, flawed labels, or design choices that disadvantage particular groups.