About Me

My photo
Vijayapur, Karnataka, India
I am interested in Teaching.

Monday 24 August 2020

Tips to pass the C for Problem Solving Back Subject for I and II sem B.E. (VTU, Belagavi)

 Dear students,

Always explain more about the asked question and underline the important points.

Do not forget to write SYNTAX and do not forget draw FLOWCHART

Draw BOX around syntax.

Give more examples for asked questions. You can write core part of a program or entire program.

Prepare some programming examples for each topic. 

To calculate simple interest

To calculate are and perimeter of rectangle

Largest of two numbers.

Largest of three numbers.

To check for leap year

To find roots of quadratic equation.

To check for PALINDROME

To print first N fibonacci numbers.

To find matrix multiplication

To implement BUBBLE SORT

To read and display N students information using array of structure

Programming example for dynamic memory allocation.

To swap (interchange) two values using pointer.

Note: If you these programming questions then well and good. Otherwise use these programs as EXAMPLES for respective topics.

Worst case assume that, for one page answer you get 1 marks.

The you need to write minimum 20 pages (front and back 40 pages) to pass the subject. (Safer Side)

Eventhough, you write less pages with quality points,,, you pass...

All teachers are interested to PASS you...But...you need to write more with quality points, syntax, flowchart and programming examples. Most of the students will not do.

All teachers are good...Everyone wants to PASS you...no one is interested to FAIL you..So, please write more.

For Exam preparation...prepare in REVERSE order i.e. 

Module-5 Important topics.

Preprocessor, Pointer, Dynamic Memory Allocation, Structure, Array of Structure

Module-4 Important Topics

Functions, Types, Categories, Actual and Formal Parameters, Call by value and Call by reference, Recursive functions

Module-3 Important Topics

1D array

2D array

Bubble sort program, Matrix Multiplication

Module-2 Important Topics

simple if, if else, nested if, else if ladder, switch

while , do while and for

break , continue, goto

Module-1 Important Topics.

Block diagram of computer

Types of computers

Generations of computers

Input and Output devices.

C tokens

Structure of C Program

Formatted Input and Output Functions

Operators(arithmetic, relational, logical, increment and decrement, bitwise, condition, special)

....

ALL THE BEST



Important C programs for C for Problem Solving for I and II sem of Engineering Students (As per VTU)

 C program to calculate simple interest.


# include<stdio.h>
void main()
{
float p, t, r, si;


printf("Enter P T R ");
scanf("%f%f%f",&p,&t,&r);


si=(p*t*r)/100;


printf("\n Simple Interest is %f", si);
}


Output:
Enter P T R 
100 5 5 [Enter Key]
Simple Interest is 
25.00


 C program to calculate area and perimeter of rectangle.


# include<stdio.h>
void main()
{
float l, b, area, per;


printf("Enter length and breadth of rectangle  ");
scanf("%f%f", &l, &b);

area=l*b;

per=2*(l+b);


printf("\n Area of rectangle is %f", area);

printf("\n Perimeter rectangle is %f", per);

}


Output:
Enter length and breadth of rectangle
10 20 [Enter Key]
Area of rectangle is 200.00
Perimeter of rectangle is 60.00


C program to check for PALINDROME or not.


# include<stdio.h>
void main()
{
int n, rem, rev=0, temp;


printf("Enter a number to be check   ");
scanf("%d",&n);

temp=n;

while (n!=0)

{
rem=n%10;
rev=(rev*10)+rem;
n=n/10;
}

if (rev==temp)

printf("\n PALINDROME");

else

printf("\n NOT Palindrome ");

}


Output:

Enter a number to be check

123
NOT Palindrome

Output:

Enter a number to be check

121
PALINDROME


Monday 17 August 2020

C for Problem Solving (Tips and Important Questions to pass the this subject) Module Wise Important Questions (I and II Sem VTU Syllabus)

 Module-1 ( Use my YouTube Channel for explanation) CHIDANAND S KUSUR

Explain the "Structure of Computer" with neat block diagram. [2 + 3 + 5 =10 Marks]

Tips:

Write What is computer? ...You get 2 marks

Draw diagram: 3 marks 

Input Unit

System Unit : Memory Unit + [ALU + CU]

Output Unit

Explanation of All Units: 5 marks

List of input devices with explanation in brief about each.

List of output devices with explanation in brief about each.

Generations of Computers

Types of Computers


What are C tokens? List and explain all in brief. (2 m + 1 m + 6 m = 9 marks)

What are C tokens? 2 marks

List: 1 mark

Keywords

Identifiers

Constants

Strings

Operators

Special Symbols

Explain all the above 6 : 6 marks


What are formatted I/O functions? List and discuss with syntax and examples.

(2 m + 3 m + 3 m = 8 m)

What are formatted I/O functions? 2 marks

scanf() : Explanation, Syntax, Examples (3 m)

printf() : Explanation, Syntax, Examples (3 m)


What are identifiers? Write rules for defining identifiers with valid and invalid examples for each rule.


Explain "Structure of C Program" with programming example.

[Documentation Part]

[Preprocessor Part]

[Global Part]

int main()

{

declaration part;

executable part;

return (0);

}

[User defined function]

Explain all the above parts with examples.

Give one programming example that covers all the parts.


Write C programs for following

To calculate simple interest

si=(p*t*r)/100;

input: p, t, r

output: si

To find area and perimeter of rectangle.

area=(l*b)

p=2*(l+b)

To find area and circumference of a circle

area=3.142*r*r

cir=2*3.142*r

To find area of triangle by reading breadth and height

area=0.5*breadth*height

To find area of triangle by reading three sides of it.

s=(a+b+c)/2

area=sqrt((s-a)*(s-b)*(s-c))


Module -2

Discuss the following decision making or selection or branching or conditional statements with syntax, flowchart and examples.

simple if

if else

nested if

else if ladder (cascaded if)

switch

Note:

Explain all the above with explanation (1 mark) syntax (2 marks) flowchart (2 marks) Examples (2 marks) for all

Discuss following loop statements with syntax , flowchart and examples.

while

do while

for


Write differences between while and do while

Write differences between break and continue statements.

Write C programs for following

Largest of three numbers

To check for leap year or not

To check for PALINDROME

To check for PRIME number

To find factorial of N

To find GCD and LCM of two numbers


Module 3

What is 1D array? Discuss its declaration and initialization with syntax and examples.

What is 2D array? Discuss its declaration and initialization with syntax and examples.


Module 4

Discuss the three elements of user defined function with syntax and examples.

What are actual and formal parameters?Give example.

Discuss 4 categories of function with programming examples.

Write difference between call by value and call by reference

What is recursive function?Give example.

Module 5

What is structure?Discuss defining structure and structure variables with syntax and examples.

What array of structure?Give programming example.

What is nested structure?Give example.


What is pointer?Discuss its declaration and syntax with examples.

What is dynamic memory allocation?Give programming example.

Discuss malloc, calloc, realloc, free with examples.


Write C program to swap two values using pointers.

Write C program to read and display N students information using array of structure.


What are preprocessors?Discuss three types with examples.

Answer:

Preprocessors are the pre processing tools.

These will be executed before the COMPILATION of C program.

There are helpful to add HEADER files, define SYMBOLIC constants , add EXTERNAL C files and to write compatible C programs.

Types of Preprocesors:

1. Macro substitution directives.

    There are helpful to define symbolic constants.

    Examples:

    #define PI 3.142

    # define MAX 100

    # define MIN 0

     # define N 50

    # define SIZE 100

2. File inclusion directives.

     There are helpful to add header files in C programs. So that, we can access the contents of these header files. Although, helps to add other external C files. So that, we can access the sub programs (user defined functions) to do specific task in current program.

Examples:

# include<stdio.h>

#include<math.h>

#include "string.h"

#include "alloc.h"

#include "d:\\demo\\p1.c"


3. Compiler control directives.

   There are helpful to write portable C programs. i.e. helps to run the same C program on different hardware platform.

Example:

#if (MACHINE==HCL)

#define file "hcl.h"

elif (MACHINE==WIPRO)

#define file "wipro.h"

elif (MACHINE==DELL)

#define file "dell.h"

endif

#include file



All the best!

Put faith on you....This time you can.....

All the best

Write more in exam

Underline important points.

Practice programs, if you wont get in exam, write as examples.

Explanation Syntax and Examples ....compulsory for all questions

All the best.....


NOTE: SEND FEEDBACK

WRITE COMMENTS

WATCH MY YOUTUBE CHANNEL CHIDANAND S KUSUR AND SUBSCRIBE

9739762682

cs.kusur@gmail.com