silver oak college of engineering ... oak college of engineering & technology ahmedabad computer...

26
CPU (2110003) Page 1 SILVER OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016

Upload: dominh

Post on 08-Mar-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 1

SILVER OAK COLLEGE OF ENGINEERING & TECHNOLOGY

AHMEDABAD

Computer Programming and Utilization

(2110003)

BOOKLET 2015 -2016

Page 2: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 2

INDEX

Sr. No Topic Page No.

1

Syllabus

3

2

Lesson Planning

5

3 Practical List 7

4

Assignments and Question Bank

10

5

Find Output/ Write Programme

16

6

Objective Type Question

21

Page 3: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 3

Syllabus

Sr.

No. Topics

Teaching

Hrs.

Module

Weightage

1

Introduction to computer and programming:

Introduction ,Basic block diagram and functions of various components of

computer,Concepts of Hardware and software,Types of

softwares,Compiler and interpreter, Concepts of Machine level, Assembly

level and high level programming ,Flow charts and Algorithms.

05

10%

2

Fundamentals of C

Features of C language, structure of C Program, comments, header

files,data types, constants and variables, operators, expressions, evaluation

of expressions, type conversion, precedence and associativity, I/O

functions

05

15%

3

Control structure in C

Simple statements, Decision making statements, Looping statements,

Nesting of control structures, break and continue , goto statement 06

15%

4

Array & String

Concepts of array , one and two dimensional arrays,declaration and

initialization of arrays ,string , string storage , Built-in-string functions

05

15%

5

Functions

Concepts of user defined functions, prototypes, definition of function,

prarameters, parameter passing , calling a function, recursive function

,Macros , Pre-processing

05

15%

6

Pointers

Basics of pointers, pointer to pointer , pointer and array , pointer to array,

array of pointers , functions returning a pointer

03

10%

7

Structure

Basics of structure , structure members, accessing structure members

,nested structures , array of structures, structure and functions, structures

and pointers

02

10%

Page 4: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 4

NOTE: MID 1semester Examination syllabus: Unit: 1,2,3(up to looping)

MID 1semester Examination syllabus: Unit: 3(remaining),4,5 (As per GTU

Syllabus)

TextBook :

1. COMPUTER PROGRAMMING AND UTILIZATION, E. Balagurusamy, TMH

2.Programming in ANSI C, Forth Edition, E Balagurusamy, TMH

3. Programming in C Ansi standard, by Yashwant Kanetkar

8

Dynamic memory allocation

Introduction to Dynamic memory allocation, malloac, Calloc 02

05%

9

File management

Introduction to file management and its functions 03

05%

Total 36

Page 5: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 5

Lesson Planning

Branch

Lect.

No. Topics To Be Covered

Remarks

UNIT 1 : Introduction to computer and programming:

1. Introduction ,Basic block diagram and functions of various components

of computer

2. Concepts of Hardware and software, Types of softwares

3. Compiler and interpreter, Concepts of Machine level, Assembly level

and high level programming

4. Flow charts and Algorithms.

UNIT 2 : Fundamentals of C

5. Features of C language, structure of C Program, comments,

6. header files, data types

7. Constants and variables, operators, expressions, evaluation of

expressions,

8. Type conversion, precedence and associativity

9. I/O functions

UNIT 3 : Control structure in C

10. Simple statements, Decision making statements

11. Looping statements

12. Nesting of control structures

13. Break and continue , goto statement

UNIT 4 : Array & String

14. Concepts of array , one dimensional arrays,

15. Two dimensional arrays

16. declaration and initialization of arrays

17. String , string storage , Built-in-string functions

UNIT 5: Functions

18. Concepts of user defined functions

19. Prototypes, definition of function

20. parameters, parameter passing

21. Calling a function

22. recursive function

23. Macros , Pre-processing

Page 6: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 6

UNIT 6: Pointers

24. Basics of pointers, pointer to pointer

25. Pointer and array , pointer to array ,

26. Array of pointers , functions returning a pointer

UNIT 7: Structure

27. Basics of structure , structure members ,

28. Accessing structure members ,nested structures

29. Array of structures, structure and functions

30. Structures and pointers

Unit 8 : Dynamic memory allocation

31. Introduction to Dynamic memory allocation

32. malloac, Calloc

UNIT 9: File management

33. Introduction to file management

34. Its functions

1st Mid Sem Exam Starts From: 18/3/2016

Mid Sem Exam Syllabus: UNIT – 1,2,3(upto looping)

2nd Mid Sem Exam Starts From:. 23/4/2016

Mid Sem Exam Syllabus: UNIT – 3(remaining),4,5

Mr.Raunakraj Patel Mr. Jaimin Dave Mr. Satvik V. Khara Mr. Nayan I. Patel

Subject Coordinator H.O.D. (IT) H.O.D. (CE) H.O.D. (Gen. Dept.)

Page 7: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 7

Practical List

Note: Programs followed by * symbol are of same category in Unit and for self-implementation in

Assignment work.

PRACTICAL 1 : Basic Programs Remark

1.1 Write a Program to display “WELCOME TO SILVER OAK

INSTITUTE OF TECHNOLOGY” on the screen.

1.2* Write a Program to which accepts a character from keyboard &

display its ASCII code.

1.3 Write a program that reads two nos. from key board and gives their

addition, subtraction, multiplication, division and modulo.

1.4* Write a program to convert days into months and days.

1.5*

The distance between two cities (In KM) is input through key

board. Write a program to convert and print this distance in meters,

feet, inches & centimeters.

1.6 Write a program to swap (interchange) values of two variables

with and without using third variable.

PRACTICAL 2 : Basic Calculations

2.1* Write a Program to convert the Celsius to Fahrenheit.

F=(C*1.8)+32

2.2 Write a Program to find out simple interest.

I=(P*R*N)/100

2.3 Write a program to solve Quadratic Equation.

PRACTICAL 3 : Control Structure

3.1 Write a program to reverse sequence of digit.

3.2 Write a program to print first N prime numbers.( no factor other

than 1 & itself)

3.3

Write a program to print Armstrong number ( or Narcissistic no)

between 0 to 999.( Armstrong no= addition of cube of every digit

of a no, e.g. 153 is Armstrong due to 13+53+33=153)

3.4 Write a program to find out whether a number is odd / even by

using different if..else statements.

3.5* Write a program to find minimum no out of three numbers by

using Conditional Operator(nested..if ).

3.6 Write a program to make simple calculator using switch..case

statement.

3.7* Write a program to find sum of all integers greater than 100 & less

than 200 and are divisible by 5.

3.8* Write a program to find whether a number is palindrome or not.

PRACTICAL 4 : Pattern Programs:(WAP to print pattern like below)

Page 8: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 8

4.1

*

* *

* * *

* * * *

4.2

1

2 2

3 3 3

4 4 4 4

4.3*

1

0 1

1 0 1

0 1 0 1

4.4*

4 3 2 1

3 2 1

2 1

1

4.5*

1

A B

2 3 4

C D E F

PRACTICAL 5 : Series Programs

5.1 Write a program for following Series:

1 + 3 + 5 +… + n

5.2 Write a program for following Series: 13 + 23 + 33 + 43 … + n3

5.3 Write a Program to print Fibonacci series.(1 1 2 3 5 8 13……)

5.4* Write a program to print 1+1/2+1/3+1/4+………+1/N series.

PRACTICAL 6 : Array Programs

6.1 Write a program to display Sum and average of any 10 no. using 1-

D Array.

6.2 Write a Program to Find largest odd number from given 1-D

Array.

6.3* Write a program to read array of integers and print it in reverse

order

6.4* Write a program to Sort given Array in Descending Order.

6.5 Write a program to Add two Matrices. i.e. C= A + B

6.6* Write a program to Multiply two 3X3 Matrices. i.e. C= A * B

PRACTICAL 7 : String Programs

7.1 Write a program to Find String Length without using inbuilt

function.

7.2 Write a program to Count no. of Vowels in given String.

7.3 Write a program to append one string to another String.

7.4 Write a program to check whether given String is Palindrome or

not.

7.5* Write a program to copy one string to another string

Page 9: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 9

7.6* Write a program to count no of words in a sentence.

7.7* Write a program convert character into TOggLe character.

PRACTICAL 8 : Programs using Functions

8.1

Write a Program using function to Add 1st n numbers and also Find

out Average of 1st n numbers.

(Where n is enter through Keyboard.)

8.2* Write a Program using function to Find out Cube of any given

number N.

8.3 Write a Program using function to Find out Factorial of given

number with and without recursion.

8.4* Write a calculator program(add,subtract,multiply,divide). Prepare

user defined function for each functionality.

8.5* Write a function prime that return 1 if it‘s argument is prime and

return 0 otherwise.

PRACTICAL 9 :Pointer

9.1 Write a program to print an address of a variable.

9.2 Write a program to change the value of a variable using pointer.

9.3 Write a program using pointer to compare two strings.

9.4* Write a program using pointer to read an array of integer and print

elements in reverse order.

9.5* Write a program using pointer to copy one string to another string.

PRACTICAL 10 : Structure

10.1 Define a structure called cricket that will describe the following

information: a. Player name b. Team name c. Batting average

10.2* Write a function to enter Roll no, marks of the three subject for 3

student and find total obtained by each student.

PRACTICAL 11 : Dynamic Memory Management

11.1 Write a program that uses a table of integers whose size will be

specified interactively at run time.

11.2*

Write a program to store a character string in block of memory

space created by malloc and then modify the same to store a large

string.

PRACTICAL 12 : File Management

12.1 Write a program to create a file and perform basic I/O operations

on the same.

12.2* Write a program to illustrate the use of fputc(), fputs(), and fgets()

Page 10: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 10

Assignments Cum Question Bank

Note: Section A is compulsoryquestions, which will be done by students as assignments.

Section B is questions bank from all the respective units.

SECTION: A

Assignment - 1

Unit-1

SR. NO. QUESTIONS

1 Draw block diagram of computer system. Explain each part of it.

2 Define following

1) Operating System 2) Compiler 3) Interpreter 4) Assembler 5) Loader 6) Linker 7)

Preprocessor

3 What is Software and Hardware? Explain different types of Software.

4 Define algorithm and explain different symbols used in flowchart.

5 List and explain types of computer languages.

6 Explain fundamental data types of ‘C’ language.

SECTION: A

Assignment - 2

Unit-2

1 Explain different type of operators used in C language.

2 Explain the precedence and associativity of the different operators in C language.

3 What is difference between keywords and identifiers?

4 Explain the different rules for naming an identifier.

5 What is Type conversion and Type casting? State difference between them.

6 Explain implicit type conversion andexplicit type conversion with example.

7 Why type conversion is necessary?

8 Scope and Lifetime of Variable.

SECTION: B

Unit-1&2

SR. NO. QUESTIONS PAPER MARKS

1 What is flow chart? Draw the flow chart to add first 20 odd

numbers

June-

2013

4

2 Draw a flowchart to count odd numbers and making their total

from givenN numbers.

June-

2011

8

3 Provide two major differences between June- 3

Page 11: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 11

a. Software and Hardware

b. Flowchart and Algorithm

2010,

Jan-2010

4 Define following:

I. Application software

II. System Software

June-

2009

2

5 Write an algorithm and draw the flowchart to accept N

numbers and count how many of them where odd and also

compute sum of all these odd.

June-

2010

7

6 Draw flowchart to solve following series 1! + 2! + 3! + …..+

n!

June-

2009

5

7 Write an algorithm and draw a flowchart to print first N

Fibonacci numbers.

Jan-2015 7

8 Write an algorithm and draw the flow chart to find the largest

of the given three numbers – A ,B and C.

Dec-

2013

7

9 Justify, “C” is middle level language June-

2011

1

10 Explain in brief the features of C language. June-

2010

4

11 Explain the turnery operator in C. June-

2010

2

12 Explain the various I/O function with example in C. June-

2010

6

13 Explain printf() and scanf() giving their syntax Dec-

2011

3

14 Compare: Object and Procedure oriented programming. June-

2009

5

15 Draw a flow chart to do the sum of 10 elements read from the

user.

June-

2014

5

16 What is a User Defined Data type? What is the scope and life

time of variable?

Dec-

2011,

Jan-2010

7

SECTION: A

Assignment - 3

Unit-3

SR. NO. QUESTIONS

1 Explain “if-else-if ladder” with appropriate flow chart and ‘C’ syntax.

2 State the syntax of Switch-case statement. Explain it with appropriate example.

3 What do you understand by looping?

4 Explain different types of loops in C with example.

5 Explain the difference between entry control loop and exit control loop.

Page 12: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 12

SECTION: A

Assignment - 4

Unit-4

1 What is array? Explain single and multidimensional with examples.

2 Explain break and continue with example.

3 What is String? How are they declared?

4 Write short note on null character.

5 Describe following string functions in C-Language.

1) strcpy()

2) strcat()

3) strlen()

4) strcmp()

SECTION: B

Unit-3&4

SR. NO. QUESTIONS PAPER MARKS

1 Write short notes on following:

(i) Nested if..else statement.

(ii) Use of break and continue statement

Jan-2013 7

2 What is looping? Explain different types of loops in C and

compare them. Show how to sum 1 to 10 using each of these

loops.

June-2011 7

3 Explain branching and looping in with example code. Jan-2010 7

4 Explain for loop. Differentiate use of continue, break and go

to statement.

April-

2010

7

5 What is a string? How string is stored in C? Give the various

functions withtheir use for string processing.

June-2010 6

6 What is string? Write a program to reverse the input string. Dec-2013 7

7 What is infinite loop in C? How can you create it? Give an

example of situation where you need to use infinite loop?

Dec-2011,

June-2010

7

SECTION: A

Assignment - 5

Unit-5 SR. NO. QUESTIONS

1 What is user-defined function? Explain actual argument and formal arguments?

2 What do you mean by recursive function? Write a program in c to find factorial of a

number using recursive function.

Page 13: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 13

3 Explain the difference between call by reference and call by value with proper example

4 Write short note on category of function.

5 Explain different type of functions used in c language.

6 Write a program using function to find maximum if two numbers

SECTION: A

Assignment - 6

Unit-6 1 What is pointer? Explain how pointers are declared.

2 Explain the initialized of a pointer variable. How it is differentfrom Array?

3 Explain arrays of pointer using suitable sample program.

4 What are the benefits of the Pointer?

5 Write a program to do swapping of two elements using function with two pointers as

arguments?

SECTION: B

Unit 5&6

SR. NO. QUESTIONS PAPER MARKS

1 What is function? Explain the function definition, function

prototype and function call with example

Dec-2013 7

2 Give a prototype of function accepting an integer pointer and

a float asarguments and returns nothing.

June-2011 1

3 Define an array of 10 integer pointers. June-2011 1

4 What are default arguments? Demonstrate its use with proper

example.

June-2011 7

5 Give the meaning of

int (*f)(int,int) and int *f(int,int);

June-2011 1

6 What is Pointer in C? Explain its advantages. Winter-

2014

3

7 Explain various categories of functions with suitable example.

Explain any one category with example.

June -

2014,

Dec-2014

7

8 How to initialize Pointer? Explain arrays of pointer using

suitable sample program. June-2015 4

Page 14: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 14

SECTION: A

Assignment - 7

Unit-7

SR. NO. QUESTIONS

1 Illustrate the concept of “structure”?

2 Explain how can we access structure members?

3 What is structure? Explain nested structure.

4 Explain the array of structure with example.

5 Distinguish between Structure and Union.

SECTION: A

Assignment - 8

Unit-8

1 Give comparison of Static Memory Allocation and Dynamic MemoryAllocation with a

code snippet.

2 Explain the use of malloc and calloc function with their syntax and compare both.

SECTION: A

Assignment - 9

Unit-9

1 What is a file? List the various file handling operations in c.

2 What is file management? List the different file management functions.

3 Explain the various file modes in C language.

SECTION: B

Unit 7, 8 & 9 SR. NO. QUESTIONS PAPER MARKS

1 Define an array of structure with integer, string and float as

members. Size of array is 10.

June-2011 1

2 What is structure? How can we access structure members?

Clear use of nested structure using example. Compare

structure with union

June-2011 7

Page 15: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 15

3 Give one example for Array of structure and explain the

meaning.

June-2010 3

4 How can you allocate memory dynamically for 10 floating

pointnumbers?

June-2011 1

5 Recall the definition of dynamic memory allocation?

Differentiate between malloc and calloc?

Winter-

2014

4

6 What is structure? How does a structure differ from an array?

How is an array of structure initialized?

Dec-2013 7

7 What is structure ? Explain nested structure and array of

structure with example.

June-2014 7

8 Describe file management? Recall various file modes. Winter-

2014

3

Page 16: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 16

FIND THE OUTPUT / WRITE A PROGRAM.

Unit 2: Fundamentals of C

SR NO. QUESTIONS PAPER MARKS

1 What will be the output of following code.

int x = 10;

void main()

{

int x = 15,y;

y = x++;

printf(“%d %d”,++y, x++);

}

June-

2011

2

2 What will be the output of following code.

void main()

{

int iX=7,iY=8,iZ=9;

printf(“\n %d %d %d”,++iX,iX,iX++);

printf(“\n %d %d %d”, iZ,++iZ,iZ++);

}

June-

2009

4

3 What will be the output of following code.

{

int x = 10, y=15;

x = x++;

y = ++y;

printf(“%d, %d \n” , x, y);

}

(A) 10, 15 (B) 10, 16 (C) 11, 16 (D) 11, 15

Dec-

2013

1

4 Write a program to convert temperature entered by user from

Fahrenhit into Celcius

April-

2010

5

Unit 3: Control structure in C

SR NO. QUESTIONS PAPER MARKS

1 What will be the output of following code.

x = 1,2,3;

a = (b = 4, c = 5, b+c);

if( x = 5)

printf(“x is even\”);

else

printf(“x is odd\n”);

June-

2010

3

2 What will be the output of following code.

int i;

June-

2011

2

Page 17: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 17

for(i=5;i<15;i++)

{

printf(“%d\n”,i);

i = i – 1;

}

3 Give output of following .

main()

{ int n=6, t=1;

for(;n<10;n=n+2)

printf(“%d %d\n”,n ,++ t); }

April-

2010

4

4 Write a program to select and print the largest of the three nos.

using nested-if-else statement

June-

2014

7

5 Write a program to perform addition, multiplication,

subtraction and division with switch statement

June-

2014

7

6 Write a program in C to generate Fibonacci series like

following:

1, 1, 2, 3, 5, 8, 13…….

Generate 20 such numbers

Dec-

2011,

Dec-

2010

7

7 Write a program to find the sum of first N odd numbers. Dec-

2013

7

8 Write a C Program to check whether the given number is

prime or not

Jan-2015

Jan-2013

4

9 Write a program to print the following pattern.

*

* *

* * *

* * * *

June-

2014

7

10 Write a program to display following pattern using nested for

loops.

* * * * *

* * * *

* * *

* *

*

Dec-

2011

7

11 Write a program to print following pattern.

5 4 3 2 1

4 3 2 1

3 2 1

2 1

1

June-

2013

5

12 Write a program to print the following pattern

1

0 1

1 0 1

0 1 0 1

Dec-

2011

7

13 Write a program to print the following pattern

1

2 2

Jan-2015 7

Page 18: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 18

3 3 3

4 4 4 4

14 Write a program to display following pattern using nested for

loops.

1

1 3

1 3 5

1 3 5 7

For n lines.

Jan-

2013,

April-

2010

7

15 Write a C program to display the following triangle for N

lines.

1

A B

1 2 3

A B C D

1 2 3 4 5

June-

2010

7

16 Write a C program to display the following triangle for N

lines.

1

A B

2 3 4

C D E F

5 6 7 8 9

June-

2010

7

17 Write a program to reverse the number. (e.g. 456 -> 654) June-

2013

7

18 Write a C program to find out Armstrong Numbers between 0

and 999.

Example : 153 is an Armstrong number because

13+53+33=153

Jan-2010 7

19 Write a C program to print multiple of N from given range of

unsigned integers. For example, if N=5 and range is [17, 45] it

prints20,25,30,35,40,45

June-

2011

7

20 Write a function program to find whether the string is

palindrome or not.

Dec-

2013

7

Unit 4: Array & String

SR NO. QUESTIONS PAPER MARKS

1 What will be the output of following code.

#include main() {

int x,y = 10; x = y * NULL; printf(\"%d\",x); }

a) error c) 10

b) 0 d) garbage value

June-

2015

1

2 Write a C- program read in an array of integers and print its

elements in reverse order.

June-

2009

5

3 Write a program in c for multiplication of two matrix

June-

2015

7

Page 19: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 19

4 Write a ‘C’ program to count ODD and EVEN numbers from

given 10 numbers

June-

2013

7

5 Write a C function to exchange two numbers and use it to

reverse an arrayof 10 integers accepted from user.

June-

2011

7

6 Write a C program to accept array of N integers and find the

largest oddnumber as well as largest even number and display

them.

June-

2010

6

7 Write a C program to Add two 3 X 3 Matrix. Dec-

2011

8

8 Write a program to find maximum element from 3 × 3 metrics April-

2010

5

9 Write a ‘C’ program to count number of words in a given

string.

June-

2013

7

10 Write a C program to accept a string and print every third

character fromstring only if it is lower case.

June-

2011

7

11 Write a C function to reverse a word. Use it to reverse each

word of a stringgiven by user.

June-

2011

7

12 Write a C program to reverse a string given from keyboard.

Don’t use libraryfunction to reverse it.

June-

2010

6

13 Write a program to that read two string and compare them

using thefunction strcmp( ) and print the message that first

string is equal, less, greater than the second one.

June-

2009

5

14 Write a C program to read 10 numbers from user and store

them in an Array.Display Sum, Minimum and Average of the

numbers.

Jan-2013 7

Unit 5: Functions

SR NO. QUESTIONS PAPER MARKS

1 Write a function which receives number as argument and

return sum ofdigit of that number.

April-

2010

6

Unit 6: Pointers

SR NO. QUESTIONS PAPER MARKS

1 Write a program using pointer and function to determine the

length of string

June-

2015

4

2 What will be the output of following code.

void main()

{

int x[] = {1,2,3,4,5};

printf(“%d”,fun(&x[2]));

}

int fun(int *a)

{

int i=0,sum=0;

June-

2011

2

Page 20: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 20

Unit 7: Structure

SR NO. QUESTIONS PAPER MARKS

1 Write a program in c using structure to enter rollno, marks of

the three subject for 3 student and find total obtained by each

student

June-

2015

7

2 Define a structure named “Student” with roll_no,

name and percentage as members. Read data of 5 students

from user anddisplay them in proper format.

Jan-2013 7

for(i=0;i<2;i++,a++)

sum += *a;

return(sum);

}

3 What will be the output of following code.

void main()

{

int iA = 6, iB = 6;

int *P1 = &iA, *P2 = &iB;

printf(“\n %d”,(*P1)++);

printf(“\n %d”,--(*P2));

printf(“\n %d”, ++(*P2)-*P1);

}

June-

2009

4

4 What will be the output of following code.

main()

{ int a=3 b=5,c,*p,*q;

p=&b; a=&a;

c=*p % *q; ++(*p);

} printf (“%d %d”,*p,*q);

printf (“\n %d %d”, c ,b);

}

April-

2010

4

5 Write a function (using a pointer parameter) that calculate

maximumelement from given array of integer numbers.

June-

2009

5

6 Write a program to do swapping of two elements using

function with two pointers as arguments.

Jan-2015 4

Page 21: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 21

Objective Type Questions

Unit- 1 Introduction to computer and programming:

Sr.No. Multiple Choice Question Paper Marks

1 Which of the following is a part of primary memory of

computer

a) PROM b) CD-ROM

c) Pen-drive d) Floppy Disk

June-2015 1

2 Which protocol is used to transfer files on internet

a) HTTP b) SMPT

c)FTP d)Telnet

June-2015 1

3 Microprocessor of computer system is a part of :-

a) Memory c)Output Device

b) Input Device d) Processing Unit

June-2015 1

4 Which is not a font style in MS-Word

a) Bold c) italic

b) Superscript d) Regular

June-2015 1

5 With which of the following all formulas in excel starts?

a) / c) $

b) * d) =

June-2015 1

6 Which of the following is not one of PowerPoint view?

a) Slide show view c) Presentation view

b) Slide view d) Outline view

June-2015 1

7 In the evaluation of a computer language, all of the following

characteristics should be considered except?

a) application oriented features c) readability

b) efficiency d) hardware maintenance costs

June-2015 1

8 Keyboard is the type of device

A. Input B. Pointing

C. Output D. Sound

June-2015 1

9 A document or image can be scanned in to digital form by

using

A. Marker B. Printer

C. Light pen D. Scanner

June-2015 1

10 ALU is

A. Array Logic Unit B. Application Logic Unit

C. Arithmetic Logic Unit D. None of these

June-2015 1

11 HTML stands for

A. Hyper Text Makeup Language

B. Hyper Text Markup Language

C. Hyper Tech Markup Language

D. None of these

June-2015 1

Operating system is installed on

Page 22: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 22

12

A. Hard Disk B. Cache memory

C. Mother Board D. None of these

June-2015

1

13 Recycle bin is used for

A. To store backup file

B. To restore deleted file / folder

C. To store most frequently

D. All the above

June-2015 1

14 The process a user goes through to begin a computer system.

A. Log out B. Log in

C. Log off D. None of these

June-2015 1

15 Which among following is not necessary for working of a

standalone computer?

A. RAM B. Hard Drive

C. Operating System D. LAN card

June-2015 1

16 What is algorithm?

a)Application code

b)Type of programming language

c) None of above

d) Step by step procedure for calculations

June-2015 1

17 To Learn Computer, without going to classroom what will be

other way

a) Distance Learning b) I-Learning

c) Digital Learning d) E-Learning

June-2014 1

18 How to write E_mail Address ?

a) [email protected]

b) xyz@website@info

c)xyz.website.info

d)xyzwebsite.info

June-2014 1

19 What will be a meaning of 1KB of memory

a) 1 Kit Bit b) 1 Kilo Byte

c) 1 Kernel Boot d) 1 Key Block

June-2014,

Jan-2015

1

20 Full Form of RAM ?

a) Random Access Memory

b) Ready Application Module

c) Remote Access Machine

d) Read Access Memory

June-2014,

Jan-2015

1

21 What is Computer Virus ?

a) Software b) Hardware c) a and b d) None of above

June-2014 1

22 Full form of IP ?

a) Internet Principle b) Intercom Protocol

c) Intranet Protocol d) Internet Protocol

June-2014 1

23 What will be extension of Web Page’s file ?

a) .xls b) .3gp c) .html d) .ppt

June-2014 1

24 Software required to run the hardware is known as

(a) Task Manager (b) Task Bar

(c) Program Manager (d) Device Driver

Jan-2015 1

25 Which the following is application software? Jan-2015 1

Page 23: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 23

(a) Compiler (b) Power Point

(c) Debugger (d) None of the above

26 Which of the programming language is said to be machine

independent language?

(a) High Level Language (b) Machine Language

(c) Assembly Language (d) All the Above

Jan-2015 1

27 Which of the following is smallest Network?

(a) MAN (b) LAN (c) WAN

Jan-2015 1

28 FTP stands for

(a) File Transport Protocol (b) File Transfer Protocol

(c) Folder Transfer Protocol

Jan-2015 1

29 When a key is pressed on keyboard, which standard is used

for converting the keystroke into the corresponding bits

(a) ANSI (b) ASCII

(c) EBCDIC (d) ISO

Jan-2015 1

30 Which one is input device?

A) Monitor C) Keyboard

B) CPU D) Printer

Jan-2015 1

31 Which part of CPU perform calculations and make decision

A) Alternate Logic Unit

B) Arithmetic Logic Unit

C) Arithmetic Local Unit

D) Alternate Local Unit

Jan-2015 1

32 The memory capacity of a computer is represented in

A) Kilobits C) Kilobytes

B) Memory chips D) None of the above

Jan-2015 1

33 HTML is used to design

A) Webpage C) Website

B) Multimedia Objects D) Tables and frames

Jan-2015 1

34 What type of memory is volatile?

A) Cache C) RAM

B) ROM D) Hard Drive

Jan-2015 1

35 With regards to Email Addresses:

A) They must always contain an @ symbol

B) They are case sensitive

C) They can never contain space

D) All of above

Jan-2015 1

36

Which of the following will you find on an inkjet printer ?

(A) It has an ink ribbon.

(B) It has an ink cartridge.

(C) It has high voltage power supply.

(D) It uses toner powder

Dec-2013

1

37 Why is it important to keep Windows updated using the

Windows update website or automatic updates?

(A)To keep your system secure and to install critical updates.

(B)To keep your system fast.

(C)To keep your system optimized for the new game.

Dec-2013 1

Page 24: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 24

Unit- 2 Fundamentals of ‘C’

45 printf() belongs to which library of c

a) stdlib.h c) stdout.h

b) stdio.h d) stdoutput.h

June-

2015

1

46

What will be printed if we type the statement

printf(“%d\n”,’d’);

a) 0 b) 100 c) error d) d

June-

2014

1

47 C is a __________ language.

a) High level b) Middle level

c) Machine level d) Low level

June-

2014

Jan-

2015

1

48 Which header file is essential for using printf() function ?

a) text.h b) strings.h c) stdio.h d) strcmp.h

June-

2014

1

49 A declaration float a,b; occupies ______of memory ?

(a) 1 bytes (b) 4bytes

(c) 8byte (d) 16 bytes

Jan-

2015

1

(D)To keep your system from overheating.

38 Which protocol used to display web pages?

(A) SNMP (B) SMPT (C) Telnet (D) HTTP

Dec-2013 1

39 In Microsoft Excel you can use the horizontal and vertical

scroll bar to

(A) Split a worksheet to two panes

(B) Edit the contents of a cell

(C)View different rows and columns

(D) View different worksheet

Dec-2013 1

40 The system unit of a personal Computers typically contains all

of the following except:

(A) Microprocessors (B)Disk controller (C) Serial interface

(D) Modem

Dec-2013 1

41 Which of the following is a read only memory storage device?

(A) Floppy Disc (B) CD-ROM (C) Hard Disk (D)None of these

Dec-2013 1

42 BIOS is an abbreviation of

(A) Basic Input Output System

(B) Best Input Output System

(C)Basic Input Output Symbol

(D) Base Input Output System

Dec-2013 1

43 A Pointer is?

(A) A keyword used to create variables.

(B) A variable that stores address of an instruction.

(C) A variable that stores address of other variable.

(D) All of above.

Dec-2013 1

44 What do you call the translator which takes assembly language

program as inputand produce machine language code as

output?

(A) Compiler (B) Interpreter (C) Debugger (D) Assembler

Dec-2013 1

Page 25: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 25

50 What are the different types of real data types in C?

(A) float, double.

(B) short int, double, long int.

(C) double, long int, float

(D) float, double, long double

Dec-

2013

1

51 Which of the following is a symbol for AND operator?

(A) ||(B) &(C) &&(D) $$

Dec-

2013

1

52 Which of the following is a correct statement?

(A) Variable name must start with underscore

(B) Variable name must have digit

(C) Variable name must have white space character

(D) Keyword cannot be a variable name

Dec-

2013

1

Unit- 3 Control structure in ‘C’

54 The first expression in a for… loop is

a) Step value of loop

b) Value of the counter variable

c) Condition statement

d) None of the above

June-

2015

1

55 Continue statement used for

a) To continue to the next line of code

b) To stop the current iteration and begin the next iteration from the

beginning

c) To handle run time error

d) None of above

June-

2015

1

56 Which of following loop is executed at least

once?

a) do-while b) for c) if d) while

June-

2014

1

57 Which among the following is a unconditional control

structure.

a) goto b) for c) do-while d) if-else

June-

2014

1

Unit- 4 Array & String

58 Which of the following is used as a string termination character?

(a) 0 (b) \0

(c) /0 (d) None of these

Jan-

2015

1

59 Which of the following function is more appropriate for

reading in a multiwordstring? (A) printf();

(B) scanf();

(C) gets();

(D) puts();

Dec-

2013

1

Page 26: SILVER OAK COLLEGE OF ENGINEERING ... OAK COLLEGE OF ENGINEERING & TECHNOLOGY AHMEDABAD Computer Programming and Utilization (2110003) BOOKLET 2015 -2016 CPU (2110003) Page 2 INDEX

CPU (2110003) Page 26

Unit- 5 Functions

60 Recursion is a process in which a function calls

a) itself b) another function

c) main() function d) none of the above

June-

2014

1

Unit- 6 Pointers

61 A pointer value refers to

a) A float value b) An integer constant

c) Any valid address in memory d) None

June-

2014

1

Unit- 7 Structure

62 Structure can contain elements of the same data type

(a) true (b) false

Jan-

2015

1

63 Which of the following operator is used to select a member

of a structure variable

(a) .(dot) (b) ,(comma)

(c) : (colon) (d) ;(semicolon)

Jan-

2015

1

Unit- 8 Dynamic Memory Allocation

64 Difference between calloc() and malloc()

a) calloc() takes a single argument while malloc() needs two

arguments

b) malloc() takes a single argument while calloc() needs two

arguments

c) malloc() initializes the allocated memory to ZERO

d) calloc() initializes the allocated memory to NULL

June-

2015

1

65

Which function reallocates memory?

(a) realloc (b) calloc

(c) malloc (d) None of these

Jan-

2015

1

Unit- 9 File management

66 File manipulation functions in C are available in which

header file?

(a) streams.h (b) stdio.h

(c) stdlib.h (d) files.h

Jan-

2015

1