Errors In Cpr (9017) Manual

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Errors In Cpr (9017) Manual as PDF for free.

More details

  • Words: 2,530
  • Pages: 10
Errors in CPR (9017) manual 1.

Experiment no. 2 Page no. 7 Topic 3.0 NEW CONCEPTS: Line no. 13 %d: For printing integer valuesCorrection: %d: For printing Decimal integer values.

2.

Experiment no. 2 Page no. 9 Topic 6.0 EXERCISES B.3. Concept in this program is very conflicting, thus it is not necessary at this stage of learning.

3.

Experiment no. 3 Page no. 11 Topic 3.0 NEW CONCEPTS: Only Conditional, Logical, Arithmetic and Relational operators are covered here. Bitwise operators (&, ^, |) are remained. 4.

Experiment no. 3 Page no. 13 Topic 5.0 SAMPLE PROGRAMS: Flowchart: Yes/No tags are remaining, also for displaying ‘First class’, ‘Second Class’ rectangles are used. Here, parallelograms are required. ‘Display Result’ box is not necessary. 5.

Experiment no. 3 Page no. 14 Topic 6.0 EXERCISES B.1. Line no. 6. This line is conflicting. It should be meaningful, such as, if (i==5 && z>50)

6.

Experiment no. 4 Page no. 19 Topic 5.0 SAMPLE PROGRAMS: Program code: This program contains some logical errors. When we enter the character other than ‘a’ to ‘z’ or ‘A’ to ‘Z’ it displays the ‘character is consonant’. The code should be modified as, if((ch>=’a’ && ch<=’z’) || (ch>=’A’ && ch<=’Z)) if(ch==’a’ || ch==’e’ || ch==’i’ || ch==’o’ || ch==’u’ || ch==’A’ || ch==’E’ || ch==’I’ || ch==’O’ || ch==’U’) printf(“Character is vowel”); else printf(“Character is consonant”); 7.

Experiment no. 4 Page no. 21 Topic 5.0 SAMPLE PROGRAMS: Problem statement and program code does not match. Some lines in the program code are remained. The code is wrong after line no 19 and 20. It should be: if(units_consumed<=625) bill_charges=230+0.8*(units_consumed-425); else bill_charges=390+(units_consumed-625); 8.

Experiment no. 4 Page no. 21 Topic 5.0 EXERCISE 6.0 A.1. This program is based on finding real roots of quadratic equations. At this stage such complicated program is not necessary. 9.

Experiment no. 5 Page no. 24 Topic 3.0 NEW CONCEPTS: Last line on this page is: To avoid the execution of statements keyword break is used if the control out of the switch statement. It should be written as: To avoid the execution of statements keyword break is used. It transfers the control out of the switch statement. 10.

Experiment no. 5 Page no. 26 Topic 5.0 SAMPLE PROGRAM: Flowchart: In the given flowchart, third block must be above second block.

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-1-

Errors in CPR (9017) manual Program code: ‘case’ keyword is written as ‘Case’. It must whole be in small case. For case 4, i.e. division, the output is in the form of integer. We can introduce type casting or type conversion here by converting ‘result’ variable into float data type. Change the line, result = a/b; into result = float(a/b); 11.

Experiment no. 5 Page no. 28 Topic 6.0 EXERCISES C. Two examples are given here. I will suggest to take an example on float values. By which student can understand that float is not allowed in switch-case. 12.

Experiment no. 6 Page no. 30 Topic 3.0 NEW CONCEPTS: General syntax of for loop is given as: for (counter initialization; test counter condition; increment counter) for loop is not always related with counter so, more specifically we can write

it as: for (initialization ; condition ; updation) 13.

Experiment no. 6 Page no. 34 Topic 5.0 SAMPLE PROGRAM: Algorithm: As the flowchart is not for do-while loop step 6 must be shifted in place of step 4. Flowchart: ‘Display the counter’ should be written in parallelogram block, as it is an output statement. Program code: Very simple program code is given here. It can be changed to Fibonacci series or finding the factorial of a number. 14.

Experiment no. 6 Page no. 36 Topic 6.0 EXERCISES B.2. Fourth line in this program is: int j, j; it must be: int i, j;

15.

Experiment no. 6 Page no. 36 Topic 6.0 EXERCISES B.3. Line number 12 of this program contains a variable n. But this variable is not defined anywhere. It should be ‘number’ in place of n. 16.

Experiment no. 7 Page no. 39 Topic 3.0 NEW CONCEPTS. Example: int A[10]; The above statement will reserve 10 consecutive memory allocations to store 10 elements of type integer. In this statement there should be ‘locations’ instead of allocations. 17.

Experiment no. 7 Page no. 40 Topic 5.0 SAMPLE PROGRAM. Flowchart: In the given flowchart, fourth block should be rectangle and fifth should be parallelogram. 18.

Experiment no. 7 Page no. 41 Topic 5.0 SAMPLE PROGRAM. Program Code: There is a logical error in the given program. In the second for loop (line no. 14), the condition given is if(arr[i] < arr[i+1]) max = arr[i]; CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-2-

Errors in CPR (9017) manual Here, value of max should be assigned with arr[i+1] not with arr[i]. If we enter negative numbers, output doesn’t come accurate, so we can prefer one more logic, i.e. max = arr[0]; for(i=0; i<5; i++) { if(arr[i] > arr[i+1]) max = arr[i]; } 19.

Experiment no. 8 Page no. 41 Topic 3.0 NEW CONCEPTS: The declaration of two dimensional array is missing a semicolon.

20.

Experiment no. 8 Page no. 41 Topic 3.0 NEW CONCEPTS: The memory visualization of two dimensional array can be visualized most simply as:

21.

Experiment no. 8 Page no. 41 Topic 5.0 SAMPLE PROGRAM: The problem statement contains a 2 X 2 matrix but, the actual program is based on a 3 X 3 matrix. 22.

Experiment no. 8 Page no. 41 Topic 5.0 SAMPLE PROGRAM: There should be an opening curly brace after line no. 30 and closing curly brace after line no. 33 to view the output matrix properly. such as: for (i=0; i<3; i++) { for (j=0 ;j<3; j++) printf(“\t%d”,C[i][j]); printf(“\n”); } 23.

Experiment no. 8 Page no. 48 Topic 6.0 EXERCISES B.1. Last line of this program is: printf(“\n %d%d%d”, *A,A[3][3],A[2][1]); At this stage of learning, use of * operator is not necessary. It will be some bit confusing for the students also. CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-3-

Errors in CPR (9017) manual

24.

Experiment no. 8 Page no. 48 Topic 6.0 EXERCISES B.3. Seventh line of this program contains an apostrophe sign at the end. It should be comma in place of that. 25.

Experiment no. 8 Page no. 49 Topic 6.0 EXERCISES C. b. The program is not ended with a curly brace.

26.

Experiment no. 9 Page no. 51 Topic 3.0 NEW CONCEPTS: Syntax of strcmp ( ) is given as: strcmp(string1, string2); Actually, strcmp is an integer function, it’s syntax should be: compare = strcmp(string1, string2); where, compare is an integer variable.

27.

Experiment no. 9 Page no. 53 Topic 5.0 SAMPLE PROGRAM. Program code and flowchart are mismatching here.

28.

Experiment no. 9 Page no. 54 Topic 6.0 EXERCISES B.1. Fifth line of this program is missing a comma between ‘a’ and ‘\0’.

29.

Experiment no. 10 Page no. 59 Topic 5.0 SAMPLE PROGRAMS. Tenth line of this program is missing %d after the statement “Factorial of number is”. 30.

Experiment no. 10 Page no. 59 Topic 6.0 EXERCISES B.1. Function prototype is of funct1( ) and function call (line no. 8) is of funct2( ). Also, any of the function is not defined here. 31.

Experiment no. 10 Page no. 60 Topic 6.0 EXERCISES B.2. Function f1( ) should have prototype here or it must be declared above main( ) function. 32.

Experiment no. 10 Page no. 60 Topic 6.0 EXERCISES C.1. main( ) function is not ended with a closing curly brace.

33.

Experiment no. 10 Page no. 60 Topic 6.0 EXERCISES C.3. Prototype of function swap( ) contains intx and inty. There should be space between int and x as well as int and y. 34.

Experiment no. 11 Page no. 62 Topic 4.0 NEW CONCEPTS: Syntax of the structure contains square brackets. It is not necessary there else it will be considered as the part of syntax of the structure. 35.

Experiment no. 11 Page no. 63 Topic 4.0 NEW CONCEPTS: General concept of the structure can be visualized as:

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-4-

Errors in CPR (9017) manual

36.

Experiment no. 11 Page no. 64 Topic 5.0 SAMPLE PROGRAM: Flowchart: Fourth block of this flowchart contains a rectangle. It must be a parallelogram for displaying the value. 37.

Experiment no. 11 Page no. 64 Topic 5.0 SAMPLE PROGRAM: Line no. 15 of the Program code contains, scanf(“%d”,&S.name); as name is a string variable, this line must be written as, scanf(“%s”,S.name);

38.

Experiment no. 11 Page no. 65 Topic 6.0 EXERCISES B.2: Name of the structure here is ‘class’. As most of the students are using C++ compiler for programming, ‘class’ is a keyword in C++. It gives error there. So, this word must be changed. 39.

Experiment no. 11 Page no. 66 Topic 6.0 EXERCISES B.3: Line no.13 of this program is: S[i].tot+1 = S[i].sub[j]; The expression of left must be a variable. Thus, Lvalue is required here.

40.

Experiment no. 12 Page no. 71 Topic 5.0 SAMPLE PROGRAMS: Eighth line of this code contains two semicolons at the end.

41.

Experiment no. 12 Page no. 72 Topic 5.0 SAMPLE PROGRAMS: In the second program code, the function swap ( ) should have prototype or it must be declared above main ( ) function. 42.

Experiment no. 12 Page no. 72 Topic 5.0 SAMPLE PROGRAMS: In the second program’s swap ( ) function, there is no necessity for two return statements, even not one. 43.

Experiment no. 12 Page no. 73 Topic 6.0 EXERCISES B.2: Prototype of function fun (void *p) missing the semicolon.

44.

Experiment no. 12 Page no. 73 Topic 6.0 EXERCISES B.3: Function funct ( ) is missing the prototype.

45.

Experiment no. 12 Page no. 74 Topic 6.0 EXERCISES C.1:

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-5-

Errors in CPR (9017) manual Seventh line of this program contains: name = “Pune”; it should be: city = “Pune”; 46.

Experiment no. 13 Page no. 77 Topic 5.0 SAMPLE PROGRAMS: Last line of this code is: printf(“\n %d”,&(arr[i] ) ); It should be like this: printf(“\n %d”,*(arr[i] ) );

47.

Experiment no. 13 Page no. 77 Topic 5.0 SAMPLE PROGRAMS: Program code is too simple. Exercise A.2 can be given here as a program

code. 48.

Experiment no. 14 Page no. 82 Topic 5.0 SAMPLE PROGRAMS: Output is not matching with the program code. ‘a’ in the ‘argv’ is printed in capital letter. 49.

Experiment no. 14 Page no. 83 Topic 6.0 EXERCISES: B.2. void must not be written before for command line arguments. It doesn’t show any output. 50.

Experiment no. 14 Page no. 83 Topic 6.0 EXERCISES: B.3. The statement, printf(“%c”,(*++argv)(0)); Must be written as: printf(“%c”,*++argv[0]);

51.

Algorithm writing and flowchart drawing method is also seems to be wrong in all of the cases. In an algorithm, ‘start-stop’ and ‘begin-end’ are the pairs for the first and last statement. e.g. 1. Experiment no. 2 Page no. 8 Topic no. 5.0 Sample Program: Problem Statement: Write a program to calculate area of the circle. Algorithm: 1. Start. 2. Input radius in cm. 3. Calculate, area = 3.14 * (radius * radius) 4. Display area. 5. Stop. Flowchart:

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-6-

Errors in CPR (9017) manual

Start

Input radius in cm.

Calculate area = 3.14 * (radius * radius)

Display Area

Stop

2.

Experiment no. 3 Page no. 13 Topic no. 5.0 Sample Programs: Problem statement: Accept five different subjects’ marks obtained by student. Write a program to calculate the division obtained by the student. Algorithm: 1. Start. 2. Accept five different subjects’ marks i.e. m1, m2, m3, m4, m5. 3. Calculate, per = (m1+m2+m3+m4+m5) / 5 4. If per>= 75 then display “Distinction” else If per>= 60 then display “First class” else If per>= 50 then display “Second class” else If per>= 40 then display “Pass class” else Display “Fail”. 5. Stop. Flowchart:

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-7-

Errors in CPR (9017) manual Start

Accept five different subjects’ marks i.e. m1, m2, m3, m4, m5. Calculate, per = (m1+m2+m3+m4+m5) / 5

Yes

Display “Distinction”

per >=75 No

Yes

Display “First Class”

per >=60 No

Yes

Display “Second Class”

per >=50 No

Yes

Display “Pass Class”

per >=40 No Display “Fail”

Stop

3.

Experiment no. 10 Page no. 58 Topic no. 5.0 Sample Programs: As a function is another flow of the program, it is having separate data memory, address memory and flowchart also. A separate symbol is provided for showing the flow of the function. This symbol also must be included in the first experiment for showing function, method, subroutine or procedure. This symbol is:

Function Call

Problem Statement: Write a function for calculating factorial of a given number. Algorithm: 1. Start. 2. Accept the number n from user. 3. Call the function fact(int n) for calculating factorial. CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-8-

Errors in CPR (9017) manual 4. Display the factorial of that number. 5. Stop. Algorithm for function fact (int n): 1. int fact(int n). 2. Let fact = 1 and i = 1. 3. fact = fact * i; 4. Increment the value of i by 1. 5. Perform step 4 and 5 till i<=n 6. Return the value of fact. Flowchart:

Start

int fact (int n)

Accept the number n from user

Let fact=1 and i = 1

fact = fact * i; Call the function factorial = fact (n) Increment i by 1 Display the factorial

Yes

Stop

4.

i<=n No Return fact

Experiment no. 12 Page no. 72 Topic no. 5.0 Sample Programs: Problem Statement 2: Write a function using pointer for exchanging values of two variables.

Algorithm: 1. Start. 2. Input values of two variables i.e. ‘a’ and ‘b’. 3. Call function swap () and pass addresses of these variables to this function to swap the values. 4. Display the values of ‘a’ and ‘b’. 5. Stop. Algorithm for function swap: 1. void swap (int *x, int *y) 2. Store the content of x in temporary variable. 3. Copy content of y in content of x. 4. Store content of temporary variable in y. 5. Return.

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

-9-

Errors in CPR (9017) manual Flowchart: Start void swap(int *x, int *y) Accept the values of a and b

Call function swap(int *, int *)

Display the values of a and b

Stop

Store the content of x in temporary variable. Copy content of y in content of x Store content of temporary variable in y Return

CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)

- 10 -

Related Documents

Errors In Cpr (9017) Manual
November 2019 19
Syllabus - Cpr 9017
November 2019 21
Cpr - Manual Solutions
November 2019 20
Cpr
November 2019 51
Cpr
May 2020 34
Cpr
May 2020 25