Answers to Practice Problems

Size: px
Start display at page:

Download "Answers to Practice Problems"

Transcription

1 Answers to Practice Problems Prepared by:dilip Kumar Gangwar(Faculty,CS/IT DEPTT GEHU) 1)C Language is developed by- 1.Bjarne stroutstrup 2.Dennis Ritchie 3.R.Byrant 4.None of the above 2)C is a a)middle level language b)high level c)low level d)c is not a language 3)Header files have the extension a).c b).hf c).txt d).h 4)Header files have a)function declaration,but not the function definition b)function definition not function declaration d)none of these 5)printf() and scanf() are

2 a)function and datatype respectively b) datatype and function respectively c)both functions d)data type and datatypes respectively 6)main() is a a) function b)datatype c)variable d)header file 7)stdio.h is a a)header file b)datatype c)variable 8)stdio.h has declaration of a)getch() and clrscr() b)printf() and scanf() c)scanf() and getch() d)only getch() 9)conio.h has declaration of a)getch() and clrscr() b)printf() and scanf() c)scanf() and getch() d)only getch()

3 10)return statement can be used to a)simply return the control to a function from where it has come without specifying any value b) return the control to OS c)return value to a function function from where it has come d)return to home. e)both (A) and (c) 11) The statement int a is a a) definition of a b)declaration of a c)both (a) and (b) d)none of these 12) The statement int a=10 is a a) definition of variable a b)declaration of a c)initialisation of a d) Both (a) and (b),(c) 13) int main() int a=10; int a=12; printf( %d,a);

4 Ouput of it is---- a)10 12 b)12 10 c)10 d)12 e)compile time error redefinition of a 14)getch() is used to a)read or take the value from keyboard/user b)hold the output screen c)print anything on screen d)none of these 15)scanf() is used to a)read or take the value from keyboard/user b)hold the screen c)print anything on screen d)none of these 16)printf() is used to a)read or take the value from keyboard/user b)hold the screen c)print anything message and printing the values of variables on the screen d)none of these 17)clrscr() is used to

5 a)read or take the value from keyboard/user b)hold the screen c)print anything on screen d)clear the previous output on the screen 18)Full form ofide a)integrated disk environment b) Integrated development environment c)integrated datum enum 19)IDE is a)virus b)hardware which helps to print our data c)a software which provides the facility/environment to a programmar to develop programs in a programming language d) a software which provides the facility/environment to a programmar to crash the OS 20)Ascii value of semicolon ( ; ) and blank/space is a)59 32 b) what is the output of the following code..? Int main() Char s= c ; printf( %d%d\n,sizeof(s),sizeof( c )); a. 1 1 b. 1 8 c )int emp id=341;

6 Here variable name emp id is valid or not?give reason It is not valid as emp id contains space in between and a variable/identifier name can not have space/blank,comma,any special character (e.g.?,#,* ) in between them.variable name can have Underscore in between(e.g. total_salary is valid,but total salary is not valid). 23)Compiler like Turbo c/c++ or Dev c++ is a a)software b)hardware c)name of a datatype d)all of the above 24) What will be the output? int main() int a=10; int b=5; int c=5; int d=2; int e=a*d +b/c; printf("e=%d",e); 1. error none e=10*2+5/2; =20+5/2; precedence of * and / is higher than +,so check for * and /,but * and / have same priority.now check for associativity.associativity is From Left to right.so * will be evaluated first then / e= 20+2; now evaluate + e=22; 25) int main() float avg; int a=10; int b=5;

7 int c=2; avg=a+b+c/3; printf("avg=%f",avg); output a)5.66 b) precedence of / is more than + c)5 d)error avg=10+5+2/3 avg= avg=15 now typecasting will take place as = avg is float(4 bytes)=15 is integer(2 byte) //promotion so 15 has to go in avg (float) and will adjust there as float i.e implicit(conversion in assignment) will take place. And 15 will become so avg = ) int main() float avg; int a=10; int b=5; int c=2; avg=(a+b+c)/3; printf("avg=%f",avg); output

8 a)5.66 b)5.0 since ( ) has highest precedence/priority than any operator c)5 d)error avg=(10+5+2)/3 avg=(15+2)/3 avg=17/3 avg=5 again typecasting will take place float = int //implicit typecasting(conversion in assignment) avg= //promotion of 5 (int) to float 27)int main() float avg; float a=10; int b=5; int c=2; avg=a+b+c/3; printf("avg=%f",avg); output---- a)5.66 b)5.0 c) d)error float a= ; //here a will have typecasting).10 has to adjust as float a= as a is float so float=int (implicit

9 avg= /3 avg= avg= )int main() float avg; float a=10; int b=5; int c=2; avg=(a+b+c)/3; printf("avg=%f",avg); output---- a) b)5.0 c)5 d)error avg=( )/3 avg=( )/3 avg= /3 now float/int=float avg= )int main() float avg;

10 float a=10; int b=5; int c=2; avg=(a+b+c)/3; printf("avg=%d",avg); output a)5.66 b)5.0 c)5 d) or abnormal program termination printf("avg=%d",avg); //due to %d error happens as avg is float and we are printing it as integer.we cannot do typecasting in printf 30) int main() Int x,y,z; x=20++; y=++x++; z=(x+y)--; printf( %d %d %d,x,y,z); Output

11 A b) c)error L value required 20 is a constant value we cannot increment it, same for ++x++ 31) main() int a ; printf( %d,a); 1)0 2)9.88 c)a d)garbage value 32)size of a datatype is a)machine independent b)machine dependent c)always fixed 33) main() printf( %x,11);

12 a)b or B b)14 c)x d)error printf( %x,11); // x is to print hexadecimal form of a number 34) main() printf( %o,11); a)13 b)11 c)x d)error printf( %o,11); // o is to print octal form of a number 35)Comments in c are of a)2 types single line // and multiline /* */ b)4 type c)1 type

13 36)Computer understands language of a)english b) 0 s and 1 s c)assembly language d)it is fool 37)1 byte= bits a)5 b)8 c)9 d)16 38)1 kb= byte a)2^10 b)2^20 c)2^30 39)1 MB= byte a)2^10 b)2^20 c)2^30 40)1 GB= byte a)2^10 b)2^20 c)2^30 41) main()

14 char ch='a'; printf("%d %c",ch,ch); a)66 A b)65 A c)97 A d)error 42) main() char ch=130; printf("%d",ch); a)-129 b)-126 //as range of char datatype which is by default signed char is -128 to +127 so overflow takes place c)-130 d)error 43) void main() float a= ; printf("%f ",a);

15 printf("%.2f ",a); printf("%.3f",a); a) b) ) void main() float a1,b1,a2,b2,a3,b3; a1=2; b1=6.8; a2=4.2; b2=3.57; a3=9.82; b3=85.673; printf("%3.1f %4.2f\n",a1,b1); printf("%5.1f %6.2f\n",a1,b1); printf("%7.1f %8.2f\n",a1,b1); a) b) ) main() int a; int i=2; a=i++;

16 printf("%d %d",i++,a); printf( %d,i); a)3 2 4 b) ) ) ) main() int a; int i=2; a=++i; printf("%d %d ",i++,a); printf("%d,i); a)3 2 4 b) ) )2 3 3

17 47) main() int a; int i=2; a=++i + ++i; printf("%d %d",i++,a); a)4 7 b)8 4 c)4 8 d) )main() int x=4,y=3,z; z=x-- - y; //line 4 printf("%d %d %d",x,y,z); a)3 3 2 b)4 3 1 c)3 3 0 d)3 3 1

18 49) If line 4 is changed to z=x-- - y the ouput is a)3 3 2 b)4 3 1 c)3 3 0 d) )A c variable cannot contain a)blank spaces b)hyphen 3)decimal point d)allof the above 51)int a=30* evaluates to (in turbo c/c++) a) //rage of int= to b)32768 c)10000 d)0 52) main() int i=4,j=-1,k=0,y,z; y=i + 5 && j +1 k+2; printf("%d %d ",i,j); z=i+5 j+1 && k+2; printf("%d %d",y,z);

19 a) b) c) d) ) main() int i=-1,j=1,k,l; k=!i &&!j; l=!i j; printf("%d %d %d %d",i,j,k,l); a) b) c) d) ) int main() int a=10; printf("%d %d %d",a,a++,++a); a) b) c) ) int main() int x=25,y=25,z; z=x==25&&y<++x;

20 printf("\n%d %d %d ",x,y,z); a) ) int main() int x=25,y=10,z=10; x=y==z; printf("\n%d %d %d ",x,y,z); a) b) c) d) Error 57) int main() int x=100; printf("%d",20+ x++); printf("%d",20+ ++x); a) b) c) ) int main() int a=7,b=12,c=13,i; i=a b&c; printf("%d\n",i); a)13 b)15 c)garbage 59) void main() int a=5,b=3; b=++a + a b;

21 b=--b + --a *b++; printf("%d %d",a,b); a)6 79 b)6 92 c) )int c= 4*12-7>>2; a)45 b)20 c)10 d)none C=48-7>>2 C=41>>2 C=10 (41/2 2 =10.5) 61) What will be output of the following program? #include<stdio.h> int main() int a=2,b=7,c=10; c=a==b; printf("%d",c); a)10 b)0 c)7 d) 2 C=a==b Precedence of == is greater than = C=10==7 C=0 62) What will be output of the following program?give reason for your answer #include<stdio.h> void main() int x; x=10,20,30; printf("%d",x); a)10 b)20 c)30 d) e)error 63) What will be output of the following program On turbo c++(tc)? #include<stdio.h> int main() printf("%d %d %d",sizeof(3.14),sizeof(3.14f),sizeof(3.14l));

22 a) b) c) on turbo c cpmpiler: floating point constant are treated as double so 3.4 is double type,so size=8 3.2f denotes floating point constant/number size of float=4 3.2L denotes long double,so size of long double=10 On dev c++ Answer= ) What will be output of the following program? #include<stdio.h> int main() int x=10,y=20,z=5; printf("%d %d %d"); a) b)garbage answers c) d)compile time error 65) What will be output of the following program in Turbo C? #include<stdio.h> int main() int a; a=sizeof(!5.6); printf("%d",a); a)4 b)2 c)0 d)1 on Turbo C: a=sizeof(!5.6) (!non zero number)= 0 a=sizeof(0) a=2 ( as 0 is integer number ) on dev c++ a=4 (as on dev c++ size of integer=4 bytes) 66) What will be output of the following c program? #include<stdio.h> int main() long int 1a=51; //variable cannot start with digit printf("%ld",1a); a)51 b) 4 c) compilation error 67) #include<stdio.h> int main() int _=5; int =10; int ; =_+ ;

23 printf("%d", ); a)error b) 15 c)0 5)5 _ is valid identifier 68)What is the valid C statement to print the message My salary increased to 10%!? a)printf( My salary increased to 10%! ); b)printf( My salary increased to 10%%! ); c)printf( My salary increased to 10\%\! ); d)printf( My salary increased to 10/%//! ); 69) int main() int a=2; int b; b=a>7 +4 *8 && (a=a+3); printf("%d %d",a,b); a)5 0 b) 2 1 c) 2 0 d)5 1 b=a>7 +4 *8 && (a=a+3); although precedence of ( ) is highest but when there is && operator or operator in expression,then compiler calculates the lhs expressions of && or for some optimization purposes like short circuiting. so, b=a>7+28&&(a=a+3); b=a>35&&(a=a+3) b=2>35&&(a=a+3) b=0&&(a=a+3) now due to short circuit in && rhs expression of && is not evaluated b=0; and value of a has not changed a=2 70)void main() float a; a=(float)(sizeof( a )); printf( %f,a); a) b) c) on turbo c: a=(float)(sizeof( a )) character constant =integer a=(float)(2) a= on dev c++ a=float(4) size of integer=4 bytes a= )void main() int a=3,b=78,c;

24 c=printf( %d %d,a,b); printf( %d\n,c); a) b) c) d)error 71) void main() int a,b,c; c=scanf( %d%d,&a,&b); printf( %d\n,c); Suppose in scanf, input is= 5 9 a)3 b)2 c)5 2 9 d)error on success,scanf() returns no of successful characters read otherwise returns 0 here scanf() reads 2 characters/values in a and b,this answer 2 is stored in c 72) void main() int c=printf( language ); printf( %d,c); a)0 b)1 c) 8 d)2 printf() returns no of character written on success otherwise return s 0 here printf( ) writes 8 characters of language,so it returns 8,which is stored in c

d)only getch() 9)conio.h has declaration of a)getch() and clrscr() b)printf() and scanf() c)scanf() and getch() d)only getch()

d)only getch() 9)conio.h has declaration of a)getch() and clrscr() b)printf() and scanf() c)scanf() and getch() d)only getch() Practice Problems-2 Prepared by:dilip Kumar Gangwar(Faculty,CS/IT DEPTT GEHU) 1)C Language is developed by- 1.Bjarne stroutstrup 2.Dennis Ritchie 3.R.Byrant 4.None of the above 2)C is a a)middle level

More information

Practice Problems. 1)C Language is developed by- 1.Bjarne stroutstrup 2.Dennis Ritchie. 2)C is a a)middle level language b)high level language

Practice Problems. 1)C Language is developed by- 1.Bjarne stroutstrup 2.Dennis Ritchie. 2)C is a a)middle level language b)high level language Practice Problems Prepared by:dilip Kumar Gangwar(Faculty,CS/IT DEPTT GEHU) 1)C Language is developed by- 1.Bjarne stroutstrup 2.Dennis Ritchie 3.R.Byrant 4.None of the above 2)C is a a)middle level language

More information

C PROGRAMMING QUESTIONS AND

C PROGRAMMING QUESTIONS AND 8/26/2011 C C PROGRAMMING QUESTIONS AND ANSWER http://cquestionbank.blogspot.com Ritesh kumar (1) What will be output if you will compile and execute the following c code? struct marks{ int p:3; int c:3;

More information

IV Unit Second Part STRUCTURES

IV Unit Second Part STRUCTURES STRUCTURES IV Unit Second Part Structure is a very useful derived data type supported in c that allows grouping one or more variables of different data types with a single name. The general syntax of structure

More information

{ int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } A. Function addmult() return 7 and 12 B. No output C. Error: Compile error D.

{ int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } A. Function addmult() return 7 and 12 B. No output C. Error: Compile error D. SAP TECHNICAL PAPER 1. If int is 2 bytes wide.what will be the output of the program? void fun(char**); char *argv[] = "ab", "cd", "ef", "gh"; fun(argv); void fun(char **p) char *t; t = (p+= sizeof(int))[-1];

More information

Week 1 Questions Question Options Answer & Explanation A. 10 B. 20 C. 21 D. 11. A. 97 B. 98 C. 99 D. a

Week 1 Questions Question Options Answer & Explanation A. 10 B. 20 C. 21 D. 11. A. 97 B. 98 C. 99 D. a Sr. no. Week 1 Questions Question Options Answer & Explanation 1 Find the output: int x=10; int y; y=x++; printf("%d",x); A. 10 B. 20 C. 21 D. 11 Answer: D x++ increments the value to 11. So printf statement

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

Data Types and Variables in C language

Data Types and Variables in C language Data Types and Variables in C language Basic structure of C programming To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are

More information

C Multiple Choice Questions and answers MCQ with Ans.

C Multiple Choice Questions and answers MCQ with Ans. C Multiple Choice Questions and answers MCQ with Ans. 1. Who is father of C Language? A. Bjarne Stroustrup B. Dennis Ritchie C. James A. Gosling D. Dr. E.F. Codd Answer : B 2. C Language developed at?

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

AMCAT Automata Coding Sample Questions And Answers

AMCAT Automata Coding Sample Questions And Answers 1) Find the syntax error in the below code without modifying the logic. #include int main() float x = 1.1; switch (x) case 1: printf( Choice is 1 ); default: printf( Invalid choice ); return

More information

Fundamental of C programming. - Ompal Singh

Fundamental of C programming. - Ompal Singh Fundamental of C programming - Ompal Singh HISTORY OF C LANGUAGE IN 1960 ALGOL BY INTERNATIONAL COMMITTEE. IT WAS TOO GENERAL AND ABSTRUCT. IN 1963 CPL(COMBINED PROGRAMMING LANGUAGE) WAS DEVELOPED AT CAMBRIDGE

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

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

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What

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

80 Minutes CENG 230 MidtermExam :40

80 Minutes CENG 230 MidtermExam :40 80 Minutes CENG 230 MidtermExam 02.12.2014 17:40 There are 40 questions (each 2.5 points) for a total of 100 points. Exam Type: A All questions are multiple choice, no points will be lost for wrong answers.

More information

Intro to Computer Programming (ICP) Rab Nawaz Jadoon

Intro to Computer Programming (ICP) Rab Nawaz Jadoon Intro to Computer Programming (ICP) Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) What

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

Preview from Notesale.co.uk Page 6 of 52

Preview from Notesale.co.uk Page 6 of 52 Binary System: The information, which it is stored or manipulated by the computer memory it will be done in binary mode. RAM: This is also called as real memory, physical memory or simply memory. In order

More information

ME 172. Sourav Saha. Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET

ME 172. Sourav Saha. Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET ME 172 Introduction to C Programming Language Sourav Saha Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET Courtesy: Dr. Noor Al-Quddus Cyrus Ashok Arupratan

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

Presented By : Gaurav Juneja

Presented By : Gaurav Juneja Presented By : Gaurav Juneja Introduction C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs of UNIX are written

More information

First of all, it is a variable, just like other variables you studied

First of all, it is a variable, just like other variables you studied Pointers: Basics What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the address (rather than the value)

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

Group of Institutions Test Paper: Technical (Set-4) T&P Department } (A) 0 (B) 25 (C) 1 (D) -1 (E) 2. } (A) Sachin (B) Rahul

Group of Institutions Test Paper: Technical (Set-4) T&P Department } (A) 0 (B) 25 (C) 1 (D) -1 (E) 2. } (A) Sachin (B) Rahul 1. Predict Output? int a=0; #if (a==0) printf("equal"); #else if printf("not equal"); #endif (A) (B) (C) (D) Equal Not equal Null Garbage 2. What will be output if you will execute following c code? for(;null;)

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

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

Sasken Technical Questions

Sasken Technical Questions Sasken Technical Questions 1. main() int a = 10,*j; void *k; j = k =&a; j++; k++; printf("\n %u %u",j,k); A.compiler error B.syntax error C.memory address D.no output Explanation: cannot increment a void

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

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

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

Chapter 1 & 2 Introduction to C Language

Chapter 1 & 2 Introduction to C Language 1 Chapter 1 & 2 Introduction to C Language Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 & 2 - Introduction to C Language 2 Outline 1.1 The History

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

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 C Programming

Fundamentals of C Programming Introduction, Constants, variables, keywords, Comments, I/O Functions, Data types, Compilation & Execution Tejalal Choudhary tejalal.choudhary@gmail.com, tejalal.choudhary@sdbct.ac.in Department of Computer

More information

Question Bank (SPA SEM II)

Question Bank (SPA SEM II) Question Bank (SPA SEM II) 1. Storage classes in C (Refer notes Page No 52) 2. Difference between function declaration and function definition (This question is solved in the note book). But solution is

More information

Lecture 02 C FUNDAMENTALS

Lecture 02 C FUNDAMENTALS Lecture 02 C FUNDAMENTALS 1 Keywords C Fundamentals auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void

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

Introduction to C programming. By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE

Introduction to C programming. By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE Introduction to C programming By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE Classification of Software Computer Software System Software Application Software Growth of Programming Languages History

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

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

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

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

b. array s first element address c. base address of an array d. all elements of an array e. both b and c 9. An array elements are always stored in a.

b. array s first element address c. base address of an array d. all elements of an array e. both b and c 9. An array elements are always stored in a. UNIT IV 1. Appropriately comment on the following declaration int a[20]; a. Array declaration b. array initialization c. pointer array declaration d. integer array of size 20 2. Appropriately comment on

More information

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS )

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS ) Computer Programming & Problem Solving ( CPPS ) Chapter No 2 Sir Syed University of Engineering & Technology Computer Engineering Department University Road, Karachi-75300, PAKISTAN Muzammil Ahmad Khan

More information

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with

More information

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019 CSCI 2132: Software Development Introduction to C Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 The C Programming Language Originally invented for writing OS and other system

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

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

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

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

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,

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

OBJECTIVE QUESTIONS: Choose the correct alternative:

OBJECTIVE QUESTIONS: Choose the correct alternative: OBJECTIVE QUESTIONS: Choose the correct alternative: 1. Function is data type a) Primary b) user defined c) derived d) none 2. The declaration of function is called a) function prototype b) function call

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

Sample Question Set For Coding and Debugging

Sample Question Set For Coding and Debugging Sample Question Set For Coding and Debugging 1.What will be the output of the following statements? int i = 1,j; int i = 1,j; j=i--- -2; printf("%d",j); a) error b) 2 c) 3 d) -3 2. What will be the output

More information

Formatting functions in C Language

Formatting functions in C Language Formatting functions in C Language Formatting means display data in different format, within given set of columns, show specified set of decimal and align the data to left or right along with zero fill

More information

Work relative to other classes

Work relative to other classes Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language

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

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

THE FUNDAMENTAL DATA TYPES

THE FUNDAMENTAL DATA TYPES THE FUNDAMENTAL DATA TYPES Declarations, Expressions, and Assignments Variables and constants are the objects that a prog. manipulates. All variables must be declared before they can be used. #include

More information

CS16 Exam #1 7/17/ Minutes 100 Points total

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

Unit 1: Introduction to C Language. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune

Unit 1: Introduction to C Language. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune Unit 1: Introduction to C Language Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune Introduction to C Language The C programming language was designed by Dennis Ritchie at Bell Laboratories

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

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites: C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should

More information

BSM540 Basics of C Language

BSM540 Basics of C Language BSM540 Basics of C Language Chapter 3: Data and C Prof. Manar Mohaisen Department of EEC Engineering Review of the Precedent Lecture Explained the structure of a simple C program Introduced comments in

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

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

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

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

Q1. Multiple Choice Questions

Q1. Multiple Choice Questions Rayat Shikshan Sanstha s S. M. Joshi College, Hadapsar Pune-28 F.Y.B.C.A(Science) Basic C Programing QUESTION BANK Q1. Multiple Choice Questions 1. Diagramatic or symbolic representation of an algorithm

More information

Variation of Pointers

Variation of Pointers Variation of Pointers A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before

More information

Flipkart Placement Papers

Flipkart Placement Papers Flipkart Placement Papers 1. #include void main() int I=3,*j,**k; j=&i; k=&j; printf("%d%d%d",*j,**k,*(*k)); What is the output of the above program code? A.444 B.000 C.333 D.433 2. What is the output

More information

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017 P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) EVEN SEMESTER FEB 07 FACULTY: Dr.J Surya Prasad/Ms. Saritha/Mr.

More information

bphanikrishna.wordpress.com

bphanikrishna.wordpress.com Which of the following is not an input device A) plotter B) scanner C) keyboard D) mouse Which of the following statement is syntactically correct [ ] A) printf( %d, &a); B) scanf( %d, a); C) scanf( %d,

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

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

Have the same meaning as variables in algebra Single alphabetic character Each variable needs an identifier that distinguishes it from the others a =

Have the same meaning as variables in algebra Single alphabetic character Each variable needs an identifier that distinguishes it from the others a = Morteza Noferesti Have the same meaning as variables in algebra Single alphabetic character Each variable needs an identifier that distinguishes it from the others a = 5 x = a + b valid identifier in C

More information

edunepal_info

edunepal_info facebook.com/edunepal.info @ edunepal_info C interview questions (1 125) C interview questions are given with the answers in this website. We have given C interview questions faced by freshers and experienced

More information

CS Programming In C

CS Programming In C CS 24000 - Programming In C Week Two: Basic C Program Organization and Data Types Zhiyuan Li Department of Computer Science Purdue University, USA 2 int main() { } return 0; The Simplest C Program C programs

More information

Data types, variables, constants

Data types, variables, constants Data types, variables, constants Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic in C 2.6 Decision

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

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters,

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, Strings Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, decimal digits, special characters and escape

More information

1) Which of the following values can not be stored in an int variable. 2) How many times is the letter n printed by the following printf statement?

1) Which of the following values can not be stored in an int variable. 2) How many times is the letter n printed by the following printf statement? 1) Which of the following values can not be stored in an int variable A)1000 B)1000000 C)1000000000 D)100000000000000 E)-1 2) How many times is the letter n printed by the following printf statement? printf("nn\\nn\n\n\nn\nn\\n\n");

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility, there are four library routines known as memory management

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

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

C++ Programming Language

C++ Programming Language C++ Programming Language 1 st week All computer systems consist of similar hardware devices and software components. Hardware: Hardware refers to the physical components that a computer is made of. A computer

More information

Introduction to C++ Introduction and History. Characteristics of C++

Introduction to C++ Introduction and History. Characteristics of C++ Introduction and History Introduction to C++ Until 1980, C programming was widely popular, and slowly people started realizing the drawbacks of this language and at the same time, the engineers had come

More information

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1 (a) List any four relational operators.

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 9 Pointer Department of Computer Engineering 1/46 Outline Defining and using Pointers

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

C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different.

C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. C++ Character Set a-z, A-Z, 0-9, and underscore ( _ ) C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. Identifier and Keywords:

More information

COLLEGEDUNIA MCA. 3. What would be displayed, if the following program is compiled and run?

COLLEGEDUNIA MCA. 3. What would be displayed, if the following program is compiled and run? MCA 1. If a 1Gb file is to be transmitted over a 10Mbps link, how much time would it take to complete the transmission? A) 10 seconds B) 100 seconds C) 1000 seconds D) 1024 seconds 2. Which one of the

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

Additional Questions

Additional Questions Additional Questions 1. Explain the structure of a C program with a neat block diagram. 2. Give the formatted output of the following program : float a=125.5180; char c='a'; printf("%5d, %03c, %-8.2f ",sizeof(a),c,a);

More information

BSM540 Basics of C Language

BSM540 Basics of C Language BSM540 Basics of C Language Chapter 4: Character strings & formatted I/O Prof. Manar Mohaisen Department of EEC Engineering Review of the Precedent Lecture To explain the input/output functions printf()

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

.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar..

.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. .. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. A Simple Program. simple.c: Basics of C /* CPE 101 Fall 2008 */ /* Alex Dekhtyar */ /* A simple program */ /* This is a comment!

More information

Lab 3. Pointers Programming Lab (Using C) XU Silei

Lab 3. Pointers Programming Lab (Using C) XU Silei Lab 3. Pointers Programming Lab (Using C) XU Silei slxu@cse.cuhk.edu.hk Outline What is Pointer Memory Address & Pointers How to use Pointers Pointers Assignments Call-by-Value & Call-by-Address Functions

More information