SNS COLLEGE OF ENGINEERING, COIMBATORE Department of Computer Science and Engineering QUESTION BANK(PART A) GE8151 - PROBLEM SOLVING AND PYTHON PROGRAMMING TWO MARKS UNIT-I 1. What is computer? Computers are electronic devices that can follow instructions to a. accept input, b. process the input c. then produce information. 2. List the basic functions of computer. Input Processing Output Storing Controlling 3. Mention the applications of computer. Business Industry Home Education Entertainment Printing and Publishing
4. List the characteristics of computer. 5. Mention the generations of computer. 6. Mention the types of computer
7. What is program? Program is a collection of instructions that will perform some task. 8. List the problem solving steps. 1) Specify problem requirements 2) Analyze the problem 3) Design an algorithm to solve the problem 4) Implement the algorithm 5) Test and verify the completed program. 6) Maintain and update the program. 9. What is algorithm? Algorithm is a sequence of instructions written in the form of English phrases required for producing the desired result It involves identifying variable names and types that would be solving the problem Step by Step Procedures 10. List the qualities of good algorithm. An algorithm is considered as good,if It uses most efficient logic(time complexity) It uses minimal system memory for its execution - memory It should able to generate most accurate results accuracy Sequence 11. What are the building blocks or control structure of algorithm? Sequence structure - Action Selection structure - Decision Iteration structure - Repetition or Loop 12. What is sequence structure? The execution of the statements is done sequentially. More than one instruction to be followed in order. It uses top-down approach. Example: Addition of two numbers Step1: Start Step2: Read a, b Step3: Add the value of a with b and store the result in sum.
Step4: Display the value of sum Step5: Stop 13. What is selection structure? Two sets of statement blocks are written in a program along with one or more conditions The execution occurs if the condition is true, if the condition is false else part is executed It is used for making decisions Example: To find the greatest among two numbers Step1: Start Step2: Read the value of a, b, c Step3: IF (a>b) and (a>c) THEN print a is largest ELSE IF (b>c) THEN print b is largest ELSE print c is largest Step4: Stop 14. Mention the advantages and disadvantages of algorithm? Advantages: It is a step-wise representation, which makes it easy to understand. It is easy to understand for anyone even without programming knowledge. Every step in an algorithm has its own logical sequence so it is easy to debug. By using algorithm, the problem is broken down into smaller pieces or steps hence, it is easier for programmer to convert it into an actual program Disadvantages of algorithm Writing algorithm takes a long time. An Algorithm is not a computer program, it is rather a concept of how a program should be 15. List the properties of algorithm? Should be written in simple English Should be unambiguous, precise and easy understanding Should provide the correct solutions Should have an end point The output statements should follow input, process instructions
The initial statements should be of input statements Should have finite number of steps Every statement should be definitive 16. What is sequence structure? The execution of this structure is repeated many times if the conditional statement is true. Example: To find factorial of the number: Step1: Start Step2: Read the value of n and set i =1 Step3: while i <= n do fact =fact * i i = i + 1 else Goto step5 Step4: Go to step 3 Step5: print the value of fact Step6: Stop 17. What is pseudocode? It consists of Short, Readable and formally styled English language It is used for explaining the algorithm It does not include variable declaration 18. What is the purpose of pseudocode? Detailed algorithm before developing a program is very time consuming It focuses on only logic of program It is not written using specific syntax Written by using combination of Generic syntax and normal English language 19. Mention the rules for writing pseudocode. Write only one statement per line Capitalize initial keyword Indent to show hierarchy End Multiline structures Keep statements language independent
20. List the terms used while writing the pseudocode. Input data INPUT, GET, READ Calculation COMPUTE, CALCULATE Output OUTPUT, PRINT, DISPLAY Incrementing INCREMENT Addition, Subtraction, Initialization ADD, SUBTRACT, INITIALIZE 21. Draw the control structures diagram. 22. Mention the advantages of Flow chart. Standardized Visual 23. List the advantages of pseudocode. a. Easily modified b. Implements structured concepts c. Done easily on Word Processor d. Works well for large program 24. List the disadvantages/limitations of flowchart a. Hard to modify
b. Structured design elements not implemented c. Special software required d. It is difficult to use flowcharts for large programs. 25. Mention the disadvantages of pseudocode. a. Not visual b. No accepted standard, varies from company to company 26. Mention the rules for defining a variable. Begin with lowercase letter Contain no spaces Additional words begin with capital Unique names within code Consistent use of names 27. Difference between iteration and recursion. S.No Iteration Recursion 1 Code may be longer Code may be smaller 2 It is faster than recursion It is slower than iteration 3 Consumes less memory compared to Uses more memory than iteration recursive approach 4 Uses for and while loop Uses selection structure 28. What is recursion? Function which calls itself is called recursive function. The process is called recursion. 29. Mention the benefits of flowchart. 1) Makes Logic Clear. 2) Communication 3) Effective Analysis 4) Useful in Coding 5) Useful in testing 30. Write the rules for drawing flowchart. 1) Standard symbols should be used. 2) Only one flow lines should come out from a process symbol.
3) Intersection of flow lines should be avoided 4) Only one flow line should enter a decision symbol, but two or three lines can leave the decision symbol. 31. What are the building blocks of algorithm? Building blocks Common Name Sequence Structure Action Selection Structure Decision Iteration Structure Repetition or Loop 32. Mention the characteristics of algorithm. Steps in algorithm must be simple and must not be ambiguous. It should be written in sequence Ensure that algorithm will terminate It must solve the given problem. 33. Define flowchart. It is a pictorial representation of an algorithm. It represents flow of control and logic in the solution to the problem It uses different symbols for describing activities Flow Lines Start/Stop Calculation Input/Print Decision Connector