0% found this document useful (0 votes)
15 views8 pages

Computer Science Concepts Explained

Advance computer science

Uploaded by

sanafatimaa720
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

Computer Science Concepts Explained

Advance computer science

Uploaded by

sanafatimaa720
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Section 1: Core Logic & Concepts

1. Define data and information.


Answer: Data refers to raw facts and figures without context, while information is processed,
organized, and meaningful data.

2. What is the difference between hardware and software?


Answer: Hardware is the physical part of a computer system, such as CPU and memory, while
software is the set of programs that control hardware operations.

3. Explain the role of the CPU.


Answer: The CPU (Central Processing Unit) performs all the processing operations and
controls the execution of instructions in a computer system.

4. What are primary and secondary memory?


Answer: Primary memory (RAM, ROM) is directly accessible by the CPU for quick data access,
whereas secondary memory (hard disk, SSD) stores data permanently.

5. What is a computer virus?


Answer: A computer virus is a malicious program that replicates itself and harms computer files
or performance.

6. Define algorithm.
Answer: An algorithm is a set of well-defined steps used to solve a specific problem or perform
a computation.

7. What is meant by logic gate?


Answer: A logic gate is an electronic component that performs a logical operation (AND, OR,
NOT) on one or more binary inputs to produce an output.

8. Differentiate between compiler and interpreter.


Answer: A compiler translates the whole program into machine code at once, while an
interpreter translates line by line during execution.

9. What is an operating system?


Answer: An operating system is system software that manages hardware, software, and user
interactions.

10. What are input and output devices?


Answer: Input devices allow users to provide data (keyboard, mouse), while output devices
display processed information (monitor, printer).

11. What is binary system?


Answer: The binary system represents data using only two digits, 0 and 1, and is the base of all
computer operations.

12. What is the function of memory unit?


Answer: The memory unit stores data, instructions, and intermediate results during computer
operations.

13. What is a storage device?


Answer: A storage device is hardware used to save digital data permanently or temporarily, like
USB drives or hard disks.
14. Define software engineering.
Answer: Software engineering is the systematic approach to designing, developing, testing,
and maintaining software systems.

15. What is a flowchart?


Answer: A flowchart is a graphical representation of an algorithm using symbols to show the
sequence of operations.

16. What is data type?


Answer: Data type defines the kind of value a variable can hold, such as int, float, or char.

17. What is a variable?


Answer: A variable is a named memory location that stores a value which can be changed
during program execution.

18. Define Boolean logic.


Answer: Boolean logic uses true/false values and logical operators (AND, OR, NOT) to control
program decisions.

19. What is machine language?


Answer: Machine language is the lowest-level programming language consisting of binary
instructions understood by the CPU.

20. Explain system software.


Answer: System software controls and supports computer hardware and application programs,
examples include OS and device drivers.

Section 2: Algorithms & Flowcharts


1. What is an algorithm in problem solving?
Answer: It’s a step-by-step logical procedure for solving a particular problem efficiently and
accurately.

2. Explain flowchart symbols.


Answer: Rectangles show processes, diamonds show decisions, ovals show start/end, and
arrows indicate flow direction.

3. Why are algorithms important?


Answer: They make problem-solving efficient, structured, and easy to debug or modify later.

4. What is pseudocode?
Answer: Pseudocode is a human-readable description of program logic that helps design
algorithms before coding.

5. How do you convert an algorithm into a program?


Answer: By translating each algorithmic step into code syntax using a programming language
like C.

6. Explain decision-making in flowcharts.


Answer: Decision-making uses a diamond shape to represent conditions that lead to different
paths (Yes/No).
7. What is looping in programming?
Answer: Looping allows repeating a block of code multiple times until a certain condition is met.

8. Difference between while and for loop.


Answer: While checks condition first, for defines initialization, condition, and increment in one
line.

9. Why is indentation important in pseudocode?


Answer: Indentation makes logic clear, readable, and helps identify control structures easily.

10. What is an infinite loop?


Answer: A loop that never ends because its condition always remains true or lacks a
termination condition.

11. Give an example of a real-world algorithm.


Answer: Example: Steps to withdraw money from an ATM — insert card, enter PIN, choose
amount, receive cash.

12. What is modular programming?


Answer: It’s dividing a program into small reusable parts (modules) for better organization and
testing.

13. Define input and output in algorithms.


Answer: Input is data fed to an algorithm, and output is the result produced after execution.

14. What is a conditional statement?


Answer: It’s a logical statement that executes code based on whether a condition is true or
false.

15. How can you represent algorithms graphically?


Answer: Using flowcharts with standardized symbols to visualize process flow.

16. Explain nested loops.


Answer: A nested loop is a loop inside another loop, used for multi-dimensional tasks like
matrix processing.

17. What is a dry run?


Answer: Dry run means manually tracing the algorithm step-by-step to verify correctness
before coding.

18. What is the significance of comments in pseudocode?


Answer: Comments explain logic for readers and developers, improving code understanding.

19. Why are flowcharts used before programming?


Answer: They help visualize the overall program logic and detect errors early.

20. Define syntax and semantics.


Answer: Syntax is the correct structure of code; semantics is the meaning behind the
statements.

Section 3: C Programming & Output Prediction


1. What is a C program structure?
Answer: A C program includes header files, main function, variable declarations, and
statements enclosed in braces.

2. What is a variable in C?
Answer: A variable in C is a storage location identified by a name, used to store data of specific
type.

3. What is the role of header files?


Answer: Header files include predefined functions and macros that simplify programming tasks
(e.g., stdio.h).

4. Define function in C.
Answer: A function is a block of code designed to perform a particular task, called when
needed.

5. What is an array?
Answer: An array is a collection of elements of the same data type stored in contiguous
memory locations.

6. Explain the use of printf() and scanf().


Answer: printf() is used for output display, while scanf() takes user input in C programs.

7. What are conditional statements in C?


Answer: Conditional statements like if, if-else, and switch control the flow of execution based
on conditions.

8. What is a loop in C?
Answer: A loop repeatedly executes a block of statements until a given condition becomes
false.

9. What is the difference between while and do-while loop?


Answer: While checks condition first, do-while executes once before checking the condition.

10. Explain function prototype.


Answer: A function prototype declares the function type and parameters before actual definition
to ensure correct usage.

11. What is recursion?


Answer: Recursion occurs when a function calls itself to solve smaller instances of a problem.

12. Define pointer.


Answer: A pointer is a variable that stores the address of another variable, allowing indirect
data access.

13. Explain syntax error with example.


Answer: Syntax errors occur due to incorrect code structure. Example: missing semicolon after
statement.

14. What is output of: int x=5; printf("%d",x++);?


Answer: Output: 5 — because the post-increment operator increases the value after it’s
printed.

15. Explain array indexing.


Answer: Array elements are accessed using indices starting from 0 for the first element.

16. What is difference between local and global variable?


Answer: Local variables are declared inside functions; global variables are declared outside all
functions and accessible everywhere.

17. Define type casting.


Answer: Type casting converts one data type into another, such as float to int.

18. What are logical operators in C?


Answer: Logical operators include && (AND), || (OR), and ! (NOT), used in condition checking.

19. What is purpose of break and continue?


Answer: break exits the current loop; continue skips to the next iteration of the loop.

20. Explain the use of return statement.


Answer: The return statement sends a value back to the calling function, ending the current
function execution.

Section 4: Debugging & Error Tracing


1. Find the error: int x; printf(x);
Answer: Error: printf requires format specifier. Correct: printf("%d", x);

2. Find output: int a=5,b=10; printf("%d",a+b*2);


Answer: Output: 25 — multiplication has higher precedence than addition.

3. Find error: for(i=0;i<=10;i--){printf("%d",i);}


Answer: Error: infinite loop because i-- decreases value instead of increasing.

4. Find error: char name[5] = "Ali";


Answer: Error: string needs space for null character. Correct: char name[4] = "Ali";

5. Predict output: int x=3; if(x==3) printf("Yes"); else printf("No");


Answer: Output: Yes

6. Find output: int a=5; printf("%d",++a);


Answer: Output: 6 — pre-increment increases before use.

7. Find output: int a=5; a+=3; printf("%d",a);


Answer: Output: 8 — compound assignment adds 3 to a.

8. Error: printf("%d",5/0);
Answer: Runtime error: division by zero not allowed.

9. Find logic error: avg = sum / 5;


Answer: If sum and avg are int, fractional part lost. Use float data type.

10. Find error: if(a=b) printf("Equal");


Answer: Error: assignment instead of comparison. Use '==' instead of '='.

11. Find output: int a=2,b=3; printf("%d",a==b);


Answer: Output: 0 (false) because a is not equal to b.

12. Find error: missing semicolon after return 0


Answer: Syntax error — each statement must end with semicolon.

13. Find logic issue: if(x>5); printf("High");


Answer: Semicolon after condition ends 'if' prematurely — incorrect logic.

14. Find bug: float x=5/2;


Answer: 5/2 gives 2 not 2.5 because both are integers; use 5.0/2 for correct float result.

15. Output: int x=10; printf("%d",x>5 && x<15);


Answer: Output: 1 (true) because both conditions are satisfied.

16. Find error: scanf("%d",a);


Answer: Missing '&' operator before variable. Correct: scanf("%d", &a;);

17. Find error: if(x=10)


Answer: Error: assigns 10 instead of comparing. Use '==' for comparison.

18. Output: int a=5; printf("%d",a++ + ++a);


Answer: Undefined behavior — modifying variable twice in one expression.

19. Find bug: printf("%d",a); without declaring 'a'


Answer: Compilation error — undeclared variable 'a'.

20. Error: missing return type before main()


Answer: In C, use 'int main()' with a return statement.

Section 5: Advanced Topics (AI, DBMS, Networking,


Cybersecurity)
1. What is a computer network?
Answer: A computer network is a group of interconnected devices that communicate and share
resources.

2. Define IP address.
Answer: An IP address is a unique number assigned to each device on a network for
identification and communication.

3. What is cybersecurity?
Answer: Cybersecurity protects computer systems, networks, and data from digital attacks and
unauthorized access.

4. What is encryption?
Answer: Encryption converts readable data into an unreadable format to prevent unauthorized
access.

5. Define database.
Answer: A database is an organized collection of data that can be easily accessed, managed,
and updated.
6. What is DBMS?
Answer: DBMS (Database Management System) is software that manages storage, retrieval,
and manipulation of data efficiently.

7. Explain primary key.


Answer: A primary key uniquely identifies each record in a database table and prevents
duplication.

8. What is SQL?
Answer: SQL (Structured Query Language) is used to interact with and manage relational
databases.

9. What is cloud computing?


Answer: Cloud computing delivers computing services like storage, servers, and applications
over the internet.

10. Define artificial intelligence.


Answer: AI is the simulation of human intelligence by machines, enabling learning, reasoning,
and problem solving.

11. What is machine learning?


Answer: Machine learning is a subset of AI that enables systems to learn automatically from
experience without explicit programming.

12. What is Internet of Things (IoT)?


Answer: IoT connects everyday devices to the internet, allowing data collection and
automation.

13. Define computer ethics.


Answer: Computer ethics refers to moral principles guiding responsible and fair use of
technology.

14. What is firewall?


Answer: A firewall is a security system that monitors and controls incoming and outgoing
network traffic.

15. What is malware?


Answer: Malware refers to malicious software designed to damage or gain unauthorized
access to systems.

16. What is phishing?


Answer: Phishing is a fraudulent attempt to obtain sensitive information by pretending to be a
trusted entity.

17. Explain data privacy.


Answer: Data privacy ensures personal or organizational data is collected, processed, and
stored securely.

18. What is blockchain?


Answer: Blockchain is a distributed ledger technology ensuring transparency and immutability
of digital transactions.

19. Define e-commerce.


Answer: E-commerce refers to buying and selling goods or services using electronic networks
like the internet.

20. What is big data?


Answer: Big data represents large, complex datasets analyzed to reveal patterns, trends, and
associations.

Common questions

Powered by AI

Ethical considerations in AI development include ensuring privacy, avoiding bias, and maintaining accountability. These are significant because they ensure AI technologies are fair, trustworthy, and aligned with human values. Responsible AI development prevents misuse and unintended consequences, promoting technology's benefit to society while minimizing harm .

Pseudocode serves as a bridge between the problem solution and actual coding, offering a human-readable format that outlines algorithm logic without worrying about syntax specifics. High-level programming languages are then used to translate this logic into executable code. Pseudocode aids in planning and ensures clear understanding before coding, while high-level languages are essential for implementation .

Primary memory, including RAM and ROM, is directly accessible by the CPU, providing quick data access necessary for active processing tasks, making it volatile and temporary. In contrast, secondary memory, like hard disks and SSDs, is used for long-term storage, retaining data even when the computer is turned off, which makes it non-volatile .

SQL is a language used to perform operations like data insertion, querying, and updating within relational databases. A DBMS manages these databases efficiently by ensuring data integrity, security, and concurrent access. SQL commands allow users to communicate with the DBMS, which processes these commands to perform the desired operations .

Machine learning differs from traditional programming by enabling systems to automatically learn and improve from experience without explicit instructions for every task. Traditional programming requires predefined rules, whereas machine learning algorithms identify patterns and make predictions based on data inputs, adapting to new scenarios .

Flowcharts visually represent the sequence of operations in a program, using standardized symbols to denote different steps. This aids in clearly understanding the program's logic, making it easier to detect errors in the early stages of development. Additionally, flowcharts simplify communication among team members by providing a clear graphical depiction of processes .

Algorithms enhance problem-solving by providing structured, step-by-step procedures that ensure tasks are completed efficiently and accurately. They are critical in software development because they guide the design of programs, optimize performance, and make code more manageable and easier to debug .

Data privacy is crucial as technologies increasingly handle personal and sensitive data. It ensures that data is collected and used responsibly, protecting individuals and organizations from breaches and misuse. In today's digital environment, maintaining data privacy upholds trust, complies with regulations, and safeguards against cyber threats .

Computer viruses can severely impact systems by compromising data integrity, slowing performance, or causing total system failure. Mitigation measures include using antivirus software to detect and remove threats, maintaining regular system updates to patch vulnerabilities, educating users on safe practices, and employing firewalls to restrict unauthorized access .

Logic gates perform basic logical functions that are the building blocks of digital circuits. They process signals that represent true (1) or false (0) values, facilitating operations like addition, subtraction, multiplication, etc. This enables complex computations and decision-making processes in computers .

You might also like