[go: up one dir, main page]

0% found this document useful (0 votes)
10 views4 pages

Coumputational Thinking

Uploaded by

tinofok285
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)
10 views4 pages

Coumputational Thinking

Uploaded by

tinofok285
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
You are on page 1/ 4

‭Answers to Questions‬ ‭ .

4 What is the difference between‬


Q
‭Computer Science, Computing, and‬
‭ .1 Define Computational thinking.‬
Q ‭Computational thinking?‬
‭Explain with an example.‬ ‭ omputer Science: The study of computers and computational systems, focusing on theory,‬
C
‭algorithms, hardware, software, and data structures.‬
‭ omputational thinking is a problem-solving approach that involves breaking down complex‬
C
‭problems into manageable parts, identifying patterns, abstracting the general principles, and‬
‭Computing: The act of using computers to process information or perform calculations. It‬
‭developing algorithms to solve the problems. It is a fundamental skill for programming and‬
‭ ncompasses the practical application of computer systems and technologies.‬
e
‭algorithm design.‬

‭Computational Thinking: A problem-solving approach that involves using concepts from‬


‭Example: When solving a maze, computational thinking would involve breaking down the‬
‭ omputer science (like decomposition, abstraction, and algorithms) to address real-world‬
c
‭ roblem by analyzing the structure of the maze (decomposition), identifying repeated patterns or‬
p
‭problems, not limited to computing.‬
‭sections of the maze (pattern recognition), simplifying the problem by removing unnecessary‬
‭details (abstraction), and finally, creating a step-by-step set of instructions to solve the maze‬
‭(algorithm).‬
‭ .5 Define algorithm with a suitable‬
Q
‭ .2 What are the Four major points of‬
Q ‭example.‬
‭Computational thinking?‬ ‭ n algorithm is a finite set of step-by-step instructions designed to solve a specific problem or‬
A
‭perform a task.‬
‭ . Decomposition: Breaking a complex problem into smaller, more manageable parts.‬
1
‭Example: A recipe for baking a cake is an algorithm. It includes steps like mixing ingredients,‬
‭2. Pattern Recognition: Identifying similarities or patterns in problems.‬
‭ reheating the oven, and baking for a specific duration, all of which lead to the final product.‬
p
‭3. Abstraction: Simplifying a problem by focusing on important information and ignoring‬
‭irrelevant details.‬
‭4. Algorithm Design: Developing a step-by-step procedure or set of rules to solve the problem.‬
‭ .6 Define the concept of a programming‬
Q
‭ .3 Differentiate between bugs and‬
Q ‭language. Give an example of a high-level‬
‭defects.‬ ‭programming language.‬
‭ ug: A bug is an error or flaw in a software program that causes it to behave unexpectedly.‬
B ‭ programming language is a formal language consisting of a set of instructions that can be‬
A
‭Bugs occur during coding or design and are identified during development or testing phases.‬ ‭used to produce various kinds of output, typically used to control the behavior of a machine or to‬
‭express algorithms.‬
‭Defect: A defect is a variance between the expected and actual result, usually noticed by the‬
‭ nd-users after the software is released. A defect can originate from a bug but is identified after‬
e ‭Example: Python is a high-level programming language known for its readability and wide‬
‭the product is in use.‬ r‭ ange of applications, from web development to artificial intelligence.‬
‭ . Python: Web development, data science, artificial intelligence.‬
1
‭ .7 What is the role of translators in‬
Q ‭2. JavaScript: Web development, front-end development, server-side scripting.‬
‭3. Java: Mobile applications (especially Android), enterprise applications.‬
‭programming language? Explain different‬ ‭4. C++: Game development, system software, high-performance applications.‬
‭5. C#: Game development (Unity), Windows applications.‬
‭types of translators used in programming‬ ‭6. PHP: Web development, server-side scripting.‬
‭7. Ruby: Web development, particularly with Ruby on Rails framework.‬
‭language.‬ ‭8. Swift: iOS app development.‬
‭9. Go: Cloud computing, server-side applications.‬
‭ ranslators convert high-level programming code into machine code that computers can‬
T ‭10. Kotlin: Android app development, server-side applications.‬
‭understand. They are essential for running programs written in high-level languages.‬

‭ ypes of Translators:‬
T
‭1. Compiler: Translates the entire program into machine code at once, and the machine code is‬
‭ .10 How is debugging different from‬
Q
‭executed directly. Example: C++ compiler.‬
‭2. Interpreter: Translates the program line by line and executes it immediately after translation.‬
‭testing?‬
‭Example: Python interpreter.‬
‭ esting: The process of systematically checking whether a software product behaves as‬
T
‭3. Assembler: Converts assembly language code into machine code.‬
‭expected by running it through a set of predefined cases. The goal is to find bugs or defects in‬
‭the system.‬

‭ .8 Explain the types of errors that are‬


Q ‭Debugging: The process of identifying, analyzing, and fixing the bugs found during testing or‬
‭ hile running the software. Debugging is a corrective action taken after discovering an issue‬
w
‭likely to occur while running and‬ ‭during testing.‬

‭executing a program.‬
‭ . Syntax Errors: Mistakes in the program's syntax, such as missing semicolons or parentheses.‬
1
‭2. Runtime Errors: Errors that occur during program execution, such as division by zero or‬
‭trying to access an unavailable file.‬
‭3. Logical Errors: The program runs without crashing but produces incorrect results due to‬
‭incorrect logic or calculations.‬
‭4. Semantic Errors: Occur when the code is syntactically correct but does not perform the‬
‭intended task or logic.‬

‭ .9 List top 10 most common‬


Q
‭programming languages and their most‬
‭common uses.‬
‭They are important because they help define the structure and meaning of the code, ensuring‬
‭Tutorial 2 Answers‬ t‭he program works correctly.‬

‭ .5 Define storage classes available in C‬


Q
‭ .1 What are some basic rules of C‬
Q
‭language.‬
‭programming?‬
‭ . auto: The default storage class for local variables inside a function.‬
1
‭ . Every C program must have a main() function where the execution begins.‬
1 ‭2. register: Requests that the variable be stored in the CPU register for quick access.‬
‭2. All statements must end with a semicolon (;).‬ ‭3. static: Retains the value of a variable between function calls.‬
‭3. Variable names must start with a letter or underscore, but not with a number.‬ ‭4. extern: Declares a global variable defined in another file.‬
‭4. Code should be written in blocks enclosed in curly braces {}.‬
‭5. C is case-sensitive, meaning Var and var are different.‬

‭ .6 What is the use of #define‬


Q
‭ .2 Describe the basic data types in C‬
Q ‭pre-processor? Explain with an example.‬
‭language.‬ ‭ define is used to create macros or symbolic constants that replace text in the code.‬
#
‭Example:‬
‭ . int: Used for integers (whole numbers) like 3, -5.‬
1 ‭#define PI 3.14‬
‭2. float: Used for single-precision floating-point numbers (decimals) like 3.14.‬ ‭int area = PI * radius * radius;‬
‭3. double: Used for double-precision floating-point numbers (larger decimals).‬ ‭Here, PI is replaced with 3.14 during the compilation process.‬
‭4. char: Used for single characters like 'A' or '9'.‬
‭5. void: Represents the absence of type, used with functions that return no value.‬

‭ .7 Explain the decision-making‬


Q
‭ .3 What is a variable? Illustrate with an‬
Q ‭statement in C with an example program.‬
‭example.‬ ‭ ecision-making statements in C control the flow of execution based on conditions.‬
D
‭Example:‬
‭ variable in C is a container used to store data values.‬
A ‭if (age >= 18) {‬
‭Example: int age = 25; here age is a variable that stores the integer 25.‬ ‭printf("You are an adult.");‬
‭} else {‬
‭printf("You are not an adult.");‬
‭ .4 What is a keyword in C? Why are they‬
Q ‭}‬
‭This code checks if the age is 18 or more and prints the appropriate message.‬
‭important?‬
‭ keyword in C is a reserved word that has a predefined meaning and cannot be used as a‬
A ‭ .8 What is an operator? Explain different‬
Q
‭variable name.‬
‭Example: int, return, and if are keywords.‬ ‭types of operators in C.‬
‭ n operator in C is a symbol that performs operations on variables and values.‬
A
‭Types:‬
‭1. Arithmetic Operators: +, -, *, / for mathematical operations.‬
‭2. Relational Operators: >, <, ==, != for comparisons.‬
‭3. Logical Operators: &&, ||, ! for logical operations.‬
‭4. Assignment Operators: = for assigning values.‬
‭5. Increment/Decrement Operators: ++ and -- to increase or decrease a value by one.‬

‭ .9 What is the role of printf and scanf in‬


Q
‭C programming? Explain with examples.‬
‭ rintf: Displays output on the screen.‬
p
‭Example:‬
‭printf("Hello, World!");‬
‭This prints "Hello, World!" on the screen.‬

s‭ canf: Takes input from the user.‬


‭Example:‬
‭int age;‬
‭scanf("%d", &age);‬
‭This takes an integer input and stores it in the age variable.‬

‭ .10 What is the use of && and ||‬


Q
‭operators in C programming?‬
‭ & (Logical AND): Returns true if both conditions are true.‬
&
‭Example:‬
‭if (a > 0 && b > 0) {‬
‭printf("Both are positive numbers.");‬
‭}‬

|‭| (Logical OR): Returns true if at least one condition is true.‬


‭Example:‬
‭if (a > 0 || b > 0) {‬
‭printf("At least one is a positive number.");‬
‭}‬

You might also like