About Me

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

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











No comments:

GCD of two numbers and its application...

The greatest common divisor (gcd) of two numbers is the largest positive integer that divides both numbers without leaving a remainder. The ...