UNIT- I INTRODUCTION TO PROBLEM SOLVING TECHNIQUES

Size: px
Start display at page:

Download "UNIT- I INTRODUCTION TO PROBLEM SOLVING TECHNIQUES"

Transcription

1 UNIT- I INTRODUCTION TO PROBLEM SOLVING TECHNIQUES Short Answer Type Questions - 2 Marks 1. Define Algorithm. A. Definition: A set of sequential steps usually written in Ordinary Language to solve a given problem is called an Algorithm. 2. What is a Flowchart? A. A flowchart is a graphical representation of an algorithm. 3. What is a Pseudo code? A. The Pseudo code is neither an algorithm nor a program. It is an abstract form of a program. In pseudo code, the program is represented in terms of words and phrases, but the syntax of program is not strictly followed. 4. What are the symbols of a Flowchart? A. Ellipse, Parallelogram, Rectangle, Diamond, Arrow and Circle. 5. Write an Algorithm for perimeter of Triangle A. Step 1: Start Step 2: Read the side1 of the triangle. Step 3: Read the side2 of the triangle. Step 4: Read the side3 of the triangle. Step 5: Calculate perimeter of the triangle using the formula perimeter = side1+side2+side3 Step 6: Print perimeter. Step 7: Stop. 6. What are the basic steps involved in problem solving? A. The basic steps in problem solving are 1. Understanding the problem. 2. Analyzing the problem. 3. Developing the solution. 4. Coding and implementation. Long Answer Type Questions - 6 Marks 1. Differentiate between Algorithm and Flowchart. A. Differences between Algorithm and Flowchart Algorithm: 1. A method of representing the step-by-step logical procedure for solving a problem. 2. It contains step-by-step English descriptions, each step representing a particular operation leading to a solution of a problem. 3. These are particularly useful for small problems. 4. For complex programs, nobody prefers algorithms. Flowchart: 1. Flowchart is a diagrammatic representation of an algorithm. It is constructed using different types of boxes and symbols. 2. The flowchart employs a series of blocks and arrows, each of which represents a particular step in an algorithm. 3. These are useful for detailed representations of complicated programs. 4. For complex programs, everybody prefers Flowcharts. 2. Write an algorithm to find greatest of given three numbers. A.Step 1: Start

2 Step 2: Read the numbers X, Y, Z. Step 3 : if (X > Y) BIG = X else BIG = Y Step 4: if (BIG < Z) BIG = Z Step 5: Print the greatest number i.e. BIG Step 6: Stop. 3. Write an algorithm to check whether given integer value is PRIME or NOT. A. Algorithm of prime checking: Step 1: Start Step 2: M 2 Step 3: read N Step 4: MAX SQRT (N) Step 5: While M < = MAX do 5.1 if (M* (N/M) = N) then go to step M M + 1 Step 6: Write the number N is a prime Step 7: go to step 9 Step 8: Write the number N is not a prime Step 9: end. 4. Draw the flowchart to find roots of Quadratic equation ax 2 + bx + c = 0.

3 Short Answer Type Question - 2 Marks 1. Write the structure of C program A) The structure of a C program is Documentation Section Link Section Global declaration section main() pair of braces declarations and statements user defined functions UNIT- II FEATURES OF C 2. Define a variable and a constant in C. A. Variables: These are the names of the objects, whose values can be changed during the program execution. Constants: Constants are those, which do not change, during the execution of the program. 3. What is an expression in C. A. An expression is a sequence of operators and their operands, that specifies a computation. 4. What are the operators used in C. A. 1. Arithmetic Operators 5. Increment & Decrement Operator 2. Relational Operators 6. Conditional Operator 3. Logical Operator 7. Bitwise Operator 4. Assignment Operator 8. Comma Operator 5. Mention the significance of main() function. A. main(): As the name itself indicates it is the main function of every C program. Execution of C program starts from main(). No C program is executed without main() function. It should be written in lowercase letters and should not be terminated by a semicolon. It calls other Library functions and user defined functions. There must be one and only one main() function in every C program. 6. What are formatted and Unformatted Input-output statements. A. Input Statements Output Statements Formatted:scanf() printf() Unformatted:getchar(), gets() putchar(), puts() 7. Write the syntax of scanf() and printf() statements. A. Syntax of scanf:scanf ( control strings, &arg1,&arg2,.&argn); Where control string referes to a string containing certain required formatting information and arg1, arg2,.argn are arguments that represent the individual input data items. Syntax of printf:printf( control string, arg1, arg2,.arg-n ); Where control string is a string that contains formatted information, and arg1, arg2, argn are arguments that represent the output data items.

4 8. Write the syntax of do loop control structure. A. The do-while loop evaluates the condition after the execution of the statements in the body. Syntax: do Statement block; while<expression>; Here also the statements will be executed as long as the expression value is true. If the expression is false the control come out of the loop. 9. Write short notes on goto statement? A. goto statement: The goto statement is used to alter the program execution sequence by transferring the control to some other part of the same program. Syntax goto<label>; label : statements; Where label is an identifier used to label the target statement to which the control would be transferred the target statement will appear as: 10. Mention the difference between while loop and do While loop. A. In the while loop the condition isfirst tested i.e., if it is true then the statements will be executed. So it is called entry control loop. In the do while loop the condition is tested after execution of the statements. So in do while loop it executes the statements at least once even the condition is false.so the do-while loop is called a bottom tested loop. 11. What is a Nested Loop? A. A loop with in another is called nested loop(while,do..while, for). The inner and outer loops may be of the same type or may not be of same type. 12. Write the syntax of while statement. A.while statement While loop will be executed as long as the expression is true. Syntax: while (expression) statements; The statements will be executed repeatedly as long as the expression is true. If the expression is false then the control is transferred out of the while loop. 13. Write the syntax of for loop statement. A. The for loop is used execute a statement or group of statements for repeated no of times Syntax: for(exp1;exp2;exp3) Block of statements exp1 : Initialization Expression. exp2 : Condition or Control expression exp3 : Update expression 14. Write about Switch Statement. A.Switch statement: A switch statement is used to choose a statement among several alternatives. Syntax: switch(control variable)

5 case label1: statement1; case label2: statement2; default: statements n; default: Statement n Where constant1, constant2, are either integer constants or character constants. When the switch statement is executed the control variable is evaluated and control is transferred directly to the group of statements whose case label value matches the value of the control variable. If none of the case label values matches to the value of the control variablethen the default part statements will be executed. 15. Write the syntax of Simple if statement. A.if (< conditional expression>) statements; The conditional expression is evaluated and if the expression is true then the statements will be executed. If the expression is false then the statements are skipped and execution continues with the next statements. 16. Write the syntax of if else statement. A. if (< conditional expression>)statements-1 else statements-2; The conditional expression is evaluated and if the expression is true the statements-1 will be executed. If the expression is false the statements-2 will be executed. 17. What is Preprocessor statement in C. A.Preprocessor Statements: These statements begin with # symbol. They are called preprocessor directives. These statements direct the C preprocessor to include header files and also symbolic constants in to C program. Some of the preprocessor statements are #include<stdio.h>: for the standard input/output functions #include<test.h>: for file inclusion of header file Test. #define NULL 0: for defining symbolic constant NULL = 0 etc. 18. What are different types of errors occurred during the execution of a C program. A. syntax errors, logical errors and run time errors. 19. What is a Variable and a Constant in C? What are types of Constants in C. A.Variables: These are the names of the objects, whose values can be changed during the program execution. Constants: Constants are those, which do not change, during the execution of the program. Types of constants: Numeric Constants Character Constants String Constants 20. What are basic data types in C. A.Basic Data Types There are four basic data types in C language. They are Integer, character, floating point and double. 21. What is a String Constant? A. String Constants

6 A string constant is a sequence of alphanumeric characters enclosed in double quotes whose maximum length is 255 characters. Following are the examples of valid string constants: My name is Krishna Bible Salary is Long Answer Type Questions - 6 Marks 22. Explain the basic structure of C program. A.The basic structure of a C program figure given below. Documentation: The documentation section consist of a set of comment lines such as program name and is for what purpose, etc., Comments that are enclosed within /* and */. The comment statements are not compiled and executed Preprocessor Statements: The preprocessor statement begins with # symbol and are also called the preprocessor directives. These statements instruct the compiler to include C preprocessors such as header files and symbolic constants before compiling the C program. Some of the preprocessor statements are listed below.

7 Global Declarations: The variables are declared before the main ( ) function as well as user defined functions are called global variables. These global variables can be accessed by all the user defined functions including main ( ) function. The main() function: Each and Every C program should contain only one main ( ). The C program execution starts with main ( ) function. No C program is executed without the main function. The main ( ) function should be written in small (lowercase) letters and it should not be terminated by semicolon. main ( ) executes user defined program statements, library functions and user defined functions and all these statements should be enclosed within left and right braces. Braces: Every C program should have a pair of curly braces (, ). The left braces indicates the beginning of the main ( ) function and the right braces indicates the end of the main ( ) function. These braces can also be used to indicate the user-defined functions beginning and ending. These two braces can also be used in compound statements. Local Declarations: The variable declaration is a part of C program and all the variables are used in main ( ) function should be declared in the local declaration section is called local variables. Not only variables, we can also declare arrays, functions, pointers etc. These variables can also be initialized with basic data types. For examples. Code: main() int sum = 0; int x; float y; Here, the variable sum is declared as integer variable and it is initialized to zero. Other variables declared as int and float and these variables inside any function are called local variables. Program statements: These statements are building blocks of a program. They represent instructions to the compiler to perform a specific task (operations). An instruction may contain an input-output statements, arithmetic statements, control statements, simple assignment statements,etc., User defined functions: These are subprograms, generally, a subprogram is a function and these functions are written by the user are called user defined functions. These functions are performed by user specific tasks and this also contains set of program statements. They may be written before or after a main () function and called within main () function. This is an optional to the programmer.

8 23. Write about data types used in C. A. Data Types in C: Basic Data Types There are four basic data types in C language. They are Integer, character, floating point and data types. a. Character: Any character of the ASCII character set can be considered as a character data types and its maximum size can be 1 byte or 8 byte long. Char is the keyword used to represent character data type in C. Char - a single byte size, capable of holding one character. b. Integer: The keyword int stands for the integer data type in C and its size is either 16 or 32 bits. The integer data type can again be classified as 1. Long int - long integer with more digits 2. Short int - short integer with fewer digits. 3. Unsigned int - Unsigned integer 4. Unsigned short int Unsigned short integer 5. Unsigned long int Unsigned long integer As above, the qualifiers like short, long, signed or unsigned can be applied to basic data types to derive new data types. int - an Integer with the natural size of the host machine. c. Floating point: - The numbers which are stored in floating point representation with mantissa and exponent are called floating point (real) numbers. These numbers can be declared as float in C. float Single precision floating point number value. d. Double : - Double is a keyword in C to represent double precision floating point numbers. double - Double precision floating point number value. 24. What is a Constant? Explain various types of constants in C. A.Constants is those, which do not change, during the execution of the program. Constants may be categorized in to: Numeric Constants Character Constants String Constants 1. Numeric Constants Numeric constants, as the name itself indicates, are those which consist of numerals, an optional sign and an optional period. They are further divided into two types: (a) Integer Constants (b) Real Constants a. Integer Constants A whole number is an integer constant. Integer constants do not have a decimal point. These are further divided into three types depending on the number systems they belong to. They are: i. Decimal integer constants ii. Octal integer constants iii. Hexadecimal integer constants i. A decimal integer constant is characterized by the following properties It is a sequence of one or more digits ([0 9], the symbols of decimal number system). It may have an optional + or sign. In the absence of sign, the constant is assumed to be positive. Commas and blank spaces are not permitted. It should not have a period as part of it. Some examples of valid decimal integer constants: Some examples of invalid decimal integer constants: Decimal point is not permissible 1,23 - Commas are not permitted

9 ii. An octal integer constant is characterized by the following properties It is a sequence of one or more digits ([0 7], symbols of octal number system). It may have an optional + or sign. In the absence of sign, the constant is assumed to be positive. It should start with the digit 0. Commas and blank spaces are not permitted. It should not have a period as part of it. Some examples of valid octal integer constants: Some examples of invalid octal integer constants: Decimal point is not permissible 04,56 - Commas are not permitted x34 - x is not permissible symbol is not a permissible symbol iii. An hexadecimal integer constant is characterized by the following properties It is a sequence of one or more symbols ([0 9][A.Z], the symbols of Hexadecimal number system). It may have an optional + or - sign. In the absence of sign, the constant is assumed to be positive. It should start with the symbols 0X or 0x. Commas and blank spaces are not permitted. It should not have a period as part of it. Some examples of valid hexadecimal integer constants: 0x456-0x123 0x56A 0XB78 Some examples of invalid hexadecimal integer constants: 0x Decimal point is not permissible 0x4,56 - Commas are not permitted. b. Real Constants: The real constants also known as floating point constants are written in two forms: (i) Fractional form, (ii) Exponential form. i. Fractional Form The real constants in Fractional form are characterized by the following characteristics: Must have at least one digit. Must have a decimal point. May be positive or negative and in the absence of sign taken as positive. Must not contain blanks or commas in between digits. May be represented in exponential form, if the value is too higher or too low. Some examples of valid real constants: Some examples of invalid real constants: Blank spaces are not permitted 4,56 - Commas are not permitted Decimal point missing ii. Exponential Form The exponential form offers a convenient way for writing very large and small real constant. For example, , which can be written as 0.56 x 10 8 is written as 0.56E8 or 0.56e8 in exponential form , which can be written as * 10-6 is written as 0.234E-6 or 0.234e-6 in exponential form. The letter E or e stand for exponential form.

10 A real constant expressed in exponential form has two parts: (i) Mantissa part, (ii) Exponent part. Mantissa is the part of the real constant to the left of E or e, and the Exponent of a real constant is to the right of Eore. Mantissa and Exponent of the above two number are shown below. In the above examples, 0.56 and are the mantissa parts of the first and second numbers, respectively, and 8 and -6 are the exponent parts of the first and second number, respectively. The real constants in exponential form and characterized by the following characteristics: The mantissa must have at least one digit. The mantissa is followed by the letter E or e and the exponent. The exponent must have at least one digit and must be an integer. A sign for the exponent is optional. Some examples of valid real constants: 3E4 23e E6 Some examples of invalid real constants: 23E - No digit specified for exponent 23e4.5 - Exponent should not be a fraction 23,4e5 - Commas are not allowed 256*e8- * not allowed 2. Character Constants Any character enclosed with in single quotes ( ) is called character constant. A character constant: May be a single alphabet, single digit or single special character placed with in single quotes. Has a maximum length of 1 character. Here are some examples, C c : * 3. String Constants A string constant is a sequence of alphanumeric characters enclosed in double quotes whose maximum length is 255 characters. Following are the examples of valid string constants: My name is Krishna Bible Salary is Following are the examples of invalid string constants: My name is Krishna - Character are not enclosed in double quotation marks. My name is Krishna - Closing double quotation mark is missing. My name is Krishna - Characters are not enclosed in double quotation marks 25. Explain various types of Operators in C. A. Operators: The Operators used in C are 1. Arithmetic Operators 5. Increment & Decrement Operators 2. Relational Operators 6. Conditional Operators 3. Logical Operators 7. Bitwise Operators 4. Assignment Operators 8. Comma Operators 1. Arithmetic Operators Operator Meaning + Addition - Subtraction * Multiplication / Division

11 % Modulo division 2. Relational Operators Operator Meaning < Less than > Greater than <= Less than or Equal to >= Greater than or Equal to = = Equal to!= Not Equal to 3. Logical Operators Operators Expression && Logical AND Logical OR! Logical NOT Logical And (&&): A compound Expression is true when two expressions are true. The && is used in the following manner. Logical OR: A compound expression is false when all expression are false otherwise the compound expression is true. Logical NOT: The NOT (! ) operator takes single expression and evaluates to true(1) if the expression is false (0) or it evaluates to false (0) if expression is true (1). 4. Assignment Operator: Operator Meaning += Add and assign -= Subtract and assign *= Multiply and assign /= Divide and assign %= Modulo division and assign 5. Increment & Decrement Operators The increment/decrement operator act upon a Single operand and produce a new value is also called as unary operator. The increment operator ++ adds 1 to the operand and the Decrement operator - subtracts 1 from the operand. 6. Conditional operator (or) Ternary operator (? :) It is called ternary operator because it uses three expressions. The ternary operator acts like If- Else construction. Syntax : variable = ( <Exp 1 >? <Exp-2> : <Exp-3> ); Exp-1 is evaluated first. If Exp-1 is true then Exp-2 is assigned to the variable otherwise Exp-3 is assigned to the variable Ex: big= (a>b?:a:b);. 7. Bit wise Operators A bitwise operator operates on each bit of data. These bitwise operators can be divided into three categories. i. The logical bitwise operators. ii. The shift operators iii. The one s complement operator. i) The logical Bitwise Operator :There are three logical bitwise operators. Meaning Operator: a)bitwise AND & b)bitwise OR c)bitwise exclusive XOR ^ ii) The Bitwise shift Operations: The two bitwise shift operators are Shift left (<<) and Shift right (>>). Each operator requires two operands. The first operand that represents the bit pattern to be shifted. The second is an unsigned integer that indicates the number of displacements.

12 iii) Bit wise complement: The complement op.~ switches all the bits in a binary pattern, that is all the 0 s becomes 1 s and all the 1 s becomes 0 s. variable value Binary patter x ~x Comma Operator A set of expressions separated by using commas is a valid construction in c language. Example :inti, j; i= ( j = 3, j + 2 ) ; The first expression is j = 3 and second is j + 2. These expressions are evaluated from left to right. From the above example I = 5. Size of operator: The operator size operator gives the size of the data type or variable in terms of bytes occupied in the memory. This operator allows a determination of the no of bytes allocated to various Data items Example :inti; float x; double d; char c; OUTPUT printf ( integer : %d\n, sizeof(i)); Integer : 2 printf ( float : %d\n, sizeof(i)); Float : 4 printf ( double : %d\n, sizeof(i)); double : 8 printf ( char : %d\n,sizeof(i)); character : Explain formatted and un-formatted input and output statements in C. A. Input Statements Output Statements Formatted scanf() printf() Unformatted getchar(),gets() putchar(), puts() getchar() Single characters can be entered into the computer using the C library Function getchar(). It returns a single character from a standard input device. The function does not require any arguments. Syntax: <Character variable> = getchar(); Example: char c; c = getchar(); putchar() Single characters can be displayed using function putchar(). It returns a single character to a standard output device. It must be expressed as an argument to the function. Syntax: putchar(<character variable>); Example: char c; putchar(c); gets() The function gets() receives the string from the standard input device. Syntax: gets(<string type variable or array of char> ); Where s is a string. The function gets accepts the string as a parameter from the keyboard, till a newline character is encountered. At end the function appends a null terminator and returns. puts() The function puts() outputs the string to the standard output device. Syntax: puts(s); Where s is a string that was real with gets(); Example: main() char line[80]; gets(line); puts(line);

13 scanf() scanf() function can be used input the data into the memory from the standard input device. This function can be used to enter any combination of numerical Values, single characters and strings. The function returns number of data items. Syntax:-scanf ( control strings, &arg1,&arg2,... &argn); Where control string refers to a string containing certain required formatting information and arg1, arg2 argn are arguments that represent the individual input data items. Example: #include<stdio.h> main() char item[20]; intpartno; float cost; scanf( %s %d %f, item,&partno,&cost); Where s, d, f with % are conversion characters. The conversion characters indicate the type of the corresponding data. Commonly used conversion characters from data input. Conversion Characters Characters Meaning %c data item is a single character. %d data item is a decimal integer. %f data item is a floating point value. %e data item is a floating point value. %g data item is a floating point value. %h data item is a short integer. %s data item is a string. %x data item is a hexadecimal integer. %o data item is a octal integer. printf() The printf() function is used to print the data from the computer s memory onto a standard output device. This function can be used to output any combination of numerical values, single character and strings. Syntax: printf( control string, arg-1, arg-2,... arg- n ); Where control string is a string that contains formatted information, and arg-1, arg-2 are arguments that represent the output data items. Example: #include<stdio.h> main() char item[20]; intpartno; float cost; printf ( %s %d %f, item, partno, cost); (Where %s %d %f are conversion characters.) 27. Explain various conditional control structures in C. A. Conditional Control Structure: Conditional Structures

14 The conditional expressions are mainly used for decision making. The following statements are used to perform the task of the conditional operations. a. if statement. b. if-else statement. c. nested else-if statement. d. nested if else statement. e. switch statement. a. if statement The if statement is used to express conditional expressions. If the given condition is true then it will execute the statements otherwise skip the statements. The simple structure of if statement is i. if (< conditional expression>) Statement-1; (or) The conditional expression is evaluated, if the expression is true the statements will be executed. If the expression is false the statements are skipped and execution continues with the next statements. Example: a=20; b=10; if ( a > b )printf ( big number is %d,a); b. if-else statements. if (< conditional expression>)statements-1 else statements-2; The conditional expression is evaluated and if the expression is true the statements-1 will be executed. If the expression is false the statements-2 will be executes. Example: if ( a> b ) printf ( a is greater than b ); else printf ( a is not greater than b ); c. Nested else-if statements If some situations if may be desired to nest multiple if-else statements. In this situation one of several different course of action will be selected. Syntax if ( <exp1> ) Statement-1; else if ( <exp2> ) Statement-2; else if ( <exp3> ) Statement-3; else Statement-4; When a logical expression is encountered whose value is true the corresponding statements will be executed and the remainder of the nested else if statement will be bypassed. Thus control will be transferred out of the entire nest once a true condition is encountered. The final else clause will be apply if none of the exp is true. d. nestedif-else statement It is possible to nest if-else statements, one within another. There are several different forms that nested if-else statements can take. The most general form of two-layer nesting is if(exp1) if(exp3) Statement-3;

15 else Statement-4; else if(exp2) Statement-1; else Statement-2; One complete if-else statement will be executed if expression1 is true and another complete ifelse statement will be executed if expression1 is false. e. switch statement: switch statement A switch statement is used to choose a statement among several alternatives. Syntax: switch (variable) case label1: statements1; case label2: statements2; default: statements n; Where label1, label2, are either integer constants or character constants. When the switch statement is executed the variable is evaluated and control is transferred directly to the group of statements whose case label value matches the value of the value. If none of the case label values matches to the value of the variable then the default part statements will be executed. 28. Explain various conditional looping statements in C. A. Looping statements: Looping statements are used to execute the statements repeatedly as long as an expression is true. When the expression becomes false then the control transferred to the statement immediately following the loop. There are three kinds of loops in C. a) while b) do-while c) for a. while statement Syntax: while (expr) Statements; The statements will be executed repeatedly as long as the expr is true. If the expr is false then the control is transferred out of the while loop. Example: int digit = 1; while (digit <=5) printf ( %d, digit); ++digit; The output is b. do-while statement Syntax: do Statements; while<expr>; The do-while loop evaluates the condition after the execution of the statements in the body. Here also the statements will be executed as long as the expr value is true. If the expression is false the controls come out of the loop. Example:

16 int digit =1; do printf ( %d, digit); ++d; while (d<=5); The output is The statement with in the do-while loop will be executed at least once. So the do-while loop is called a bottom tested loop. c. for statement: The for loop is used to execute the statements for repetead number of times. Syntax: for (exp1;exp2;exp3) statements; exp1 : Initialization Expression exp2 : Condition / Control Expression exp3 : Update (Increment / Decrement) Expression Example: for (i=1;i<=5 ;++i ) printf ( %d,i); The output is Write the differences between Break and Continue A. Break 1. Break is a key word used to terminate the loop or exit from the block. The control jumps to next statement after the loop or block. 2. Break statements can be used with for, while, do-while, and switch statements. When break is used in nested loops, then only the innermost loop is terminated. 3. Syntax: break; 4. Example: switch (choice) case y : printf( yes ); break; case n :print( NO ); break; 5. When the case matches with the choice entered, the corresponding case block gets executed, the control jumps out of the switch statement. continue 1. Continue is a keyword used for containing the next iteration of the loop. 2. This statement when occurs in a loop does not terminate it rather skips the statement after this continue statement and the control goes for next iteration. Continue can be used with for, while and do-while loop. 3. Syntax: continue; 4. Example:- /*finds sum of odd numbers*/ #include<stdio.h> main() inti=0,s=0; while(i<=5) ++i; if(i%2 == 0) continue; s=s+i; printf("\n sum=%d",s); getch(); output: sum = 9(1+3+5) 5. In the above loop,when the even number occurs it continues loop otherwise it adds the sum.

17 UNIT III Functions Model Questions Short Answer Type Question - 2 Marks 1. What is a function? Write its syntax. A. Function:A function can be defined as a subprogram which is meant for doing a specific task. The general form of a function is as follows: return_typefunction_name( parameter list ) body of the function A function definition in C programming language consists of a function header and a function body 2. What is I/O function? List different types of I/O functions. A. I/O function means Input Output functions. They are Input function Output function scanf() printf() getchar() putchar() gets() puts() 3. What are the advantages of functions? A. The main advantages of using a function are: Easy to write a correct small function. Easy to read and debug a function. Easier to maintain or modify such a function. Small functions tend to be self documenting and highly readable It can be called any number of times in any place with different parameters. 4. Write differences between Global and Local variables. A. A local variable is a variable that is declared inside a function. A global variable is a variable that is declared outside all functions. 5. List categories of functions A. A function can be categorized as follows. 1. Function with no arguments and no return values. 2. Function with arguments and no return values. 3. Function with arguments and return values 6. What is a storage class? A. Storage class:a variable s storage class explains where the variable will be stored its initial value and life of the variable. 7. What is Iteration? A. Iteration: The block of statements is executed for one time while repeatedly using loops is called Iteration 8. What is a recursion? A. Recursion: Recursion can be defines as the process of a function by which it can call itself.

18 Long Answer Type Question - 6 Marks 9. What is a Function? Explain in detail. A. Function: A function can be defined as a subprogram which is meant for doing a specific task. The general form of a function is as follows: return_typefunction_name( parameter list ) body of the function A function definition in C programming language consists of a function header and a function body. Here are all the parts of a function: Return Type: A function may return a value. The return_type is the data type of the value the function returns. Some functions perform the desired operations without returning a value. In this case, the return_type is the keyword void. Function Name: This is the actual name of the function. Parameters: A parameter is like a placeholder. When a function is invoked, we pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters. Function Body: The function body contains a collection of statements that define what the function does. Example 1:write a program to find sum of two values by using function. Here sum() is a function to find sum of two values with void. #include<stdio.h> void sum() inta,b,c; printf("enter values for a and b: "); scanf("%d %d", &a,&b); c= a+b; printf("\n sum of %d and %d is = %d",a,b,c); void main() sum(); getch(); Input: enter values for a and b: 3 5 output: sum of 3 and 5 is = 8 Example 2: Write a program to find the value of f(x) as f(x) = x 2 + 4, for the given of x. Make use of function technique. Here f() is a function to find x*x + 4 without void. #include<stdio.h> int f(int a)

19 return(a*a+4); void main() intx,y; printf("enter a value of x : "); scanf("%d", &x); y = f(x); printf("\n if x is %d then f(x) = %d ",x,y); getch(); Input: enter a value of x : 5 output: if x is 5 then f(x) = Explain different types of functions with an example. A. Functions are categorized as 3 types 1.function with no arguments and no values 2.function with arguments and no values 3.function with arguments and values The following are the examples of above categories /* 1. function with no arguments and no values */ #include<stdio.h> void sum() inta,b,c; printf("enter values for a and b: "); scanf("%d %d", &a,&b); c= a+b; printf("\n sum of %d and %d is = %d",a,b,c); void main() sum(); getch(); Input: enter values for a and b: 3 5 output: sum of 3 and 5 is = 8 /* 2. function with arguments and no values */ #include<stdio.h> void sum(intx,int y) int c; c= x+y; printf("\n sum of %d and %d is = %d",x,y,c); void main()

20 inta,b; printf("enter values for a and b: "); scanf("%d %d", &a,&b); sum(a,b); getch(); Input: enter values for a and b: 3 5 output: sum of 3 and 5 is = 8 /* 3. function with arguments and values */ #include<stdio.h> int sum(intx,int y) return(x+y); void main() inta,b,c; printf("enter values for a and b: "); scanf("%d %d", &a,&b); c = sum(a,b); printf("\n sum of %d and %d is = %d",a,b,c); getch(); Input: enter values for a and b: 3 5 output: sum of 3 and 5 is = Explain about I/O functions. A. The input output functions are Input function scanf() getchar() gets() Output function printf() putchar() puts() getchar():single characters can be entered into the computer using the C library Function getchar(). It returns a single character from a standard input device. The function does not require any arguments. Syntax: <Character variable> = getchar(); Example: char c; c = getchar(); putchar():single characters can be displayed using function putchar(). It returns a single character to a standard output device. It must be expressed as an argument to the function. Syntax: putchar(<character variable>); Example: char c; putchar(c);

21 gets():the function gets() receives the string from the standard input device. Syntax: gets(<string type variable or array of char> ); Where s is a string. The function gets accepts the string as a parameter from the keyboard, till a newline character is encountered. At end the function appends a null terminator and returns.. puts():the function puts() outputs the string to the standard output device. Syntax: puts(s); Where s is a string that was real with gets(); Example: main() char line[80]; gets(line); puts(line); scanf() scanf() function can be used input the data into the memory from the standard input device. This function can be used to enter any combination of numerical Values, single characters and strings. The function returns number of data items. Syntax:-scanf ( control strings, &arg1,&arg2, &argn); Where control string refers to a string containing certain required formatting information and arg1, arg2 argn are arguments that represent the individual input data items. Example: #include<stdio.h> main() char item[20]; intpartno; float cost; scanf( %s %d %f, item,&partno,&cost); Where s, d, f with % are conversion characters. The conversion characters indicate the type of the corresponding data. Commonly used conversion characters from data input. In the above example, ampersand(&) need not require before variable item because item is a string.. Conversion Characters Characters Meaning %c data item is a single character. %d data item is a decimal integer. %f data item is a floating point value. %e data item is a floating point value. %g data item is a floating point value. %h data item is a short integer. %s data item is a string. %x data item is a hexadecimal integer. %o data item is a octal integer. printf() The printf() function is used to print the data from the computer s memory onto a standard output device. This function can be used to output any combination of numerical values, single character and strings. Syntax: printf( control string, arg-1, arg-2, arg-n ); Where control string is a string that contains formatted information, and arg-1, arg-2 are arguments that represent the output data items. Example: #include<stdio.h>

22 main() char item[20]; intpartno; float cost; printf ( %s %d %f, item, partno, cost); (Where %s %d %f are conversion characters.) 12. Discuss about Global and Local variables. A. Global and local variables:a local variable is a variable that is declared inside a function. A global variable is a variable that is declared outside all functions. A local variable can only be used in the function where it is declared. A global variable can be used in any function. See the following example: #include<stdio.h> // Global variables int A; int B; int Add() return A + B; int main() int answer; // Local variable A = 5; B = 7; answer = Add(); printf("%d\n",answer); return 0; As you can see two global variables are declared, A and B. These variables can be used in main() and Add(). The local variable answer can only be used in main(). 13. Explain about Call-by-value with an example. A. Call by Value:If data is passed by value, the data is copied from the variable used in for example main() to a variable used by the function. So if the data passed (that is stored in the function variable) is modified inside the function, the value is only changed in the variable used inside the function. Let s take a look at a call by value example: #include <stdio.h> void call_by_value(int x) printf("inside call_by_value x = %d before adding 10.\n", x); x += 10; printf("inside call_by_value x = %d after adding 10.\n", x); int main()

23 int a=10; printf("a = %d before function call_by_value.\n", a); call_by_value(a); printf("a = %d after function call_by_value.\n", a); return 0; The output of this call by value code example will look like this: a = 10 before function call_by_value. Inside call_by_value x = 10 before adding 10. Inside call_by_value x = 20 after adding 10. a = 10 after function call_by_value. Here, in the main() we create an integer variable a that has the value of 10. We print some information at every stage, beginning by printing our variable a. Then function call_by_value is called and we input the variable a. This variable (a) is then copied to the function variable x. In the function we add 10 to x (and also call some print statements). Then when the next statement is called in main() the value of variable a is printed. We can see that the value of variable a isn t changed by the call of the function call_by_value(). 14. Explain about Call-by-reference with an example. A.Call by Reference:If data is passed by reference, a pointer to the data is copied instead of the actual variable as is done in a call by value. Because a pointer is copied, if the value at that pointers address is changed in the function, the value is also changed in main(). Let s take a look at a code example: #include <stdio.h> void call_by_reference(int *y) printf("inside call_by_reference y = %d before adding 10.\n", *y); (*y) += 10; printf("inside call_by_reference y = %d after adding 10.\n", *y); int main() int b=10; printf("b = %d before function call_by_reference.\n", b); call_by_reference(&b); printf("b = %d after function call_by_reference.\n", b); return 0; The output of this call by reference source code example will look like this: b = 10 before function call_by_reference. Inside call_by_reference y = 10 before adding 10. Inside call_by_reference y = 20 after adding 10. b = 20 after function call_by_reference.

24 Here,we start with an integer b that has the value 10. The function call_by_reference() is called and the address of the variable b is passed to this function. Inside the function there is some before and after print statement done and there is 10 added to the value at the memory pointed by y. Therefore at the end of the function the value is 20. Then in main() we again print the variable b and as you can see the value is changed (as expected) to Discuss about Functions and Procedures.. A. Differences between Function and Procedures Procedure 1. Procedure is a subprogram which is included with in main program. Function Function is sub program which is intended for specific task. Eg. sqrt() 2. Procedure do not return a value. Function may or may not return a value 3. Procedure cannot be called again and again. 4. Global variables cannot be used in procedure. 5. Procedures can be write only in procedural programming such as Dbase, Foxpro. Etc., Function once defined can be called any where n number of times. In functions both local and global variables can be used. Functions can be written in modular programming such as C,C++

25 UNIT-IV Arrays in C Model Questions Short Answer Type Questions - 2 Marks 01. What is an array? A) Array can be defined as a collection of data objects of same type which are stored in consecutive memory locations with a common variable name. 2. What are the different types of arrays? A) Arrays are two types. 1. single dimensional arrays 2. two dimensional arrays. 3. How to declare an array? A. The array must be declared as other variables, before its usage in a C program. The array declaration included providing of the following information to C compiler. - The type of the array (ex. int, float or char type) - The name of the array ( ex a[ ], b[ ], etc) - Number of subscripts in the array - whether one dimensional or Two-dimensional Ex: int a[5], float x[3][4]; 4. Write a C program to print IPE using one dimensional array. A. #include<stdio.h> void main() char r[3] = "IPE"; inti; clrscr(); for (i=0; i<=2; ++i) printf("%c",r[i]); getch(); 5. What is two-dimensional array? Write its application. A. An array with two subscripts is termed as two-dimensional array. The two-dimensional array enables us to store multiple rows of elements. 6. What is the String handling functions. A. 1. strlen(s1) 2. strcmp(s1,s2) 3. strcpy(s1,s2) 4. strcat(s1,s2) Long Answer Type Questions - 6 Marks 7. Define an Array. Explain one-dimensional array. A.Array:Array can be defined as a collection of data objects of same type which are stored in consecutive memory locations with a common variable name.array might be belonging to any of the data types(i.e., int,float or char). o Array size must be a constant value. o o Always, Contiguous (adjacent) memory locations are used to store array elements in memory. It is a best practice to initialize an array to zero or null while declaring, if we don t assign any values to array. Example:

26 o int a[10]; // integer array o char b[10]; // character array i.e. string One dimensional array : o Syntax : data-type arr_name[array_size]; Array declaration Array initialization Accessing array Syntax: data_typearr_name [arr_size]; data_typearr_name [arr_size]= (value1, value2, value3,.); arr_name[index]; int age [5]; int age[5]=10, 20,30,40,50; char x[3]; char x[3]= H, a, i ; age[0];_/*10_is_accessed*/ age[1];_/*20_is_accessed*/ age[2];_/*30_is_accessed*/ age[3];_/*40_is_accessed*/ age[4];_/*50_is_accessed*/ x[0];_/*h is accessed*/ x[1]; /*a is accessed*/ x[2]; /* i is accessed*/ Example program for one dimensional array in C: #include<stdio.h> void main() inti; int age[5] = 10,20,30,40,50; // declaring and Initializing array in C for (i=0;i<5;i++) // Accessing each variable printf("value of age[%d] is %d \n", i, age[i]); Output: value of age[0] is 10 value of age[1] is 20 value of age[2] is 30 value of age[3] is 40 value of age[4] is Explain about two - dimensional array? A. Two dimensional array in C: Two dimensional array is nothing but array of array. syntax : data_typearray_name[num_of_rows][num_of_column] Array declaration Array initialization Accessing array o o Syntax: data_typearr_name [num_of_rows][num_of_column]; Example: intarr[2][2]; Example program for two dimensional array in C: data_typearr_name[2][2] = 0,0,0,1,1,0,1,1; intarr[2][2] = 1,2, 3, 4; arr_name[index]; arr [0] [0] = 1; arr [0] ]1] = 2; arr [1][0] = 3; arr [1] [1] = 4;

27 #include<stdio.h> int main() inti,j; // declaring and Initializing array intarr[2][2] = 10,20,30,40; for (i=0;i<2;i++) for (j=0;j<2;j++) // Accessing variables printf("value of arr[%d] [%d] : %d\n",i,j,arr[i][j]); Output: value of arr[0] [0] is 10 value of arr[0] [1] is 20 value of arr[1] [0] is 30 value of arr[1] [1] is Explain how to declare, initialize array of char type. A. Array declaration Array initialization Accessing array Syntax: data_typearr_name [arr_size]; char x[3]; data_typearr_name [arr_size]= (value1, value2, value3,.); char x[3]= H, a, i ; arr_name[index]; /*creating a single dimensional array of characters and displaying them*/ #include<stdio.h> #include<conio.h> void main() inti,j,n; char a[10]; clrscr(); printf("\n how many elements"); scanf("%d",&n); printf("\n enter %d characters line by line\n",n); for(i=0;i<n;++i)scanf("\n%c",&a[i]); printf("\n given array\n"); for(j=0;j<n;++j)printf("\n%c",a[j]); getch(); how many elements 5 enter 5 characters line by line h e l x[0];_/*h is accessed*/ x[1]; /*a is accessed*/ x[2]; /* i is accessed*/

28 l o given array h e l l o 10. Write a C program to sort a list of numbers. A. Sorting means arranging the elements either in ascending order or descending order. Given elements: 34,56,45,21,89,78 Ascending order: 21, 34,45,56,78,89 Descending order: 89,78,56,45,34,21 /* Bubble sort */ #include <stdio.h> #include<conio.h> void main() int array[100], n, c, d, swap; clrscr(); printf("enter number of elements:"); scanf("%d", &n); printf("enter %d integers\n", n); for (c = 0; c < n; c++) scanf("%d", &array[c]); printf("\n Given Array\n"); for (c = 0; c < n; c++) printf("\n%d",array[c]); for (c = 0 ; c < n - 1 ; c++) for (d = 0 ; d < n - c - 1; d++) if (array[d] > array[d+1]) /* For decreasing order use < */ swap = array[d]; array[d] = array[d+1]; array[d+1] = swap; printf("sorted list in ascending order:\n"); for ( c = 0 ; c < n ; c++ ) printf("%d\n", array[c]);

29 getch(); Input: Enter number of elements: 6 Enter 6 integers output Given Array Sorted list in ascending order: Write a C program for addition of two matrices. A. /*matrix addition*/ #include <stdio.h> #include<conio.h> void main() Intar,ac,br,bc, c, d, a[10][10], b[10][10], sum[10][10]; clrscr(); printf("enter the number of rows in matrix-a: "); scanf("%d", &ar); printf("enter the number of columns in matrix-a: "); scanf("%d", &ac); printf("enter the number of rows in matrix-b: "); scanf("%d", &br); printf("enter the number of columns in matrix-b: "); scanf("%d", &bc); if (( ar!= br) (ac!=bc)) gotolastpara; printf("enter %d elements of first matrix-a\n",ar*ac); for ( c = 0 ; c <ar ; c++ ) for ( d = 0 ; d < ac ; d++ ) scanf("%d", &a[c][d]); printf("enter %d elements of second matrix-b\n",br*bc); for ( c = 0 ; c <br ; c++ ) for ( d = 0 ; d <bc ; d++ ) scanf("%d", &b[c][d]);

30 for ( c = 0 ; c <ar ; c++ ) for ( d = 0 ; d <ac ; d++ ) sum[c][d] = a[c][d] + b[c][d]; printf("\n matrix-a is \n"); for ( c = 0 ; c <ar ; c++ ) for ( d = 0 ; d < ac; d++ ) printf("%d\t", a[c][d]); printf("\n"); printf("\n matrix-b is\n"); for ( c = 0 ; c <br ; c++ ) for ( d = 0 ; d <bc; d++ ) printf("%d\t", b[c][d]); printf("\n"); printf("sum of entered matrices(a+b):-\n"); for ( c = 0 ; c <ar ; c++ ) for ( d = 0 ; d < ac; d++ ) printf("%d\t", sum[c][d]); printf("\n"); gotoendpara; lastpara: printf("\n rows and columns are not equal, hence can not add matrices"); endpara: getch(); Input Enter the number of rows in matrix-a 2 Enter the number of columns in matrix-a 2 Enter the number of rows in matrix-b 2 Enter the number of columns in matrix-b 3 rows and columns are not equal, hence can not add matrices Enter the number of rows in matrix-a: 2 Enter the number of columns in matrix-a: 2 Enter the number of rows in matrix-b: 2 Enter the number of columns in matrix-b: 2 Enter 4 elements of first matrix-a

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered )   FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING ( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types

More information

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be

More information

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23. Subject code - CCP01 Chapt Chapter 1 INTRODUCTION TO C 1. A group of software developed for certain purpose are referred as ---- a. Program b. Variable c. Software d. Data 2. Software is classified into

More information

UNIT 3 OPERATORS. [Marks- 12]

UNIT 3 OPERATORS. [Marks- 12] 1 UNIT 3 OPERATORS [Marks- 12] SYLLABUS 2 INTRODUCTION C supports a rich set of operators such as +, -, *,,

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

Basics of Programming

Basics of Programming Unit 2 Basics of Programming Problem Analysis When we are going to develop any solution to the problem, we must fully understand the nature of the problem and what we want the program to do. Without the

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

More information

C - Basic Introduction

C - Basic Introduction C - Basic Introduction C is a general-purpose high level language that was originally developed by Dennis Ritchie for the UNIX operating system. It was first implemented on the Digital Equipment Corporation

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

More information

Multiple Choice Questions ( 1 mark)

Multiple Choice Questions ( 1 mark) Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS)

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) FACULTY: Ms. Saritha P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) SUBJECT / CODE: Programming in C and Data Structures- 15PCD13 What is token?

More information

These are reserved words of the C language. For example int, float, if, else, for, while etc.

These are reserved words of the C language. For example int, float, if, else, for, while etc. Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.

More information

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below: Q1. Explain the structure of a C program Structure of the C program is shown below: Preprocessor Directives Global Declarations Int main (void) Local Declarations Statements Other functions as required

More information

Operators and Expressions:

Operators and Expressions: Operators and Expressions: Operators and expression using numeric and relational operators, mixed operands, type conversion, logical operators, bit operations, assignment operator, operator precedence

More information

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities SOLUTION OF CONTINUOUS INTERNAL EVALUATION TEST -1 Date : 27-02 2018 Marks:60 Subject & Code : Programming in C and Data Structures- 17PCD23 Name of faculty : Dr. J Surya Prasad/Mr. Naushad Basha Saudagar

More information

'C' Programming Language

'C' Programming Language F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax

More information

C Programming Class I

C Programming Class I C Programming Class I Generation of C Language Introduction to C 1. In 1967, Martin Richards developed a language called BCPL (Basic Combined Programming Language) 2. In 1970, Ken Thompson created a language

More information

Unit 3 Decision making, Looping and Arrays

Unit 3 Decision making, Looping and Arrays Unit 3 Decision making, Looping and Arrays Decision Making During programming, we have a number of situations where we may have to change the order of execution of statements based on certain conditions.

More information

Module 6: Array in C

Module 6: Array in C 1 Table of Content 1. Introduction 2. Basics of array 3. Types of Array 4. Declaring Arrays 5. Initializing an array 6. Processing an array 7. Summary Learning objectives 1. To understand the concept of

More information

Vidyalankar. F.E. Sem. II Structured Programming Approach Prelim Question Paper Solution

Vidyalankar. F.E. Sem. II Structured Programming Approach Prelim Question Paper Solution 1. (a) 1. (b) 1. (c) F.E. Sem. II Structured Programming Approach C provides a variety of stroage class specifiers that can be used to declare explicitly the scope and lifetime of variables. The concepts

More information

PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo

PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo 1. (a)what is an algorithm? Draw a flowchart to print N terms of Fibonacci

More information

Course Outline Introduction to C-Programming

Course Outline Introduction to C-Programming ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,

More information

COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR. VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS

COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR.  VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS S.LAWRENCE CHRISTOPHER, M.C.A., B.Ed., LECTURER IN COMPUTER SCIENCE PONDICHERRY

More information

BCA-105 C Language What is C? History of C

BCA-105 C Language What is C? History of C C Language What is C? C is a programming language developed at AT & T s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie. C seems so popular is because it is

More information

Computer System and programming in C

Computer System and programming in C 1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign

More information

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size]; Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data

More information

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1 NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST 1 SOLUTION PART 1 1 a Define algorithm. Write an algorithm to find sum and average of three numbers. 4 An Algorithm is a step by step procedure to solve a given problem in finite

More information

Questions Bank. 14) State any four advantages of using flow-chart

Questions Bank. 14) State any four advantages of using flow-chart Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State

More information

Introduction. C provides two styles of flow control:

Introduction. C provides two styles of flow control: Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if

More information

Tutorial No. 2 - Solution (Overview of C)

Tutorial No. 2 - Solution (Overview of C) Tutorial No. 2 - Solution (Overview of C) Computer Programming and Utilization (2110003) 1. Explain the C program development life cycle using flowchart in detail. OR Explain the process of compiling and

More information

KARMAYOGI ENGINEERING COLLEGE, Shelve Pandharpur

KARMAYOGI ENGINEERING COLLEGE, Shelve Pandharpur KARMAYOGI ENGINEERING COLLEGE, Shelve Pandharpur Bachelor of Engineering First Year Subject Name: Computer Programming Objective: 1. This course is designed to provide a brief study of the C programming

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of

More information

JAVA Programming Fundamentals

JAVA Programming Fundamentals Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

More information

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

More information

1. History of C. 2. Characteristics of C. 3. Basic structure of C programs INTRODUCTION TO C

1. History of C. 2. Characteristics of C. 3. Basic structure of C programs INTRODUCTION TO C INTRODUCTION TO C 1. History of C An ancestor of C is BCPL Basic Combined Programming Language. Ken Thompson, a Bell Laboratory scientist, developed a version of BCPL, which he called B. Dennis Ritchie,

More information

Computers Programming Course 7. Iulian Năstac

Computers Programming Course 7. Iulian Năstac Computers Programming Course 7 Iulian Năstac Recap from previous course Operators in C Programming languages typically support a set of operators, which differ in the calling of syntax and/or the argument

More information

Programming in C and Data Structures [15PCD13/23] 1. PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme]

Programming in C and Data Structures [15PCD13/23] 1. PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme] Programming in C and Data Structures [15PCD13/23] 1 PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme] Course objectives: The objectives of this course is to make students

More information

C Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 2 (Minor modifications by the instructor) 1 Scope Rules A variable declared inside a function is a local variable Each local variable in a function comes into existence when the function

More information

UNIT IV INTRODUCTION TO C

UNIT IV INTRODUCTION TO C UNIT IV INTRODUCTION TO C 1. OVERVIEW OF C C is portable, structured programming language. It is robust, fast.extensible. It is used for complex programs. The root of all modern language is ALGOL (1960).

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and

More information

CS6202 - PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1. W hat are Keywords? Keywords are certain reserved words that have standard and pre-defined meaning in C. These keywords can be used only for their

More information

(2½ Hours) [Total Marks: 75

(2½ Hours) [Total Marks: 75 (2½ Hours) [Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written together.

More information

CP FAQS Q-1) Define flowchart and explain Various symbols of flowchart Q-2) Explain basic structure of c language Documentation section :

CP FAQS Q-1) Define flowchart and explain Various symbols of flowchart Q-2) Explain basic structure of c language Documentation section : CP FAQS Q-1) Define flowchart and explain Various symbols of flowchart ANS. Flowchart:- A diagrametic reperesentation of program is known as flowchart Symbols Q-2) Explain basic structure of c language

More information

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions.

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions. Introduction In the programs that we have dealt with so far, all statements inside the main function were executed in sequence as they appeared, one after the other. This type of sequencing is adequate

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions.

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions. 1 of 22 8/4/2018, 4:03 PM Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008

More information

Programming and Data Structures

Programming and Data Structures Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()

More information

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C Overview of C Constants, Variables and Data Types Operators and Expressions Managing Input and Output operators Decision Making

More information

Differentiate Between Keywords and Identifiers

Differentiate Between Keywords and Identifiers History of C? Why we use C programming language Martin Richards developed a high-level computer language called BCPL in the year 1967. The intention was to develop a language for writing an operating system(os)

More information

PART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.

PART I.   Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++. Unit - III CHAPTER - 9 INTRODUCTION TO C++ Choose the correct answer. PART I 1. Who developed C++? (a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai 2. What was the original name

More information

UNIT-I Input/ Output functions and other library functions

UNIT-I Input/ Output functions and other library functions Input and Output functions UNIT-I Input/ Output functions and other library functions All the input/output operations are carried out through function calls. There exists several functions that become

More information

INTRODUCTION TO C A PRE-REQUISITE

INTRODUCTION TO C A PRE-REQUISITE This document can be downloaded from www.chetanahegde.in with most recent updates. 1 INTRODUCTION TO C A PRE-REQUISITE 1.1 ALGORITHMS Computer solves a problem based on a set of instructions provided to

More information

INDORE INDIRA SCHOOL OF CAREER STUDIES C LANGUAGE Class B.Sc. - IIND Sem

INDORE INDIRA SCHOOL OF CAREER STUDIES C LANGUAGE Class B.Sc. - IIND Sem UNIT- I ALGORITHM: An algorithm is a finite sequence of instructions, a logic and explicit step-by-step procedure for solving a problem starting from a known beginning. OR A sequential solution of any

More information

C Programming Multiple. Choice

C Programming Multiple. Choice C Programming Multiple Choice Questions 1.) Developer of C language is. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in. a.) 1970 c.) 1976 b.) 1972 d.) 1980

More information

Advantages of writing algorithm

Advantages of writing algorithm Advantages of writing algorithm Effective communication: Algorithm is written using English like language,algorithm is better way of communicating the logic to the concerned people Effective Analysis:

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer. Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting

More information

Flow Control. CSC215 Lecture

Flow Control. CSC215 Lecture Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements

More information

CCE RR REVISED & UN-REVISED KARNATAKA SECONDARY EDUCATION EXAMINATION BOARD, MALLESWARAM, BANGALORE G È.G È.G È..

CCE RR REVISED & UN-REVISED KARNATAKA SECONDARY EDUCATION EXAMINATION BOARD, MALLESWARAM, BANGALORE G È.G È.G È.. CCE RR REVISED & UN-REVISED B O %lo ÆË v ÃO y Æ fio» flms ÿ,» fl Ê«fiÀ M, ÊMV fl 560 003 KARNATAKA SECONDARY EDUCATION EXAMINATION BOARD, MALLESWARAM, BANGALORE 560 003 G È.G È.G È.. Æ fioê, d È 2018 S.

More information

Java Notes. 10th ICSE. Saravanan Ganesh

Java Notes. 10th ICSE. Saravanan Ganesh Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses

More information

Model Viva Questions for Programming in C lab

Model Viva Questions for Programming in C lab Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous

More information

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler

More information

Department of Computer Applications

Department of Computer Applications Sheikh Ul Alam Memorial Degree College Mr. Ovass Shafi. (Assistant Professor) C Language An Overview (History of C) C programming languages is the only programming language which falls under the category

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

Programming for Engineers Introduction to C

Programming for Engineers Introduction to C Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines

More information

Introduction to C. History of C:

Introduction to C. History of C: History of C: Introduction to C C is a structured/procedure oriented, high-level and machine independent programming language. The root of all modern languages is ALGOL, introduced in the early 1960. In

More information

Module 4: Decision-making and forming loops

Module 4: Decision-making and forming loops 1 Module 4: Decision-making and forming loops 1. Introduction 2. Decision making 2.1. Simple if statement 2.2. The if else Statement 2.3. Nested if Statement 3. The switch case 4. Forming loops 4.1. The

More information

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); }

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); } C Program Output #include main () { printf ( Hi everyone\n ); Hi everyone #include main () { printf ( Hi everyone\n ); #include and main are Keywords (or Reserved Words) Reserved Words

More information

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs PDS Lab Section 16 Autumn-2017 Tutorial 3 C Programming Constructs This flowchart shows how to find the roots of a Quadratic equation Ax 2 +Bx+C = 0 Start Input A,B,C x B 2 4AC False x If 0 True B x 2A

More information

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

More information

BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC ELEMENTS OF A COMPUTER PROGRAM BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators

More information

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array? 1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The

More information

Lecture 3. More About C

Lecture 3. More About C Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants

More information

MODULE 2: Branching and Looping

MODULE 2: Branching and Looping MODULE 2: Branching and Looping I. Statements in C are of following types: 1. Simple statements: Statements that ends with semicolon 2. Compound statements: are also called as block. Statements written

More information

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features

More information

C-LANGUAGE CURRICULAM

C-LANGUAGE CURRICULAM C-LANGUAGE CURRICULAM Duration: 2 Months. 1. Introducing C 1.1 History of C Origin Standardization C-Based Languages 1.2 Strengths and Weaknesses Of C Strengths Weaknesses Effective Use of C 2. C Fundamentals

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

(2½ Hours) [Total Marks: 75

(2½ Hours) [Total Marks: 75 (2½ Hours) [Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written together.

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction In looping, a sequence of statements are executed until some conditions for termination of the loop are satisfied. A program loop consist of two segments Body of

More information

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING SIDDARTHA INSTITUTE OF SCIENCE AND TECHNOLOGY:: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : PROGRAMMING FOR PROBLEM SOLVING (18CS0501) Course & Branch

More information

Problem Solving and 'C' Programming

Problem Solving and 'C' Programming Problem Solving and 'C' Programming Targeted at: Entry Level Trainees Session 05: Selection and Control Structures 2007, Cognizant Technology Solutions. All Rights Reserved. The information contained herein

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Introduction to the C language Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 29, 2012 G. Lipari (Scuola Superiore Sant Anna) The C language

More information

M1-R4: Programing and Problem Solving using C (JAN 2019)

M1-R4: Programing and Problem Solving using C (JAN 2019) M1-R4: Programing and Problem Solving using C (JAN 2019) Max Marks: 100 M1-R4-07-18 DURATION: 03 Hrs 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter

More information

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++ CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

More information

(i) Describe in detail about the classification of computers with their features and limitations(10)

(i) Describe in detail about the classification of computers with their features and limitations(10) UNIT I - INTRODUCTION Generation and Classification of Computers- Basic Organization of a Computer Number System Binary Decimal Conversion Problems. Need for logical analysis and thinking Algorithm Pseudo

More information

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6

More information

Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Data Types Basic Types Enumerated types The type void Derived types

More information

Dept. of CSE, IIT KGP

Dept. of CSE, IIT KGP Control Flow: Looping CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of Repeated Execution Loop: Group of

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction Operator: An operator is a symbol that tells the Computer to perform certain mathematical or logical manipulations. Expression: An expression is a sequence of operands

More information