Example : Define a structure of student having fields Roll No, Name, Address and fees paid ( Make appropriate assumption about datatypes) Method -1

Size: px
Start display at page:

Download "Example : Define a structure of student having fields Roll No, Name, Address and fees paid ( Make appropriate assumption about datatypes) Method -1"

Transcription

1 Structure Structure is a user defined data type, it is used to combine different types of available data type(s) to form a new data type, to suite a real life problem. The syntax of a structure is as follows Syntax struct <identifietr> Datatype <identifier>; Datatype <identifier>; Datatype <identifier>; Example : Define a structure of student having fields Roll No, Name, Address and fees paid ( Make appropriate assumption about datatypes) Solution struct student How to define structure type variable(s) roll; name[30]; address[60]; Method -1 struct student s ; roll; name[30]; address[60]; Declaration of structure and variable simultaneously Method -1I struct student Student s; ; roll; name[30]; address[60]; Declaration of variable after declaration of student type structure Note : The above declaration ( any ) of variable create a new memory block named as S. This is further divided o four parts namely, roll, name, address and fees. These block now contains some garbage values. S Roll Name Address Fees These block can be accessed using DOT OPERATOR (.) i,e if you want to access roll sub-block of S block then you have to write Page 1 of 8

2 s.roll Initialization method of structure variable Method-1 struct student address[60]; s =1, ramji, b-100 surya nagar, Method-1I struct student address[60]; student s =1, ramji, b-100 surya nagar, Method-1II struct student address[60]; s.roll =1; strcpy(s.name, Ramji ); strcpy(s.address, b-100 surya nagar ); s.fees =125.75; Method-1V struct student address[60]; cin>>s.roll >>s.name>>s.address>>s. Method-V struct student address[60]; s =1, ramji, b-100 surya nagar, student s1; Task : Initialize variable s1 using variable s Method 5.1 S1=S; Methos 5.2 s1.roll = s.roll; strcpy(s1.name,s.name); Page 2 of 8

3 strcpy(s1.address, s.address); s1.fees = s. Nested Structure : if a structure is used inside another structure then it is called nested structure or embedded structure. Task : Define a structure of student having following structure diagram Roll No Name Address fees First Second The above mentioned problem can be solved using two method Method I struct stud_name Char first[15]; struct student Char stud_name second[15]; rollno; name; address[80]; Note : Method-II struct student rollno; struct stud_name name; address[80]; first[15]; second[15]; Example :Define a structure of student having fields roll, name, marks obtained in three subject physics, chemistry, mathematics, computer and English, total marks and percentage. Write a program in C++ to read a record of student. Calculate total marks and percentage. Display the same record on the screen. Solution Program Page 3 of 8

4 struct student phy; chem; math; comp; eng; total; per; //input phase cout<<"\n Enter roll number :"; cin>>s.roll; cout<<"\n Enter name :"; cin>>s.name; cout<<"\n Enter marks obtained in physics :"; cin>>s.phy; cout<<"\n Enter marks obtained in chemistry :"; cin>>s.chem; cout<<"\n Enter marks obtained in maths :"; cin>>s.math; cout<<"\n Enter marks obtained in Computer :"; cin>>s.comp; cout<<"\n Enter marks obtained in English :"; cin>>s.eng; // processing phase s.total = s.phy+s.chem+s.math+s.comp+s.eng; s.per = s.total *100/500.0; //output Phase cout<<"\n Roll No. :"<<s.roll; cout<<"\n Physics :"<<s.phy; cout<<"\n Chemistry :"<<s.chem; cout<<"\n Mathematics :"<<s.math; cout<<"\n Total marks :"<<s.total; cout<<"\n Percentage :"<<s.per; Array of structure : The above mentioned program is designed to hold the record of a single student, if you want to store and process more records than a possible solution is array of structure How to define and use array of structure Q1. Define a structure of student having fields roll, name, marks obtained in three subject physics, chemistry, mathematics, computer and English, total marks and percentage. Write a program in C++ to read the record of 10 student. Calculate total marks and percentage. Display the same records on the screen. Program Page 4 of 8

5 struct student phy; chem; math; comp; eng; total; per; student s[10]; i; //input phase for(i=0;i<3;i++) cout<<"\n Enter roll number :"; cin>>s[i].roll; cout<<"\n Enter name :"; cin>>s[i].name; cout<<"\n Enter marks obtained in physics :"; cin>>s[i].phy; cout<<"\n Enter marks obtained in chemistry :"; cin>>s[i].chem; cout<<"\n Enter marks obtained in mathematics :"; cin>>s[i].math; cout<<"\n Enter marks obtained in Computer :"; cin>>s[i].comp; cout<<"\n Enter marks obtained in English :"; cin>>s[i].eng; // processing phase for(i=0;i<3;i++) s[i].total = s[i].phy+s[i].chem+s[i].math+s[i].comp+s[i].en g; s[i].per = s[i].total *100/500.0; //output Phase for(i=0;i<3;i++) cout<<"\n Roll No. :"<<s[i].roll; cout<<"\n Name :"<<s[i].name; cout<<"\n Physics :"<<s[i].phy; cout<<"\n Chemistry :"<<s[i].chem; Page 5 of 8

6 cout<<"\n Mathematics cout<<"\n Total marks cout<<"\n Percentage :"<<s[i].math; :"<<s[i].total; :"<<s[i].per; Passing Structure as a function Parameter : Structure can be passed as a function parameter as shown in the following example. Task : Define a structure of student having fields name and roll no. Write a program to read name and roll number and pr the value of this structure using a function Pr( ). Possible Solution : I ( improper) struct student void pr( x, y[]) cout<<"\n Roll No :"<<x; cout<<"\n Name :"<<y; student s=10,"rakesh Kumar" pr(s.roll,s.name); II ( Proper Solution) struct student void pr( student s) student s=10,"rakesh Kumar" pr(s); Structure as a function return type value : Program struct student Page 6 of 8

7 student read_data(void) cout<<"\n Enter roll no :"; cin>>s.roll; cout<<"\n Enter name :"; cin>>s.name; return (s); s= read_data(); Passing structure as a call value method in a function program #include<string.h> struct student void change( student s) // parameter as value s.roll=100; strcpy(s.name,"ramji"); student s=10,"rakesh Kumar" cout<<"\n Before function call\n"; change(s); cout<<"\n after function call by value\n"; No Change in the output as the value is passed in the function as a value. Page 7 of 8

8 cout<<"\n Name :"<<s.name; Passing structure as a call by reference method in a function Program #include<string.h> struct student void change( student & s) // parameter as reference s.roll=100; strcpy(s.name,"ramji"); student s=10,"rakesh Kumar" cout<<"\n Before function call\n"; change(s); cout<<"\n after function call by value\n"; Changes made inside function is visible in the main program as value had been passed as reference Page 8 of 8

Chapter-14 STRUCTURES

Chapter-14 STRUCTURES Chapter-14 STRUCTURES Introduction: We have seen variables of simple data types, such as float, char, and int. Variables of such types represent one item of information: a height, an amount, a count, and

More information

Guide for The C Programming Language Chapter 4

Guide for The C Programming Language Chapter 4 1. What is Structure? Explain the syntax of Structure declaration and initialization with example. A structure is a collection of one or more variables, possibly of different types, grouped together under

More information

Example: Structure, Union. Syntax. of Structure: struct book { char title[100]; char author[50] ]; float price; }; void main( )

Example: Structure, Union. Syntax. of Structure: struct book { char title[100]; char author[50] ]; float price; }; void main( ) Computer Programming and Utilization ( CPU) 110003 Structure, Union 1 What is structure? How to declare a Structure? Explain with Example Structure is a collection of logically related data items of different

More information

Downloaded S. from Kiran, PGT (CS) KV, Malleswaram STRUCTURES. Downloaded from

Downloaded S. from Kiran,  PGT (CS) KV, Malleswaram STRUCTURES. Downloaded from Downloaded S. from Kiran, www.studiestoday.com PGT (CS) KV, STRUCTURES WHAT IS A STRUCTURE? Structure is a collection of logically related data. It is also a collection of dissimilar datatype. Downloaded

More information

Structure, Union. Ashishprajapati29.wordpress.com. 1 What is structure? How to declare a Structure? Explain with Example

Structure, Union. Ashishprajapati29.wordpress.com. 1 What is structure? How to declare a Structure? Explain with Example Structure, Union 1 What is structure? How to declare a Structure? Explain with Example Structure s a collection of logically related data items of different data types grouped together under a single name.

More information

Darshan Institute of Engineering & Technology for Diploma Studies Unit 5

Darshan Institute of Engineering & Technology for Diploma Studies Unit 5 1 What is structure? How to declare a Structure? Explain with Example Structure is a collection of logically related data items of different data types grouped together under a single name. Structure is

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

Structures (1A) Young Won Lim 12/4/17

Structures (1A) Young Won Lim 12/4/17 Structures (1A) Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

UNIT-V. Structures. The general syntax of structure is given below: Struct <tagname> { datatype membername1; datatype membername2; };

UNIT-V. Structures. The general syntax of structure is given below: Struct <tagname> { datatype membername1; datatype membername2; }; UNIT-V Structures 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 is given

More information

The syntax of structure declaration is. struct structure_name { type element 1; type element 2; type element n;

The syntax of structure declaration is. struct structure_name { type element 1; type element 2; type element n; Structure A structure is a user defined data type. We know that arrays can be used to represent a group of data items that belong to the same type, such as int or float. However we cannot use an array

More information

Syntax to define a Structure: struct structurename { datatype membername1; datatype membername2;... } ; For Example:

Syntax to define a Structure: struct structurename { datatype membername1; datatype membername2;... } ; For Example: STRUCTURE IN C++ 1 A Structure is a collection of variables of different data types under one name. A structure defines a new user defined data type for your current program using which items of different

More information

Unit IV & V Previous Papers 1 mark Answers

Unit IV & V Previous Papers 1 mark Answers 1 What is pointer to structure? Pointer to structure: Unit IV & V Previous Papers 1 mark Answers The beginning address of a structure can be accessed through the use of the address (&) operator If a variable

More information

Recursion. Data and File Structures Laboratory. DFS Lab (ISI) Recursion 1 / 20

Recursion. Data and File Structures Laboratory.   DFS Lab (ISI) Recursion 1 / 20 Recursion Data and File Structures Laboratory http://www.isical.ac.in/~dfslab/2018/index.html DFS Lab (ISI) Recursion 1 / 20 Function calls 1 void main(void) 2 {... 3 u = f(x, y*z); 4... 5 } 6 7 int f(int

More information

ARRAYS. Part II Answers to all the questions (2 Marks):

ARRAYS.   Part II Answers to all the questions (2 Marks): Unit - III Arrays and Structures CHAPTER - 12 ARRAYS PART I Choose the correct answer. 1. Which of the following is the collection of variables of the same type that an referenced by a common name? a)

More information

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer:

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer: Chapter-11 POINTERS Introduction: Pointers are a powerful concept in C++ and have the following advantages. i. It is possible to write efficient programs. ii. Memory is utilized properly. iii. Dynamically

More information

Humanities (3 crs) PHIL 220 Ethics (3) Pre-requisite: ENG 109 or adequate score on the Course Placement Evaluation

Humanities (3 crs) PHIL 220 Ethics (3) Pre-requisite: ENG 109 or adequate score on the Course Placement Evaluation 2008-2009 Northern Associate of Applied Science AUTO BODY REPAIR. This program prepares you with the job skills needed for employment in the auto body repair field. Your training will include practice

More information

Recursion. Data and File Structures Laboratory. DFS Lab (ISI) Recursion 1 / 27

Recursion. Data and File Structures Laboratory.  DFS Lab (ISI) Recursion 1 / 27 Recursion Data and File Structures Laboratory http://www.isical.ac.in/~dfslab/2017/index.html DFS Lab (ISI) Recursion 1 / 27 Definition A recursive function is a function that calls itself. The task should

More information

// CSE/CE/IT 124 JULY 2015, 2.a. algorithm to inverse the digits of a given integer. Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0

// CSE/CE/IT 124 JULY 2015, 2.a. algorithm to inverse the digits of a given integer. Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0 // CSE/CE/IT 124 JULY 2015, 2a algorithm to inverse the digits of a given integer Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0 Step 4: repeat until NUMBER > 0 r=number%10; rev=rev*10+r; NUMBER=NUMBER/10;

More information

SQL. Char (30) can store ram, ramji007 or 80- b

SQL. Char (30) can store ram, ramji007 or 80- b SQL In Relational database Model all the information is stored on Tables, these tables are divided into rows and columns. A collection on related tables are called DATABASE. A named table in a database

More information

VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS

VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS 1. Write C++ programs to interchange the values of two variables. a. Using with third variable int n1, n2, temp; cout

More information

Structures (1A) Young Won Lim 11/8/16

Structures (1A) Young Won Lim 11/8/16 Structures (1A) Copyright (c) 2010-2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat Classes Chapter 4 Classes and Objects Data Hiding and Encapsulation Function in a Class Using Objects Static Class members Classes Class represents a group of Similar objects A class is a way to bind the

More information

by: Lizawati, Norhidayah & Muhammad Noorazlan Shah Computer Engineering, FKEKK, UTeM

by: Lizawati, Norhidayah & Muhammad Noorazlan Shah Computer Engineering, FKEKK, UTeM by: Lizawati, Norhidayah & Muhammad Noorazlan Shah Computer Engineering, FKEKK, UTeM At the end of this chapter, the students should be able to: understand and apply typedef understand and apply structure

More information

CS101 Computer Programming and Utilization

CS101 Computer Programming and Utilization CS101 Computer Programming and Utilization Milind Sohoni May 19, 2006 Milind Sohoni () CS101 Computer Programming and Utilization May 19, 2006 1 / 23 1 So far 2 What is a struct 3 The student struct 4

More information

TOPICS TO COVER:-- Array declaration and use.

TOPICS TO COVER:-- Array declaration and use. ARRAYS in JAVA TOPICS TO COVER:-- Array declaration and use. One-Dimensional Arrays. Passing arrays and array elements as parameters Arrays of objects Searching an array Sorting elements in an array ARRAYS

More information

CLASSES AND OBJECT CHAPTER 04 CLASS XII

CLASSES AND OBJECT CHAPTER 04 CLASS XII CLASSES AND OBJECT CHAPTER 04 CLASS XII Class Why Class? Class is the way to represent Real-World entity that have both the Characteristics and Behaviors of an entity. Implementation of Class class class_name

More information

Structure (1A) Young Won Lim 7/30/13

Structure (1A) Young Won Lim 7/30/13 Structure (1A) Copyright (c) 2010 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

POINTERS - Pointer is a variable that holds a memory address of another variable of same type. - It supports dynamic allocation routines. - It can improve the efficiency of certain routines. C++ Memory

More information

POINTERS INTRODUCTION: A pointer is a variable that holds (or whose value is) the memory address of another variable and provides an indirect way of accessing data in memory. The main memory (RAM) of computer

More information

POINTERS, STRUCTURES AND INTRODUCTION TO DATA STRUCTURES

POINTERS, STRUCTURES AND INTRODUCTION TO DATA STRUCTURES 1 POINTERS, STRUCTURES AND INTRODUCTION TO DATA STRUCTURES 2.1 POINTERS Pointer is a variable that holds the address of another variable. Pointers are used for the indirect manipulation of the variable.

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION 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 model answer and the answer written by candidate

More information

Programming Fundamentals (CS-302 )

Programming Fundamentals (CS-302 ) Programming Fundamentals (CS-302 ) (Structures) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Introduction A variable can store one element at a time An array

More information

OBJECTS. An object is an entity around us, perceivable through our senses. Types of Object: Objects that operate independently.

OBJECTS. An object is an entity around us, perceivable through our senses. Types of Object: Objects that operate independently. OBJECTS An object is an entity around us, perceivable through our senses. Types of Object: Objects that operate independently. Objects that work in associations with each others. Objects that frequently

More information

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths

More information

Kapi ap l S e S hgal P T C p t u er. r S. c S ienc n e A n A k n leshw h ar ar Guj u arat C C h - 8

Kapi ap l S e S hgal P T C p t u er. r S. c S ienc n e A n A k n leshw h ar ar Guj u arat C C h - 8 Chapter 8 Introduction C++ Memory Map Free Stores Declaration and Initialization of pointers Dynamic allocation operators Pointers and Arrays Pointers and Const Pointers and Function Pointer and Structures

More information

6 See List A College Requirements (CR) 32 See list B College Electives (CE) 3 See list C Departmental Requirements (DR)

6 See List A College Requirements (CR) 32 See list B College Electives (CE) 3 See list C Departmental Requirements (DR) College: ENGINEERING Department: MECHANICAL AND INDUSTRIAL ENGINEERING Cohorts: 217 Degree: B. ENG Major: INDUSTRIAL ENGINEERING Specialization: Summary of Credits: General Foundation Program University

More information

BS in Information Technology

BS in Information Technology BS in Information Technology Key Changes: - Minimum credit hours required changed from 130 to 120 - Two management courses (co-listed with IT) added as required: IT462 and IT466-311 is replaced by 330

More information

CHAPTER 4 Structures

CHAPTER 4 Structures CHAPTER 4 Structures Page 1 Structures: Arrays are one of the most widely used data structures in programming languages. The limitation of arrays, however, is that all the elements must be of the same

More information

S. S. JAIN SUBODH P. G. (Autonomous) COLLEGE, JAIPUR FACULTY OF SCIENCE TIME TABLE B.Sc. Semester- I w.e.f

S. S. JAIN SUBODH P. G. (Autonomous) COLLEGE, JAIPUR FACULTY OF SCIENCE TIME TABLE B.Sc. Semester- I w.e.f AR.N.301 8 A. 8.55A. 4,5,6 M- SG 1-3 M- DG 9 A. 9.55 A. 3,4 PHY FK 1.2 PHY MES 5,6 HND US S. S. JAN SUBODH P. G. (Autonomous) COLLEGE, JAPUR B.Sc. Semester- w.e.f. 18.07.16 10 A. 10.55 A. 5,6 RN 3,4 NJ

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Name: Object Oriented Programming

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Name: Object Oriented Programming Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model answer and the answer written by candidate may

More information

struct structure_name { //Statements };

struct structure_name { //Statements }; Introduction to Structure http://www.studytonight.com/c/structures-in-c.php Structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record.

More information

CSE101-Lec#17. Arrays. (Arrays and Functions) Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming

CSE101-Lec#17. Arrays. (Arrays and Functions) Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming Arrays CSE101-Lec#17 (Arrays and Functions) Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline To declare an array To initialize an array To pass an array to a function Arrays Introduction

More information

Bangalore South Campus

Bangalore South Campus USN: 1 P E PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST 3 Date: 22/11/2017 Time:11:30am- 1.00 pm

More information

Darshan Institute of Engineering & Technology for Diploma Studies

Darshan Institute of Engineering & Technology for Diploma Studies 1. Explain Call by Value vs. Call by Reference Or Write a program to interchange (swap) value of two variables. Call By Value In call by value pass value, when we call the function. And copy this value

More information

I Mid Semester May 2012 : Class XII : Computer Science Max Mark 50 : Time 2 Hrs. 1. a) What is macro in C++? Give example 2

I Mid Semester May 2012 : Class XII : Computer Science Max Mark 50 : Time 2 Hrs. 1. a) What is macro in C++? Give example 2 I Mid Semester May 01 : Class XII : Computer Science Max Mark 50 : Time Hrs 1. a) What is macro in C++? Give example b) Give the Header file for the following functions:- i) gets ( ) ii) tolower( ) 1 c)

More information

Bachelor of Science in Electrical Engineering - Computer Engineering Concentration

Bachelor of Science in Electrical Engineering - Computer Engineering Concentration Bachelor of Science in Electrical Engineering - Computer Engineering Concentration 1 Bachelor of Science in Electrical Engineering - Computer Engineering Concentration Learn more about the Bachelor of

More information

int Return the number of characters in string s.

int Return the number of characters in string s. 1a.String handling functions: Function strcmp(const char *s1, const char *s2) strcpy(char *s1, const char *s2) strlen(const char *) strcat(char *s1, Data type returned int Task Compare two strings lexicographically.

More information

'C' Programming Language

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

More information

First year courses and prerequisites Notes Previously offered ** Satisfies: CHEM GECR. CHEM 153 General Chemistry (5 cr.) Satisfies: CHEM GECR

First year courses and prerequisites Notes Previously offered ** Satisfies: CHEM GECR. CHEM 153 General Chemistry (5 cr.) Satisfies: CHEM GECR Student's name: EWU ID: Bachelor of Science in Chemistry & Biochemistry Forensic Science option College of Science, Technology, Engineering, and Mathematics SOAR Department: Chemistry SOAR Major: CHEM

More information

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam-613 403 Thanjavur 01. Define program? 02. What is program development cycle? 03. What is a programming language? 04. Define algorithm? 05. What

More information

INDIAN SCHOOL SOHAR FIRST TERM EXAM ( ) INFORMATICS PRACTICES

INDIAN SCHOOL SOHAR FIRST TERM EXAM ( ) INFORMATICS PRACTICES INDIAN SCHOOL SOHAR FIRST TERM EXAM (2015-2016) INFORMATICS PRACTICES Page 1 of 5 No. of printed pages: 5 Class: XI Marks: 70 Date: 10-09-15 Time: 3 hours Instructions: a. All the questions are compulsory.

More information

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields:

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields: Assignment 6 Q1. Create a database of students using structures, where in each entry of the database will have the following fields: 1. a name, which is a string with at most 128 characters 2. their marks

More information

Applications of Structures (1A) Young Won Lim 12/8/17

Applications of Structures (1A) Young Won Lim 12/8/17 Applications of (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Module 6: Array in C

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

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER 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 model answer and the answer written by candidate

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

Chethan Raj C Assistant Professor Dept. of CSE

Chethan Raj C Assistant Professor Dept. of CSE Chethan Raj C Assistant Professor Dept. of CSE Module 01: Contents 1. Data Structures. 2. Classifications (Primitive & Non Primitive). 3. Data structure Operations. 4. Review of Arrays. 5. Structures.

More information

Student's name: EWU ID:

Student's name: EWU ID: Student's name: EWU ID: Bachelor of Science in Mechanical Engineering Technology 2017-2018 Catalog Year College of Science, Technology, Engineering, and Mathematics SOAR Department: Engr & Des SOAR Major:

More information

Object Oriented Pragramming (22316)

Object Oriented Pragramming (22316) Chapter 1 Principles of Object Oriented Programming (14 Marks) Q1. Give Characteristics of object oriented programming? Or Give features of object oriented programming? Ans: 1. Emphasis (focus) is on data

More information

First year courses and prerequisites Notes Previously offered **

First year courses and prerequisites Notes Previously offered ** Student's name: EWU ID: Bachelor of Science in Electrical Engineering 2016-2017 Catalog Year College of Science, Technology, Engineering, and Mathematics SOAR Department: Engr & Des SOAR Major: ELEC ENGR

More information

First year courses and prerequisites Notes Previously offered ** Satisfies: CHEM GECR. CHEM 153 General Chemistry (5 cr.) Satisfies: CHEM GECR

First year courses and prerequisites Notes Previously offered ** Satisfies: CHEM GECR. CHEM 153 General Chemistry (5 cr.) Satisfies: CHEM GECR Student's name: EWU ID: Bachelor of Science in Chemistry & Biochemistry Pre-Med-Pre-Dent-Pre-Vet options College of Science, Technology, Engineering, and Mathematics SOAR Department: Chemistry SOAR Major:

More information

Session Chapter 4: Classess & Object

Session Chapter 4: Classess & Object Session 2017-18 Chapter 4: Classess & Object How does a class enforce data-hiding, abstraction, and encapsulation? What is the significance of access specifiers in a class? How are class and object different

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

Electronic Technology

Electronic Technology Electronic Technology Credentials Electronic Technology Skills Certificate Electronic Technology Certificate Electronic Technology AAS Degree 16 cr. 33-34 cr. 60-66 cr. Major Description Schoolcraft provides

More information

VARIABLES AND CONSTANTS

VARIABLES AND CONSTANTS UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data

More information

Programming: Java. Chapter Objectives. Chapter Objectives (continued) Program Design Including Data Structures. Chapter 7: User-Defined Methods

Programming: Java. Chapter Objectives. Chapter Objectives (continued) Program Design Including Data Structures. Chapter 7: User-Defined Methods Chapter 7: User-Defined Methods Java Programming: Program Design Including Data Structures Chapter Objectives Understand how methods are used in Java programming Learn about standard (predefined) methods

More information

Student's name: EWU ID:

Student's name: EWU ID: Student's name: EWU ID: Bachelor of Arts in Education in Chemistry & Biochemistry Secondary Education 2017-2018 Catalog Year College of Science, Technology, Engineering, and Mathematics SOAR Department:

More information

Student's name: EWU ID:

Student's name: EWU ID: Student's name: EWU ID: Bachelor of Arts in Education in Physics Secondary Education 2017-2018 Catalog Year College of Science, Technology, Engineering, and Mathematics SOAR Department: Physics SOAR Major:

More information

Multi-Dimensional arrays

Multi-Dimensional arrays Multi-Dimensional arrays An array having more then one dimension is known as multi dimensional arrays. Two dimensional array is also an example of multi dimensional array. One can specify as many dimensions

More information

Object Oriented Programming. Solved MCQs - Part 2

Object Oriented Programming. Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 It is possible to declare as a friend A member function A global function A class All of the above What

More information

Scheme of valuations-test 3 PART 1

Scheme of valuations-test 3 PART 1 Scheme of valuations-test 3 PART 1 1 a What is string? Explain with example how to pass string to a function. Ans A string constant is a one-dimensional array of characters terminated by a null ( \0 )

More information

Variables and numeric types

Variables and numeric types s s and numeric types Comp Sci 1570 to C++ types Outline s types 1 2 s 3 4 types 5 6 Outline s types 1 2 s 3 4 types 5 6 s types Most programs need to manipulate data: input values, output values, store

More information

Applications of Structures (1A) Young Won Lim 12/4/17

Applications of Structures (1A) Young Won Lim 12/4/17 Applications of (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

B.A. Mathematics

B.A. Mathematics B.A. Mathematics 2018-2019 MATH 113 4 MATH 114 4 *S.B.S = Social and Core (Written) 3 MATH 125 3 Behavioral Science Core (Oral) 3 Core (W.C.) 3 *W.C. = Western Core (S.B.S) 3 Core (N.S.) 4 Civilization

More information

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++ Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and

More information

2016 COMPUTER SCIENCE

2016 COMPUTER SCIENCE Total number of printed pages: 5 Total marks : 70 2016 COMPUTER SCIENCE Time : 3 hours General instructions: i) Approximately 15 minutes is allotted to read the question paper and revise the answers. ii)

More information

1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms.

1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms. PROBLEM: 1. FIBONACCI SERIES Write a C++ program to generate the Fibonacci for n terms. AIM: To write a C++ program to generate the Fibonacci for n terms. PROGRAM CODING: #include #include

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 (a): Classes & Objects Lecture Contents 2 What is a class? Class definition: Data Methods Constructors objects Static members

More information

Department of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List

More information

Programming in C. main. Level 2. Level 2 Level 2. Level 3 Level 3

Programming in C. main. Level 2. Level 2 Level 2. Level 3 Level 3 Programming in C main Level 2 Level 2 Level 2 Level 3 Level 3 1 Programmer-Defined Functions Modularize with building blocks of programs Divide and Conquer Construct a program from smaller pieces or components

More information

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming CSE101-Lec#18 Multidimensional Arrays Application of arrays Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Defining and processing 1D array 2D array Applications of arrays 1-D array A

More information

CHAPTER 13 STRUCTURES

CHAPTER 13 STRUCTURES CHAPTER 13 STRUCTURES INTRODUCTION In C++ language, custom data types can be created to meet users requirements in 5 ways: class, structure, union, enumeration and typedef. Structures are one of the 2

More information

SQL-Nested Queries & Aggregate functions. Lecture By Binu Jasim 02-Aug-2016

SQL-Nested Queries & Aggregate functions. Lecture By Binu Jasim 02-Aug-2016 SQL-Nested Queries & Aggregate functions Lecture By Binu Jasim 02-Aug-2016 Student rollno name dept CGPA 123 Alice CSE 8.2 201 Bob EEE 5.6 399 Cherry CSE 8.2 Course rollno cname dept marks 123 DBMS CSE

More information

Programming Language. Functions. Eng. Anis Nazer First Semester

Programming Language. Functions. Eng. Anis Nazer First Semester Programming Language Functions Eng. Anis Nazer First Semester 2016-2017 Definitions Function : a set of statements that are written once, and can be executed upon request Functions are separate entities

More information

CSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU

CSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU CSE101-lec#12 Designing Structured Programs Introduction to Functions Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Designing structured programs in C: Counter-controlled repetition

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Commentary Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 985 postfix-expression syntax postfix-expression:

More information

First year courses and prerequisites Notes Previously offered **

First year courses and prerequisites Notes Previously offered ** Student's name: EWU ID: Bachelor of Science in Mechanical Engineering Technology 2016-2017 Catalog Year College of Science, Technology, Engineering, and Mathematics SOAR Department: Engr & Des SOAR Major:

More information

CSCI 2132 Software Development. Lecture 29: Dynamic Memory Allocation

CSCI 2132 Software Development. Lecture 29: Dynamic Memory Allocation CSCI 2132 Software Development Lecture 29: Dynamic Memory Allocation Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 22-Nov-2017 (29) CSCI 2132 1 Previous Lecture Protecting header

More information

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.

More information

First year courses and prerequisites Notes Previously offered **

First year courses and prerequisites Notes Previously offered ** Student's name: EWU ID: Bachelor of Science in Mechanical Engineering 2016-2017 Catalog Year College of Science, Technology, Engineering, and Mathematics SOAR Department: Engr & Des SOAR Major: MECH ENGR

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 : Classes & Objects Lecture Contents What is a class? Class definition: Data Methods Constructors Properties (set/get) objects

More information

7. C++ Class and Object

7. C++ Class and Object 7. C++ Class and Object 7.1 Class: The classes are the most important feature of C++ that leads to Object Oriented programming. Class is a user defined data type, which holds its own data members and member

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

Bachelor of Science in Electrical Engineering

Bachelor of Science in Electrical Engineering Bachelor of Science in Electrical Engineering 1 Bachelor of Science in Electrical Engineering Learn more about the Bachelor of Science in Electrical Engineering (https://www.temple.edu/academics/degree-programs/electrical-engineering-majoren-ece-bsee).

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

CSCI 1370 APRIL 26, 2017

CSCI 1370 APRIL 26, 2017 CSCI 1370 APRIL 26, 2017 ADMINISTRATIVIA Quarter Exam #3: scores ranged from 0.70 points to 10.05 points, with a median score of 7.07. Note: a total bonus of 1.00 points (+.5 curve, +.5 group reward) was

More information

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat Ch - 7. Data File Handling

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat Ch - 7. Data File Handling Introduction Data File Handling The fstream.h Header file Data Files Opening and Closing File Steps to process a File in your Program Changing the behavior of Stream Sequential I/O With Files Detecting

More information

School Management System

School Management System School Management System #include #include #include #include #include #include #include struct marks_criteria int sc_min,com_min,arts_min,

More information

Program Changes Software Engineering

Program Changes Software Engineering Department of Systems & Computer 1/11 Program Changes Department of Systems and Computer, Carleton University, Canada Why Are We Here? Substantial changes to the program have been approved by the University

More information

Mock Test Paper-3. Computer Science. Duration : 3hrs Max Marks : 70

Mock Test Paper-3. Computer Science. Duration : 3hrs Max Marks : 70 Mock Test Paper-3 Computer Science Mock Test Paper-3 11 Duration : 3hrs Max Marks : 70 1. (a) How does a class inforce data hiding? 2 (b) Name the header files to which the following belong- 1 (c) Rewrite

More information