The document contains 40 multiple choice questions related to computer science class 12. It covers topics like variables, data types, operators, loops, functions, arrays and more. The questions test concepts like escape sequences, format specifiers, assignment operators, comments, input/output functions, and the difference between various loops in C programming language. It is a practice test to help students prepare for their computer science exam.
An introduction to the C programming language for the students of the course "HJ-82 Ontwerpen voor de optie multimedia en signaalverwerking: seminaries", taught by the authors at the Catholic University of Leuven.
This document provides an overview of the C programming language development process. It discusses the different phases a C program goes through from editing the source code to execution. It describes the preprocessor, compiler, linker, and loader and their roles. It also covers C program structures like comments, header files, and the main function. Finally, it discusses some C fundamentals like data types, variables, literals, and variable scope.
This document provides an overview and structure of a course on advanced C language for engineering. It discusses topics that will be covered including the FILE methodology, literate programming with cweb tools, classes for embedded systems, and using C with Lex and YACC for linguistic support. The document outlines the overall structure of the course and provides examples to introduce fundamental C concepts like variables, data types, loops, conditional statements, and functions.
OpenGurukul : Language : C ProgrammingOpen Gurukul
C is a general-purpose programming language that has been widely used since the early 1970s. Some key points about C programming covered in the document include:
- C was developed in the early 1970s and has since become widely popular for system and application software development due to its portability, efficiency, and ability to access hardware.
- C programs are typically structured using functions, header files, type definitions, and main functions. Input/output is handled using functions like printf and scanf.
- C supports basic data types like integers, floats, characters and strings. Variables must be declared before use and can be initialized.
- The document provides examples of C programs and covers basic concepts like constants
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
The document discusses the programming language C. It provides a brief history of C including its creation in 1972 by Dennis Ritchie and key developments like ANSI C. It also defines C as a high-level, general purpose language ideal for developing firmware and portable applications. Originally intended for writing system software, C was developed for the Unix Operating System. The document then discusses some basic C concepts like variables, logical operators, and control flow statements like if-else, switch, while loops, do-while loops, and for loops.
This is the Complete course of C Programming Language for Beginners. All Topics of C programming Language are covered in this single power point presentation.
Visit: www.cyberlabzone.com
This document provides information on C programming concepts including data types, operators, functions, and basic program structure.
It defines key concepts like variables, data types (integer, float, character), operators (arithmetic, relational, logical), functions (printf, scanf), and basic program anatomy with main(), I/O statements, and comments. Examples are given to illustrate variable declaration and usage, arithmetic operations, type casting, and basic programs to read/write and perform calculations.
An introduction to the C programming language for the students of the course "HJ-82 Ontwerpen voor de optie multimedia en signaalverwerking: seminaries", taught by the authors at the Catholic University of Leuven.
This document provides an overview of the C programming language development process. It discusses the different phases a C program goes through from editing the source code to execution. It describes the preprocessor, compiler, linker, and loader and their roles. It also covers C program structures like comments, header files, and the main function. Finally, it discusses some C fundamentals like data types, variables, literals, and variable scope.
This document provides an overview and structure of a course on advanced C language for engineering. It discusses topics that will be covered including the FILE methodology, literate programming with cweb tools, classes for embedded systems, and using C with Lex and YACC for linguistic support. The document outlines the overall structure of the course and provides examples to introduce fundamental C concepts like variables, data types, loops, conditional statements, and functions.
OpenGurukul : Language : C ProgrammingOpen Gurukul
C is a general-purpose programming language that has been widely used since the early 1970s. Some key points about C programming covered in the document include:
- C was developed in the early 1970s and has since become widely popular for system and application software development due to its portability, efficiency, and ability to access hardware.
- C programs are typically structured using functions, header files, type definitions, and main functions. Input/output is handled using functions like printf and scanf.
- C supports basic data types like integers, floats, characters and strings. Variables must be declared before use and can be initialized.
- The document provides examples of C programs and covers basic concepts like constants
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
The document discusses the programming language C. It provides a brief history of C including its creation in 1972 by Dennis Ritchie and key developments like ANSI C. It also defines C as a high-level, general purpose language ideal for developing firmware and portable applications. Originally intended for writing system software, C was developed for the Unix Operating System. The document then discusses some basic C concepts like variables, logical operators, and control flow statements like if-else, switch, while loops, do-while loops, and for loops.
This is the Complete course of C Programming Language for Beginners. All Topics of C programming Language are covered in this single power point presentation.
Visit: www.cyberlabzone.com
This document provides information on C programming concepts including data types, operators, functions, and basic program structure.
It defines key concepts like variables, data types (integer, float, character), operators (arithmetic, relational, logical), functions (printf, scanf), and basic program anatomy with main(), I/O statements, and comments. Examples are given to illustrate variable declaration and usage, arithmetic operations, type casting, and basic programs to read/write and perform calculations.
Contains C programming tutorial for beginners with lot of examples explained. This tutorial contains each and every feature of C programming that will help you. C programming tutorial covering basic C Programming examples, data types, functions, loops, arrays, pointers, etc.
The document discusses the C programming language. It provides a brief history of C, describes its data types and operators. It then presents 26 sample C programs demonstrating basic concepts like input/output, conditional statements, loops, functions, arrays and strings. The programs cover calculations, pattern printing, factorial, Fibonacci series and other simple programming examples.
The document provides information on the C programming language. It discusses that C was developed by Dennis Ritchie at Bell Labs in 1972 and is a general purpose programming language well suited for business and scientific applications. It describes the basic structure of a C program including sections for links, definitions, variables, functions, and input/output statements. It also covers various C language concepts like data types, operators, decision making statements, looping statements, functions, and more.
The document provides an overview of the C programming language. It states that C was developed in 1972 by Dennis Ritchie at Bell Labs and was used to develop the UNIX operating system. The document then covers various features of C like it being a mid-level programming language, having structured programming, pointers, loops, functions, arrays, and more. It provides examples to explain concepts like input/output functions, data types, operators, control structures, and pointers.
The document contains 18 questions asking to write C programs for various tasks. These include swapping two numbers, finding roots of a quadratic equation, converting between Celsius and Fahrenheit scales, calculating simple interest, finding the sum and maximum of numbers, checking even/odd and positive/negative status, performing arithmetic operations using switch case, reversing numbers, and more. The document provides algorithms and sample C code to solve each problem.
The document provides an overview of the C++ programming language. It discusses what C++ is, its history and features. It then outlines various C++ concepts like identifiers, constants, data types, comments, operators, variables, and statements. It also covers control structures like decision making statements (if-else, switch), looping (for, while, do-while), and functions. The document is intended as a lecture on the basic elements of the C++ language.
The document provides an overview of the C programming language. It discusses the history and creation of C, key features of C like portability and efficiency, C program structure, data types in C including integer, floating point, and character types, and variable naming conventions. It also covers basic C programs and examples to illustrate the use of data types, operators, and input/output functions in C.
This document contains notes from a lecture on C programming. It introduces basic C concepts like data types, operators, input/output functions, and provides examples of simple C programs. It also discusses compiling and executing C code, precedence rules for operators, and homework problems involving increment operators. The lecture aims to recap basic C knowledge and provide more in-depth coverage of topics like data types, arithmetic operations, and I/O functions.
The document discusses algorithms and the C programming language. It defines an algorithm as a set of steps to solve a problem, and discusses the program development lifecycle including problem analysis, design, coding, debugging, and testing. It also covers C language basics like data types, variables, operators, and functions. C was created for system development like operating systems. It produces efficient code and is widely used for tasks like compilers, drivers, databases and more.
This document provides an introduction to C++ for Java developers. It discusses the C++ standard and standard library, which includes containers, strings, input/output streams, and other functionality. It also covers installing compilers like GCC, compiling and running simple C++ programs, code style, using Makefiles, and includes examples of basic C++ syntax like output, input, datatypes, and strings.
This PPT is all about INTRODUCTION TO C LANGUAGE in which all basic topics are covered and the information present in this is refered from a book called "Let Us C" by YASHAVANT KANETKAR i.e. This PPT is having all important points of first chapter of "Let Us C". If any doubt plz ask us in comment.
This document provides an overview of the C programming language, including:
- Why software is needed for embedded systems and choosing an appropriate programming language
- Key features of C like being easier/faster to develop with, portability, and efficient pointer usage
- Differences between embedded C and desktop C like writing low-level and inline assembly code
- The structure of a basic C program and a "Hello, World!" example
- C programming basics like constants, variables, data types, and arithmetic, relational, logical, and bitwise operators
- Control flow statements in C like if, if/else, and switch
This document provides an overview of the C programming language. It covers various C language concepts like data types, operators, control structures, arrays, strings, functions and more. The document is divided into 9 sections with each section covering a specific C concept. For example, section 1 provides an introduction to C including its history, the difference between compilers and interpreters. Section 2 covers data types, constants and variables in C. Section 3 discusses operators and expressions. Section 4 explains various control structures like if-else, switch case etc. Section 5 is about looping constructs like while, do-while and for loops. Section 6 demonstrates looping with patterns. Section 7 describes arrays in C including 1D and 2D arrays. Section 8 covers
The document discusses the basics of C language including tokens, data types, constants, and variables. It covers keywords, identifiers, operators, and other tokens in C. It describes the basic integral and floating point data types like int, char, float, and double. It also discusses numerical, character, and string constants. Finally, it explains how to declare variables and the differences between global and local variables.
This document provides an overview of the C programming language. It begins with an outline of topics covered, then discusses the history and development of C. Key features of C mentioned include its portability, speed, and ability to be extended by users. The document explains the role of compilers in converting C code to object code. It also includes examples of basic C programs and flowcharts, and covers C concepts like data types, variables, operators, and control structures. Overall, the document serves as an introduction to the C language, its history and basics.
Programming is an essential skill if you seek a career in software development, or in other fields of Coding. This fundamental of programming course is the first in the specialization for Introduction to Programming in C, but its lessons extend to any language you might want to study. This is because programming is primarily about solving a set of problems and writing the algorithm.
Introduction to C Language(Video Link https://youtu.be/bEyJsEJ7YnY)
Part I
1 History of C Language
2 ALGOL, BCPL, B, C, K&R C, ANSI C, C90
3 C Program Structure
4 How to Download and Install Turbo C
5 How to Create and run first program in Turbo C
6 Practical Assignment
Part II
Introduction to C Language
1. Language Fundamentals
2. Character Set (With ASCII Values)- Source Character Set, Execution Character Set .
3. Tokens in C- Keywords, Identifiers, Variables, Constants, Strings, Special Symbols, Operators.
4. DataTypes In C -
Primary- int, float, char, void
User define- Enum, Struct, Typedef
Derived - Array, Pointer
5. Types of Operators- Arithmetic, Relational, Logical, Bit wise, Assignment, Miscellaneous
This document provides an introduction to the C++ programming language. It discusses what C++ is, its origins as an extension of the C language, and some key concepts in C++ programs. These include variables, data types, functions, input/output statements, and a simple example program. The document then demonstrates arithmetic, relational, and logical operations and examines pseudocode as a way to design algorithms before coding. Decision statements and flowcharts are introduced as tools for programming logic and conditional execution.
Programming C Language Tutorial. Its an Learning document for base programming. Its an copied data from some websites and books. I tried to make more easier through this documents.
The document provides an overview of C programming basics including:
- A brief history of the C programming language and why it is commonly used in embedded systems.
- The basic structure of a C program including comments, header files, functions, and data types.
- How to declare and initialize variables in C including different data types.
- Operators and expressions in C including arithmetic, relational, logical, and bitwise operators.
- Decision making and control flow in C using if/else statements and switch cases.
- Instructions to ask questions and contact the instructor for help.
Contains C programming tutorial for beginners with lot of examples explained. This tutorial contains each and every feature of C programming that will help you. C programming tutorial covering basic C Programming examples, data types, functions, loops, arrays, pointers, etc.
The document discusses the C programming language. It provides a brief history of C, describes its data types and operators. It then presents 26 sample C programs demonstrating basic concepts like input/output, conditional statements, loops, functions, arrays and strings. The programs cover calculations, pattern printing, factorial, Fibonacci series and other simple programming examples.
The document provides information on the C programming language. It discusses that C was developed by Dennis Ritchie at Bell Labs in 1972 and is a general purpose programming language well suited for business and scientific applications. It describes the basic structure of a C program including sections for links, definitions, variables, functions, and input/output statements. It also covers various C language concepts like data types, operators, decision making statements, looping statements, functions, and more.
The document provides an overview of the C programming language. It states that C was developed in 1972 by Dennis Ritchie at Bell Labs and was used to develop the UNIX operating system. The document then covers various features of C like it being a mid-level programming language, having structured programming, pointers, loops, functions, arrays, and more. It provides examples to explain concepts like input/output functions, data types, operators, control structures, and pointers.
The document contains 18 questions asking to write C programs for various tasks. These include swapping two numbers, finding roots of a quadratic equation, converting between Celsius and Fahrenheit scales, calculating simple interest, finding the sum and maximum of numbers, checking even/odd and positive/negative status, performing arithmetic operations using switch case, reversing numbers, and more. The document provides algorithms and sample C code to solve each problem.
The document provides an overview of the C++ programming language. It discusses what C++ is, its history and features. It then outlines various C++ concepts like identifiers, constants, data types, comments, operators, variables, and statements. It also covers control structures like decision making statements (if-else, switch), looping (for, while, do-while), and functions. The document is intended as a lecture on the basic elements of the C++ language.
The document provides an overview of the C programming language. It discusses the history and creation of C, key features of C like portability and efficiency, C program structure, data types in C including integer, floating point, and character types, and variable naming conventions. It also covers basic C programs and examples to illustrate the use of data types, operators, and input/output functions in C.
This document contains notes from a lecture on C programming. It introduces basic C concepts like data types, operators, input/output functions, and provides examples of simple C programs. It also discusses compiling and executing C code, precedence rules for operators, and homework problems involving increment operators. The lecture aims to recap basic C knowledge and provide more in-depth coverage of topics like data types, arithmetic operations, and I/O functions.
The document discusses algorithms and the C programming language. It defines an algorithm as a set of steps to solve a problem, and discusses the program development lifecycle including problem analysis, design, coding, debugging, and testing. It also covers C language basics like data types, variables, operators, and functions. C was created for system development like operating systems. It produces efficient code and is widely used for tasks like compilers, drivers, databases and more.
This document provides an introduction to C++ for Java developers. It discusses the C++ standard and standard library, which includes containers, strings, input/output streams, and other functionality. It also covers installing compilers like GCC, compiling and running simple C++ programs, code style, using Makefiles, and includes examples of basic C++ syntax like output, input, datatypes, and strings.
This PPT is all about INTRODUCTION TO C LANGUAGE in which all basic topics are covered and the information present in this is refered from a book called "Let Us C" by YASHAVANT KANETKAR i.e. This PPT is having all important points of first chapter of "Let Us C". If any doubt plz ask us in comment.
This document provides an overview of the C programming language, including:
- Why software is needed for embedded systems and choosing an appropriate programming language
- Key features of C like being easier/faster to develop with, portability, and efficient pointer usage
- Differences between embedded C and desktop C like writing low-level and inline assembly code
- The structure of a basic C program and a "Hello, World!" example
- C programming basics like constants, variables, data types, and arithmetic, relational, logical, and bitwise operators
- Control flow statements in C like if, if/else, and switch
This document provides an overview of the C programming language. It covers various C language concepts like data types, operators, control structures, arrays, strings, functions and more. The document is divided into 9 sections with each section covering a specific C concept. For example, section 1 provides an introduction to C including its history, the difference between compilers and interpreters. Section 2 covers data types, constants and variables in C. Section 3 discusses operators and expressions. Section 4 explains various control structures like if-else, switch case etc. Section 5 is about looping constructs like while, do-while and for loops. Section 6 demonstrates looping with patterns. Section 7 describes arrays in C including 1D and 2D arrays. Section 8 covers
The document discusses the basics of C language including tokens, data types, constants, and variables. It covers keywords, identifiers, operators, and other tokens in C. It describes the basic integral and floating point data types like int, char, float, and double. It also discusses numerical, character, and string constants. Finally, it explains how to declare variables and the differences between global and local variables.
This document provides an overview of the C programming language. It begins with an outline of topics covered, then discusses the history and development of C. Key features of C mentioned include its portability, speed, and ability to be extended by users. The document explains the role of compilers in converting C code to object code. It also includes examples of basic C programs and flowcharts, and covers C concepts like data types, variables, operators, and control structures. Overall, the document serves as an introduction to the C language, its history and basics.
Programming is an essential skill if you seek a career in software development, or in other fields of Coding. This fundamental of programming course is the first in the specialization for Introduction to Programming in C, but its lessons extend to any language you might want to study. This is because programming is primarily about solving a set of problems and writing the algorithm.
Introduction to C Language(Video Link https://youtu.be/bEyJsEJ7YnY)
Part I
1 History of C Language
2 ALGOL, BCPL, B, C, K&R C, ANSI C, C90
3 C Program Structure
4 How to Download and Install Turbo C
5 How to Create and run first program in Turbo C
6 Practical Assignment
Part II
Introduction to C Language
1. Language Fundamentals
2. Character Set (With ASCII Values)- Source Character Set, Execution Character Set .
3. Tokens in C- Keywords, Identifiers, Variables, Constants, Strings, Special Symbols, Operators.
4. DataTypes In C -
Primary- int, float, char, void
User define- Enum, Struct, Typedef
Derived - Array, Pointer
5. Types of Operators- Arithmetic, Relational, Logical, Bit wise, Assignment, Miscellaneous
This document provides an introduction to the C++ programming language. It discusses what C++ is, its origins as an extension of the C language, and some key concepts in C++ programs. These include variables, data types, functions, input/output statements, and a simple example program. The document then demonstrates arithmetic, relational, and logical operations and examines pseudocode as a way to design algorithms before coding. Decision statements and flowcharts are introduced as tools for programming logic and conditional execution.
Programming C Language Tutorial. Its an Learning document for base programming. Its an copied data from some websites and books. I tried to make more easier through this documents.
The document provides an overview of C programming basics including:
- A brief history of the C programming language and why it is commonly used in embedded systems.
- The basic structure of a C program including comments, header files, functions, and data types.
- How to declare and initialize variables in C including different data types.
- Operators and expressions in C including arithmetic, relational, logical, and bitwise operators.
- Decision making and control flow in C using if/else statements and switch cases.
- Instructions to ask questions and contact the instructor for help.
C programming language was developed by Dennis Ritchie at Bell Labs in 1972. It became widely popular after the publication of The C Programming Language book by Kernighan and Ritchie in 1978. C is a middle-level language that provides programmers the ability to write both low-level and high-level programs. It has various data types, operators, input/output functions and supports structured programming. A C program must be compiled by a compiler or interpreted by an interpreter to convert it into machine-readable code before it can be executed.
C is a procedural programming language. It was developed in the early 1970s and is still widely used. The document provides an overview of key aspects of C including data types, variables, constants, operators, control statements like if/else, and functions. It also discusses C programming concepts like low-level vs high-level languages, header files, comments, escape sequences, and more. The document serves as a useful introduction and reference for someone learning the basics of the C programming language.
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxrajkumar490591
This document discusses various topics related to C programming language including:
- The structure of a typical C program which includes header files inclusion, main method declaration, variable declaration, function body, and return statement.
- Different types of variables in C like local, global, static, automatic, and external variables. Local variables are declared within a function while global variables are declared outside. Static variables retain their value between function calls.
- Key concepts like data types, valid variable names, compilers, linkers, and how a C program is executed after compilation.
This document provides an overview of the C programming language. It discusses that C was developed in 1972 at Bell Labs and is a popular systems and applications programming language. The document then covers various C language concepts like data types, variables, operators, input/output functions, and provides examples of basic C programs and code snippets.
Learn c language Important topics ( Easy & Logical, & smart way of learning)Rohit Singh
Learn C language with an easy way including all important topics in C.
Learn c language Important topics ( Easy & Logical, & smart way of learning)
preprocessor Directive, Search Strategy, Header file, return 0 in C, return, main function, flow of execution, explicit return, function, return type and non return type function. Run- time Environment, type specifier, void keyword, 32 keyword in C, openning curly brace and closing curly brace, system library, single argument, String literal is an unnamed array with element of type char.
The C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Chris Adamson
The document provides an overview of the C programming language. It begins by explaining that Objective-C extends standard ANSI C with object-oriented capabilities. It then discusses why C remains important today due to its use in libraries, operating systems, and as the base for many other popular languages. The document proceeds to cover basic C concepts like variables, data types, functions, flow control, pointers, memory allocation, and I/O parameters. It emphasizes that C provides high performance with a minimal footprint while abstracting away the CPU and memory.
This document provides an overview of embedded systems programming. It discusses that embedded computers are used as part of larger systems to control physical devices. Reliability is often critical and resources are limited. Application areas include microcontrollers, real-time response requirements, and possible organization of embedded systems. C is discussed as a commonly used programming language for embedded systems due to its efficiency, ability to handle low-level activities, and ability to be compiled on different computers.
This document provides an overview of the C programming language, including its history, uses, basic environment, data types, variables, operators, control structures like if/else statements and loops. It begins with the origins of C in the 1970s and explains that C combines high- and low-level language features, making it useful for systems programming tasks like operating systems and compilers. Examples are provided throughout to illustrate core C concepts like getting user input, performing calculations, and repeating actions with for, while and do-while loops.
This document discusses the C programming language. Some key points:
- C was developed in the early 1970s and influenced by many other languages. It is a middle-level language that provides high-level and low-level capabilities.
- C is widely used to develop operating systems, device drivers, databases and other core systems software. It remains popular due to its portability, efficiency and ability to interface with hardware.
- The document outlines C's basic syntax including data types, variables, constants, functions and control structures. It provides examples of common functions like printf, scanf and input/output statements.
- Overall the document serves as an introduction to the C language, its history, capabilities
This document provides an introduction and overview of the C programming language. It discusses what a computer is and how programming languages work. It introduces machine language and high-level languages like C. Key aspects of C are explained, including data types, variables, operators, functions, and basic syntax. Examples of simple C programs are provided.
The document provides an introduction to the C programming language, covering its history, uses, basic concepts, and key functions. It discusses how C was created at Bell Labs to develop the UNIX operating system, its widespread adoption, and importance. The document outlines common C data types, control flow statements like conditionals and loops, functions and their structure, and input/output functions like printf, scanf, gets and puts. It provides examples of basic C programs and how functions, conditionals, and I/O are implemented.
The document provides information about the C programming language. It discusses that C is a procedural language that is case sensitive and can be compiled on various platforms. It also provides examples of C programs, including printing "Hello World", using data types like int and float, and control structures like if-else statements and for loops. The document contains code snippets to demonstrate basic C programming concepts.
This document provides an introduction to the C programming language. It discusses that C was developed in the 1970s and became a popular language due to its efficiency, ability to handle low-level tasks, and ability to compile on different platforms. The document then discusses the structure of a C program and provides examples of basic input/output programs. It also defines key C concepts like variables, data types, operators, and functions.
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
Esoft Metro Campus - Certificate in java basics
(Template - Virtusa Corporate)
Contents:
Structure of a program
Variables & Data types
Constants
Operators
Basic Input/output
Control Structures
Functions
Arrays
Character Sequences
Pointers and Dynamic Memory
Unions
Other Data Types
Input/output with files
Searching
Sorting
Introduction to data structures
The document discusses the C programming language. It states that C was created by Dennis Ritchie at Bell Labs in 1972 to develop the UNIX operating system. It became more widely used after Brian Kernighan and Dennis Ritchie published the first description of C in 1978. C is a general-purpose, high-level language that produces efficient, low-level code and can be compiled on many platforms. It is widely used to develop operating systems, compilers, databases and other systems programs.
structure of c program. everything about the structure is in this ppt...................................................................viearhgviuehdrgbvkejfsdbvaerhbgf;oiweHFGIO;WENEGV;KLADFN;OVIBNA;OINVO;IRANV;OINDF;LNVOIASRDNGVIOERNAVB EOANGVV ERNGOEWN
This document provides an overview of operating systems. It discusses that an operating system acts as an interface between the user and hardware, managing resources and running applications. Key parts of an operating system include the kernel and system programs. Operating systems allow for multiprogramming and time-sharing to enable efficient sharing of resources between multiple processes. Interprocess communication and process synchronization are important aspects that operating systems facilitate.
This document is a lab manual for database management systems. It contains instructions for installing and using Visual Studio and SQL Server software. Visual Studio is a popular integrated development environment used to develop a wide range of computer programs and applications. It includes features like a code editor, debugger, and various designers. The document provides guidance on tasks for several labs covering topics like creating applications in Visual Studio, installing and managing databases in SQL Server, and building a school management system to apply concepts.
The document provides an outline for a course on data structures and algorithms. It includes topics like data types and operations, time-space tradeoffs, algorithm development, asymptotic notations, common data structures, sorting and searching algorithms, and linked lists. The course will use Google Classroom and have assignments, quizzes, and a final exam.
This document discusses algorithms and their analysis. It defines an algorithm as a finite sequence of unambiguous instructions that terminate in a finite amount of time. It discusses areas of study like algorithm design techniques, analysis of time and space complexity, testing and validation. Common algorithm complexities like constant, logarithmic, linear, quadratic and exponential are explained. Performance analysis techniques like asymptotic analysis and amortized analysis using aggregate analysis, accounting method and potential method are also summarized.
The document contains a multiple choice quiz with questions about various topics in computer science. There are 47 multiple choice questions testing knowledge about topics like binary, memory, operating systems, programming languages, networks, and security. The questions are short, with single sentences providing the prompts and possible multiple choice answers.
This document provides an introduction to databases. It defines what a database is, the steps to create one, and benefits such as fast querying and flexibility. It describes database models like hierarchical, network, entity-relationship, and relational. Key database concepts are explained, including entities, attributes, primary keys, and foreign keys. Finally, it outlines database management system components, common users, and introduces Microsoft Access.
Program, Language, & Programming Language
Object Oriented Programming vs Procedure Oriented Programming
About C
Why still Learn C?
Basic Terms
C Stuff
C Syntax
C Program
Flowcharts provide a graphical representation of steps in a process or algorithm using standard symbols. They were developed in the 1920s-1930s to document business processes but are now widely used to depict computer programs and workflows. The key symbols include boxes, diamonds, arrows, and other shapes to represent tasks, decisions, data, and flow. Flowcharts clarify complex processes, help teams understand them, and can be used to improve or design new procedures.
Algorithm
What is an algorithm?
How are mathematical statements and algorithms related?
What do algorithms have to do with computers?
Pseudo Code
What is pseudocode?
Writing pseudocode
Pseudo Code vs Algorithm
This document outlines the chapters and content covered in a Computer Science course. It includes 17 total chapters, with 5 theoretical chapters, 8 practical chapters, and 4 optional chapters. The chapters cover topics like programming concepts, algorithms, an overview of the C language, variables, operators, input/output statements, selection and iteration control structures, functions, arrays, strings, pointers, data files, data management systems, and Microsoft Access. It also provides a study plan which includes performing practical work every Tuesday, having question/answer sessions every Friday, and using other days for theoretical content, as well as creating a WhatsApp group for the class.
The document discusses computer crimes and cyber crimes under Pakistani law. It defines computer crimes such as copyright violation, cracking codes, cyberbullying and various types of computer viruses. It then outlines specific cyber crimes in Pakistan such as spreading false information about an individual, making or spreading explicit images without consent, cyberstalking, and hacking for stalking. The punishments for these crimes under Pakistani law include prison sentences up to 7 years and fines up to 10 million Pakistani rupees.
Components of Data Communication
Characteristics of Data Transmission
Communication Media
Communication Speed
Communication Hardware
Communication Software
OSI Model
This document provides an overview of basic concepts in information technology, including definitions of computers and computer systems, their key characteristics and components. It describes common input devices like keyboards, mice, and scanners, as well as output devices like monitors, printers and speakers. It also discusses computer hardware, software, data, procedures, and different generations of computers from the past to present.
1st Year Computer Science Book
Sindh Text Book Board Introduction
Introduction
Syed Zaid Irshad
Rules (that You have to Follow)
Book Introduction
10 Chapters
Theoretical Chapters are 6
Practical Chapters are 4
Chapter 1: Basic Concept of Information Technology
Introduction of Computer
Definition
Characteristics
Parts of Computer
Input
Output
Memory
Primary Storage
Secondary Storage
Ports
Language Translator
Compiler
Interpreter
Generations of Programming Language
Ages of Computers
Generations of Computer
Classification of Computers
Chapter 2: Information Networks
Types of Network
LAN
WAN
MAN
GAN
Topologies
Star
Ring
Bus
Hybrid
File Transfer Protocol
World Wide Web
Chapter 3: Data Communication
Standards
Transmission
Simples
Half Duplex
Full Duplex
Media
Twisted Pair Cable
Coaxial Cable
Fiber Optic Cable
Microwave Transmission
Satellite Transmission
Open Systems Interconnection model (OSI model)
Chapter 4: Applications and Use of Computers
Difference Between Application and Use
Impacts of Computers
Chapter 5: Computer Architecture
Address of Memory Locations
Instruction Format
Fetch and Execute
Chapter 6: Security, Copyright and The Law
Computer Crime
Computer Viruses
Computer Privacy
Software Piracy and Law
Chapter 7: Operating System
User Interface
Graphical User Interface
Operating Systems
Chapter 8: Word Processing
Introduction to MS Word
Creating
Editing
Formatting
Printing
Chapter 9: Spreadsheet
Introduction to MS Excel
Creating
Editing
Formatting
Printing
Formulae
Project
Chapter 10: Internet Browsing and Using E-mail
Create Email ID
Send Mail
Download File
Upload File
Study Plan
Every Tuesday we perform Practical
Every Friday Half of the Lecture will be used as question answer session
Rest of the days are for Theoretical Stuff
Make WhatsApp Group for class where we can share stuff related to the Subject
This document discusses SQL set operators such as UNION, UNION ALL, INTERSECT, and MINUS. It provides examples of how to use each operator to combine result sets from multiple queries, eliminate duplicates, return common or unique rows, and control the order of rows in the final output. Tables used in the examples include the EMPLOYEES and JOB_HISTORY tables, which contain data on current and previous employee jobs. Guidelines are provided around matching columns in UNION queries and using parentheses and ORDER BY.
Using subqueries allows you to solve complex queries by executing a subquery first to help filter or provide information for the main query. There are different types of subqueries - single-row subqueries that return one row and use single-row operators like =, >, and multiple-row subqueries that return multiple rows and use operators like IN, ANY, ALL. Proper syntax and understanding when to use different types of subqueries is important to get the correct results.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Reduce course notes class xii
1. Computer Science Class XII
Multiple Choice Questions
1. an escape sequence can be used to beep from the speaker in C.
2. n escape sequence is used for display output in a newline.
3. <,>, <=,>=,!=, == are Relational operator.
4. A global variable is defined as a declaration outside of any function.
5. A memory location with some data that can be changed is called variable.
6. A pictorial representation of a problem is called a flowchart.
7. A single statement for loop is terminated with a semicolon.
8. A syntax error occurs when the program violates any rules of C programming.
9. A warning appears when you delete a field
10. a++ is equivalent to a=a+1
11. Assuming x does not equal 0, the statement while (x==0) print f (“x==0) while (x==0) causes a logical error
12. C is a relatively simple language that was developed to help students learn to program.
13. Database management systems are intended to eliminate data redundancy.
14. During the development of a program drawing a flowchart is a means to plan the solution.
15. The floating-point variable is used instead of integers to permit the use of decimal points in numbers.
16. Function prototyping for built-in functions is specified in the header file.
17. How many control structures are used in C? 3
18. In preparing a program desk-checking and translating are examples of coding.
19. In preparing a program, one should first define the problem.
20. In the switch case statement, a case block ends with a break;
21. Machine language and assembly language are an example of a low-level language.
22. Precedence determined which operator is used first.
23. scanf () is used to take input in C.
24. The C was developed in 1972.
25. The collection of the same datatypes is called an array.
26. The definition of the main function starts with a reserved word void in C Program.
27. The delay () function is declared in which header file? dos.h
28. The do-while loop is Post-test type of loop.
29. The equal to sign (=) is treated as an operator in C language called the assignment operator.
30. The function fopen () can specify which of the following? The file may be opened for appending
31. The statement for (x=0, x<1, x++) printf (“x=0”) will output once.
32. The value cannot change during the execution of the program is called constant.
33. The while loop is also known as Pre-test loop.
34. These statements if (x=0) printf (“x=0”); is correct syntax, but x=0 will never print
35. What do you call the step-by-step solution to a programming problem? Algorithm
36. When reading one character at a time which of the following functions is appropriate? fgetc()
37. Which is the correct way to define a pointer? int *ptr;
38. Which statement is used to display output n screen in C Program: printf()
39. You can easily create a relationship between tables by using the relationships window.
40. You test a program to find which of the following? Syntax error
Introduction to C
Q. Define C as an object-oriented language.
Ans. C is not an object-oriented language. C is a general-purpose, imperative language, supporting structured
programming. Because C isn't object-oriented therefore C++ came into existence to have OOPs feature and OOP
is a programming language model organized around objects. A language to have an OOPs feature needs to
implement certain principles of OOPs. Few of them are Inheritance, Polymorphism, Abstraction, Encapsulation.
2. Q. Define the origin of C-Language.
Ans. The history of C programming language is quite interesting. C was originally designed for and implemented
on the UNIX operating system on the DEC PDP-ll, by Dennis Ritchie. C is the result of a development process that
started with an older language called BCPL. BCPL was developed by Martin Richards, and it influenced a language
called B, which was invented by Ken Thompson. B led to the development of C in the 1970s.
For many years, the de facto standard for C was the version supplied with the UNIX operating system. In the
summer of 1983, a committee was established to create an ANSI (American National Standards Institute) standard
that would define the C language. The standardization process took six years (much longer than anyone reasonably
expected).
Use printf() function
Q. Write a program that print ½, ¾ 5/6, 7/8, 9/10, 11/12 using for a statement.
Ans. #include <stdio.h>
int main() {
int start=1, end=12;
for (int i = start; i <= end; ++i) {
printf("%d/%dt", i++, i);
}
return 0;
}
Q. Write a program that displays “Welcome to the computer lab. Board of intermediate and secondary
education, Hyderabad.” On-screen.
Ans. #include <stdio.h>
int main() {
// printf() displays the string inside quotation
printf("Welcome to computer lab.n");
printf("Board of intermediate and secondary education, Hyderabad.");
return 0;
}
Q. Write a program, if you enter any alphabet character, the computer will display ASCII code.
Ans. #include <stdio.h>
int main()
{
3. char c;
printf("Enter the Alphabet ");
scanf("%c”, &c);
// %d displays the integer value of a character
// %c displays the actual character
printf("The ASCII value of %c is %d", c, c);
return 0;
}
Format Specifiers
Q. Define Format Specifiers in C.
Ans. In C programming we need lots of format specifier to work with various data types. Format specifiers define
the type of data to be printed on standard output. Whether to print formatted output or to take formatted input
we need format specifiers. Format specifiers are also called a format string.
Here is a complete list of all format specifiers used in C programming language.
Format specifier Description Supported data types
%c Character
Char
unsigned char
%d Signed Integer
Short
unsigned short
Int
Long
%e or %E Scientific notation of float values
Float
Double
%f Floating point Float
%g or %G Similar to %e or %E
Float
Double
%hi Signed Integer (Short) Short
%hu Unsigned Integer (Short) unsigned short
%i Signed Integer
Short
unsigned short
Int
Long
Variables and Constants
Q. Write a short note on Variables and Constants.
Ans. Variables: If you declare a variable in C (later on we talk about how to do this), you ask the operating system
for a piece of memory. This piece of memory you give a name and you can store something in that piece of memory
(for later use). There are two basic kinds of variables in C which are numeric and character.
4. Numeric variables: Numeric variables can either be of the type integer (int) or the type real (float). Integer (int)
values are whole numbers (like 10 or -10). Real (float) values can have a decimal point in them. (Like 1.23 or -
20.123).
Character variables: Character variables are letters of the alphabet, ASCII characters or numbers 0-9. If you declare
a character variable you must always put the character between single quotes (like so‘A’). So, remember a number
without single quotes is not the same as a character with single quotes.
Constants: The difference between variables and constants is that variables can change their value at any time but
constants can never change their value. (The constants value is locked for the duration of the program). Constants
can be very useful, Pi, for instance, is a good example to declare as a constant.
Q. What is variable and how many types of variable in C language.
Ans. A variable is the name of the memory location. It is used to store data. Its value can be changed, and it can
be reused many times.
It is a way to represent memory location through a symbol so that it can be easily identified.
Types of Variables in C
There are many types of variables in c:
• local variable
• global variable
• static variable
• automatic variable
• external variable
Local Variable: A variable that is declared inside the function or block is called a local variable. It must be declared
at the start of the block.
void function1() {
int x=10;//local variable
}
You must have to initialize the local variable before it is used.
Global Variable: A variable that is declared outside the function or block is called a global variable. Any function
can change the value of the global variable. It is available to all the functions. It must be declared at the start of
the block.
int value=20;//global variable
void function1() {
int x=10;//local variable
}
Static Variable: A variable that is declared with the static keyword is called static variable. It retains its value
between multiple function calls.
5. void function1() {
int x=10;//local variable
static int y=10;//static variable
x=x+1;
y=y+1;
printf("%d, %d”, x, y);
}
If you call this function many times, the local variable will print the same value for each function call, e.g., 11,11,11
and so on. But the static variable will print the incremented value in each function call, e.g., 11, 12, 13 and so on.
Automatic Variable: All variables in C that are declared inside the block, are automatic variables by default. We
can explicitly declare an automatic variable using the auto keyword.
void main() {
int x=10;//local variable (also automatic)
auto int y=20;//automatic variable
}
External Variable: We can share a variable in multiple C source files by using an external variable. To declare an
external variable, you need to use the extern keyword.
myfile.h
extern int x=10;//external variable (also global)
Input/output
Q. What is the difference between scanf () and gets () function?
SCANF() GETS()
when scanf() is used to read string input it stops reading
when it encounters whitespace, newline or End of File
when gets() is used to read input it stops reading
input when it encounters newline or End of File.
It is used to read input of any datatype
It does not stop reading the input on encountering
whitespace as it considers whitespace as a string.
It is used only for string input.
Escape Sequence
Q. Write down the most common escape sequence.
Escape Sequences Character
' Single quotation mark
" Double quotation mark
? Question mark
Backslash
0 Null Character
6. b Backspace
f Form feed
n Newline
r Return
t Horizontal tab
v Vertical tab
Operators
Q. Write a short note on Assignment operator.
Ans. Assignment operators are used to assigning value to a variable. The left side operand of the assignment
operator is a variable and right-side operand of the assignment operator is a value. The value on the right side
must be of the same data-type of the variable on the left side otherwise the compiler will raise an error.
Different types of assignment operators are shown below:
“=”: This is the simplest assignment operator. This operator is used to assign the value on the right to the variable
on the left.
For example:
a = 10;
b = 20;
ch = 'y';
“+=”: This operator is a combination of ‘+’ and ‘=’ operators. This operator first adds the current value of the
variable on left to the value on the right and then assigns the result to the variable on the left.
Example:
(a += b) can be written as (a = a + b)
If initially value stored in a is 5. Then (a += 6) = 11.
“-=” This operator is a combination of ‘-‘ and ‘=’ operators. This operator first subtracts the current value of the
variable on left from the value on the right and then assigns the result to the variable on the left.
Example:
(a -= b) can be written as (a = a - b)
If initially value stored in a is 8. Then (a -= 6) = 2.
“*=” This operator is the combination of ‘*’ and ‘=’ operators. This operator first multiplies the current value of
the variable on left to the value on the right and then assigns the result to the variable on the left.
Example:
(a *= b) can be written as (a = a * b)
If initially value stored in a is 5. Then (a *= 6) = 30.
7. “/=” This operator is a combination of ‘/’ and ‘=’ operators. This operator first divides the current value of the
variable on left by the value on the right and then assigns the result to the variable on the left.
Example:
(a /= b) can be written as (a = a / b)
If initially value stored in a is 6. Then (a /= 2) = 3.
Comments
Q. What Is Comment in C Language?
Ans. A comment is an explanation or description of the source code of the program. It helps a developer explain
the logic of the code and improves program readability. At run-time, a comment is ignored by the compiler.
There are two types of comments in C:
• A comment that starts with a slash asterisk /* and finishes with an asterisk slash */ and you can place it anywhere
in your code, on the same line or several lines.
• Single-line Comments which uses a double slash // dedicated to commenting single lines
Loops
Q. What is the difference between while and do-while loop?
Ans. In while the given condition is checked at the start of the loop.
If the condition is false then the loop is not executed at all.
Only when the condition is true the loop block is executed.
In do-while first, the loop block is executed then the condition is checked at the end of 1st-time execution.
ex for a while:
int a=10;
while(a==10)
{
printf("Hellon");
a++;
}
In this 1st the condition is checked: is equal to 10? YES, so the printf statement is executed. Now a is incremented
to 11. Now again when it checks if a is equal to 10, it is false and hence the loop block (printf statement) is not
executed.
ex for do-while:
int a = 10;
do
8. {
printf("Quoran");
} while(a==0);
now observe the condition in the do-while: is a is equal to zero? the statement is false. But what happens in do-
while is that 1st the printf statement is executed and then after that, the condition is checked. Now when the
condition is checked it is false and now the loop is terminated.
If the given condition is false then in while loop it is terminated immediately, but in do while the statement is
executed then the loop is terminated.
The minimum number of times a while loop can run is ZERO times whereas a do-while loop runs for a minimum of
ONE time even if the condition is false.
For
Q. Define for loop with its syntax.
A for loop enables a particular set of conditions to be executed repeatedly until a condition is satisfied. Imagine a
situation where you would have to print numbers from 1 to 100. What would you do? Will you type in the printf
command a hundred times or try to copy/paste it? This simple task would take an eternity. Using a for loop you
can perform this action in three statements. This is the most basic example of the for a loop. It can also be used in
many advanced scenarios depending on the problem statement.
Syntax of a For Loop
for (initialization statement; test expression; update statement) {
// statements
}
The for loop starts with a fork statement followed by a set of parameters inside the parenthesis. The statement is
in lower case. Please note that this is case sensitive, which means the for command always has to be in lower case
in C programming language. The initialization statement describes the starting point of the loop, where the loop
variable is initialized with a starting value. A loop variable or counter is simply a variable that controls the flow of
the loop. The test expression is the condition until when the loop is repeated. The update statement is usually the
number by which the loop variable is incremented.
Q. Write a program that prints numbers from 1 to 10 their squares and cubes side by side.
Ans. #include <stdio.h>
int main() {
int start=1, end=10;
printf(“Numbert Squaret Cuben”);
for (int i = start; i <= end; ++i) {
printf("%dt%dt%dn", i, i*i, i*i*i);
9. }
return 0;
}
Q. Write a program of the table of 7 by using for statement and draw a flow chart also.
Ans. #include <stdio.h>
int main() {
int n=7, i;
printf("Table of 7n");
for (i = 1; i <= 10; ++i) {
printf("%d * %d = %d n", n, i, n * i);
}
return 0;
}
While
Q. Write a program of factorial of 4 by using while loop.
Ans. #include<stdio.h>
#include<conio.h>
10. void main()
{
int n=4;
int i, f;
f=i=1;
while(i<=n)
{
f*=i;
i++;
}
printf("The Factorial of %d is: %d”, n, f);
getch();
}
Do-While
Q. Write a program that prints even numbers from 2 to 20.
Ans. #include <stdio.h>
int main()
{
int i, num=20;
printf("Print all even number until %d n", num);
printf("Even number from 1 to %d aren”, num);
i=1;
do{ //loop for iterates from 1 to maximum
if(i%2==0)
{
printf("%dn”, i);
}
i++;
}while(i<=num);
11. return 0;
}
Q. Write a program of odd series 1 to 19 by using do-while statement.
Ans. #include <stdio.h>
int main()
{
int i, num=19;
printf("Print all odd number until %d n", num);
printf("Odd number from 1 to %d aren”, num);
i=1;
do { //loop for iterates from 1 to maximum
if(i%2==1)
{
printf("%dn”, i);
}i++;
}while(i<=num);
return 0;
}
Break and Continue Statements
Q. Differentiate between Break and Continue Statements.
Break continue
A break can appear in both switch and loop
(for, while, do) statements.
A continue can appear only in the loop (for, while, do)
statements.
A break causes the switch or loop
statements to terminate the moment it is
executed. Loop or switch ends abruptly
when the break is encountered.
A continue doesn't terminate the loop, it causes the loop to go to
the next iteration. All iterations of the loop are executed even
if continue is encountered. The continue statement is used to
skip statements in the loop that appear after the continue.
The break statement can be used in
both switch and loop statements.
The continue statement can appear only in loops. You will get an
error if this appears in a switch statement.
When a break statement is encountered, it
terminates the block and gets the control
out of the switch or loop.
When a continue statement is encountered, it gets the control to
the next iteration of the loop.
12. A break causes the innermost enclosing
loop or switch to be exited immediately.
A continue inside a loop nested within a switch causes the next
loop iteration.
Conditional Statements
If
Q. Describe the if statement with its syntax. Also, define why it is used.
Ans. The syntax of the if statement in C programming is:
if (test expression)
{
// statements to be executed if the test expression is true
}
Working of if statement:
• The if statement evaluates the test expression inside the parenthesis ().
• If the test expression is evaluated to true, the statements inside the body of if are executed.
• If the test expression is evaluated to false, the statements inside the body of if are not executed.
If-else
Q. Describe the if-else statement with its syntax. Also, define why it is used.
Ans. If-else statement works when there are true statements and false statements that have to be print on the
screen. If the condition is true the true statements print otherwise the false statements displays on the screen.
Syntax of the if-else statement:
If the condition returns true then the statements inside the body of “if” are executed and the statements inside
the body of “else” are skipped.
If the condition returns false then the statements inside the body of “if” are skipped and the statements in “else”
are executed.
if(condition) {
// Statements inside the body of if
}
else {
//Statements inside the body of else
}
The if/else statement executes a block of code if a specified condition is true. If the condition is false, another
block of code can be executed. The if/else statement is a part of JavaScript's "Conditional" Statements, which are
used to perform different actions based on different conditions.
13. Nested if-else
Q. Write a short note on Nested if statement.
Ans. When an if-else statement is present inside the body of another “if” or “else” then this is called nested if-else.
Syntax of Nested if else statement:
if(condition) {
//Nested if else inside the body of "if"
if(condition2) {
//Statements inside the body of nested "if"
}
else {
//Statements inside the body of nested "else"
}
}
else {
//Statements inside the body of "else"
}
Example of nested if. Else
#include <stdio.h>
int main()
{
int var1, var2;
printf("Input the value of var1:");
scanf("%d", &var1);
printf("Input the value of var2:");
scanf("%d”, &var2);
if (var1 != var2)
{
printf("var1 is not equal to var2n");
//Nested if else
14. if (var1 > var2)
{
printf("var1 is greater than var2n");
}
else
{
printf("var2 is greater than var1n");
}
}
else
{
printf("var1 is equal to var2n");
}
return 0;
}
Output:
Input the value of var1:12
Input the value of var2:21
var1 is not equal to var2
var2 is greater than var1
Logical operators
Q. Define Logical Operators.
Ans. An expression containing logical operator returns either 0 or 1 depending upon whether expression results
true or false. Logical operators are commonly used in decision making in C programming.
Operator Meaning Example
&&
Logical AND. True only if all operands are
true
If c = 5 and d = 2 then, expression ((c==5) && (d>5))
equals to 0.
||
Logical OR. True only if either one operand
is true
If c = 5 and d = 2 then, expression ((c==5) || (d>5))
equals to 1.
! Logical NOT. True only if the operand is 0 If c = 5 then, expression! (c==5) equals to 0.
Switch statement
Q. Write a short note on a Switch statement.
15. Ans. Switch case statements are a substitute for long if statements that compare a variable to several integral
values.
The switch statement is a multiway branch statement. It provides an easy way to dispatch execution to different
parts of code based on the value of the expression.
The switch is a control statement that allows a value to change control of execution.
Syntax:
switch (n)
{
case 1: // code to be executed if n = 1;
break;
case 2: // code to be executed if n = 2;
break;
default: // code to be executed if n doesn't match any cases
}
Important Points about Switch Case Statements:
The expression provided in the switch should result in a constant value otherwise it would not be valid.
Valid expressions for switch:
// Constant expressions allowed
switch(1+2+23)
switch(1*2+3%4)
// Variable expression are allowed provided
// they are assigned with fixed values
switch(a*b+c*d)
switch(a+b+c)
• Duplicate case values are not allowed.
• The default statement is optional. Even if the switch case statement does not have a default statement,
• it would run without any problem.
The break statement is used inside the switch to terminate a statement sequence. When a break statement is
reached, the switch terminates, and the flow of control jumps to the next line following the switch statement.
The break statement is optional. If omitted, execution will continue into the next case. The flow of control will fall
through to subsequent cases until a break is reached.
16. Nesting of switch statements is allowed, which means you can have switch statements inside another switch.
However nested switch statements should be avoided as it makes the program more complex and less readable.
Functions
Structure of function
Q. Explain Functions in C.
Ans. In c, we can divide a large program into the basic building blocks known as a function. The function contains
the set of programming statements enclosed by {}. A function can be called multiple times to provide reusability
and modularity to the C program. In other words, we can say that the collection of functions creates a program.
The function is also known as procedure or subroutine in other programming languages.
Advantage of functions in C
There are the following advantages of C functions.
• By using functions, we can avoid rewriting the same logic/code again and again in a program.
• We can call C functions any number of times in a program and from any place in a program.
• We can track a large C program easily when it is divided into multiple functions.
• Reusability is the main achievement of C functions.
• However, Function calling is always overhead in a C program.
Function Aspects
There are three aspects of a C function.
• Function declaration A function must be declared globally in a c program to tell the compiler about the function
name, function parameters, and return type.
• Function call Function can be called from anywhere in the program. The parameter list must not differ in function
calling and a function declaration. We must pass the same number of functions as it is declared in the function
declaration.
• Function definition It contains the actual statements which are to be executed. It is the most important aspect to
which the control comes when the function is called. Here, we must notice that only one value can be returned from
the function.
SN C function aspects Syntax
1 Function declaration return_type function_name (argument list);
2 Function call function_name (argument_list)
3 Function definition return_type function_name (argument list) {function body;}
The syntax of creating function in c language is given below:
return_type function_name(data_type parameter...) {
//code to be executed
}
Types of Functions
There are two types of functions in C programming:
17. • Library Functions: are the functions which are declared in the C header files such as scanf(), printf(), gets(), puts(),
ceil(), floor() etc.
• User-defined functions: are the functions which are created by the C programmer, so that he/she can use it many
times. It reduces the complexity of a big program and optimizes the code.
Sending and returning values from a function, return statement
Q. Why functions are used in C-language? Also, describe the importance of the return statement.
Ans. A function is a group of statements that together perform a specific task. Every C program has at least one
function, which is main().
The function is used to divide a large code into the module, due to this we can easily debug and maintain the code.
For example, if we write a calculator program at that time, we can write every logic in a separate function (For
addition sum(), for subtraction sub()). Any function can be called many times.
Advantage of Function
• Code Re-usability
• Develop an application in module format.
• Easily to debug the program.
• Code optimization: No need to write a lot of code.
After performing certain operations that function results in an output which we need to store in a database for
later analysis. In the case where we don’t use the return statement, function after printing out the result, control
comes out of the function and all the data stored in the stack will be erased resulting in data effective usage. but
we didn’t store the value in any permanent data format. To store the value in any file for statistics, we use return
statement where we return value to the main function, which collects the value and stores in a permanent file.
Passing variables and constants as arguments
Q. How data is passed to a function in C?
Ans. There are three ways of passing data in function:
Pass by Value
• Ordinary data types (ints, floats, doubles, chars, etc) are passed by value in C/C++, which means that only the
numerical value is passed to the function, and used to initialize the values of the function’s formal parameters.
• Under the pass-by-value mechanism, the parameter variables within a function receive a copy of the variables (data)
passed to them.
• Any changes made to the variables within a function are local to that function only and do not affect the variables in
main (or whatever other function called the current function.) This is true whether the variables have the same name
in both functions or whether the names are different.
Passing Arrays and/or Array Elements
• When one element of an array is passed to a function, it is passed in the same manner as the type of data contained
in the array. (I.e., pass-by-value for basic types.)
• However, when the entire array is passed, it is effectively passed by reference. (Actually, by pointer/address, to be
explained completely in the section on pointer variables.)
Pass by Pointer / Address
18. • Pass by pointer/address is another type of data passing that will be covered later under the section on pointer
variables.
• Pass by pointer/address requires the use of the address operator (&) and the pointer dereference operator (*), to
be covered later.
Array
Definition, initializing strings
Q. Explain Array.
Ans. Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type.
An array is used to store a collection of data, but it is often more useful to think of an array as a collection of
variables of the same type.
Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array
variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables.
A specific element in an array is accessed by an index.
All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the
highest address to the last element.
Declaring Arrays: To declare an array in C, a programmer specifies the type of the elements and the number of
elements required by an array as follows −
type arrayName [ arraySize];
This is called a single-dimensional array. The array size must be an integer constant greater than zero and type can
be any valid C data type. For example, to declare a 10-element array called the balance of type double, use this
statement −
double balance[10];
Here the balance is a variable array which is sufficient to hold up to 10 double numbers.
Initializing Arrays: You can initialize an array in C either one by one or using a single statement as follows −
double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};
The number of values between braces {} cannot be larger than the number of elements that we declare for the
array between square brackets [].
If you omit the size of the array, an array just big enough to hold the initialization is created. Therefore, if you write
double balance[] = {1000.0, 2.0, 3.4, 7.0, 50.0};
You will create the same array as you did in the previous example. Following is an example to assign a single
element of the array −
balance[4] = 50.0;
The above statement assigns the 5th element in the array with a value of 50.0. All arrays have 0 as the index of
their first element which is also called the base index and the last index of an array will be the total size of the
array minus 1.
19. Accessing Array Elements: An element is accessed by indexing the array name. This is done by placing the index of
the element within square brackets after the name of the array. For example −
double salary = balance[9];
The above statement will take the 10th element from the array and assign the value to the salary variable.
String
Definition, initializing strings
Q. Define Strings in C. also how a string is declared and initialized.
Ans. In C programming, a string is a sequence of characters terminated with a null character 0. For example:
char c[] = "c string";
When the compiler encounters a sequence of characters enclosed in the double quotation marks, it appends a
null character 0 at the end by default.
Declare strings
char s[5];
We have declared a string of 5 characters.
Initialize strings
You can initialize strings in a number of ways.
char c[] = "abcd";
char c[50] = "abcd";
char c[] = {'a', 'b', 'c', 'd', '0'};
char c[5] = {'a', 'b', 'c', 'd', '0'};
String functions
Q. Write few strings functions and their applications.
Ans. Few commonly used strings handling functions are discussed below:
Function Work of Function
strlen() computes string's length
strcpy() copies a string to another
strcat() concatenates(joins) two strings
strcmp() compares two strings
strlwr() converts string to lowercase
strupr() converts string to uppercase