Posts

Showing posts with the label Programming In C

Programming in C, IDE, main() function, global and local variables.

Topic: Programming in C Question 1: Describe the programming environment. Answer: Programming environment is the set of processes and programming tools used to develop computer programs. In the past programmers used various standalone programming tools for developing computer programs. These includes editor, compiler, linker, debugger, etc. Using separate programs provided a difficult and time consuming environment for creating a computer programs. Today programmers use IDE.   Question 2: What is integrated development environment? Answer: Most of the new programming languages use integrated development environment (IDE) to create, compile and run programs. IDE is computer software that brings all the processes and tools required for program development into one place. Today’s modern IDEs have user friendly graphical user interface(GUI).   Question 3: Describe the purpose of the main() function and the   body of main() function. Ans : Every C program must ...

Programming In C, Type casting in C language

Image
Question 1: What is  the use of type casting in C language? Ans:  Typecasting is a method to convert a variable from one data type to another data type during program execution. It makes a variable of one type to act line another type. For example, a variable of type int can act as a variable of type char using typecasting. Typecasting in c program For example, one  use for typecasting  is when there is need to produce  ASCII characters  for decimal codes (0 127). To do this,  the programmer  will need to use to typecast to print out the integer  variable as its character equivalent using for  specifier %c.

Programming in C, Variables, Numeric Variable, Character Variable.

Image
Question 1: Describe the purpose of variables. Ans:   A variable is a symbolic name that represents a value  that can change during execution of a program. A variable  has a name, known as variable name and it hold data of  other types. These are called memory  locations. Variables are of two types. 1.  Numeric Variable 2.  Character Variable Variables Question 2: What is the difference between  numeric and character  variable? Ans:   Numeric variables  are used to represent numeric values in computer programs. e.g: sum, avg, marks, etc Character variables  represent character values in computer program. It can represent a single character or a string of characters. e.g: city, gender etc.

Programming in C, Constant, Numeric, Character, String.

Image
Question 1: Explain what are constant?  Ans: Constant are quantities whose values do not change during program execution. They may be.. 1. Numeric. 2. Character. 3. String. Constant in C Language Numeric constant s  are of two types, integer and floating point numbers. Integer constant represent values that are counted, like the number of students in a class. e.g: 7145, 234 etc. Floating point constants are used to represent values that are measured, like the height of a person which might have a value of 166.75cm etc Character constant  is one of the symbols on c character set . It includes digits 0 to 9, upper cases A to Z and lower cases a to z. etc. String constant contains a string of characters within double quotes such as “Hello Ahmed” etc.

Programming In C, main() function, global and local variables, Comments in C Language

Image
Question 1.  Describe the purpose of the  main () function and the body  of  main() function Ans:   Every C program must  have the function main() which  is the first section to be executed  when the program runs. The word void before the  function main() means that this function does not return a  value and the second void inside the brackets means it  does not have any argument. When we run a program  the main() function is always executed first no matter  where it appears in the program. The body of main() Function . The body of the function main() is surrounded by braces {}. The left brace indicates the start of the body of the function and the right brace indicates the end of the body of the  function. Question 2: Define global and local variables. Ans : Variables are used in C program to store values. Global Variables:   Global variables are declared before the main() function.  These variables are use...

Programming In C, Structure of C, Preprocessor Directives

Image
Question:  Write the structure of C. Ans : T he format according to which a program is written is called the  structure of program. The following is the structure of a C program. Structure of C Language Structure of C Language Question: What are preprocessor directives? Describe its main types. Ans:   Preprocessor directives are instructions for the c compiler. Every C language program contains preprocessor directives at the beginning of the program. These directives start with number sign(#). The most commonly used preprocessor directives are include and define. ** The include Preprocessor Directives When this preprocessor is carried out by the c compiler, it will search for the header file that is written within the less than(<) and greater (>) symbols and copy it into the source file. In the above program the header file stdio.h is used. The Define Preprocessor Directives The define preprocessor is used for defining constants in c programs. It directs the compile...

Programming in C, Reserved Words, Header File in C++

Image
 Question 1: What are reserved words? Why they should not be used as variable names ? Answer: The words that are part of programming language and have special purposes in computer programs are reserved words or keywords. They have predefined use and cannot be used for any other purpose. Reserved words are always written in lower case. There are 32 words defined as reserved words in C. Reserved Words Question 2. Describe the purpose of header files. Answer: C language contains a number of standard functions in library file that perform various tasks in c programs. These tasks include all the input/output operations and all the math operations. Library file contains header files and each header file contains a set of functions. Some commonly used header files are stdio.h, conio.h and math.h. Some commonly use functions that are included in stdio.h file are prinf(), scanf(), etc Header File

Programming In C, C language character set

Question: Describe the purpose of  C language character Set. Answer: C language character set includes: Letters:  C language comprises the following set of letters to  form a standard program. They are: A to Z in capital letters. A to z in small letters. In C programming, small letter and caps letter are distinct. Digits:  C language comprises of the following sequences of numbers  to associate the letters 0 t o 9 digits. Special Characters:   C Language contains the following special characters in association  with the letters and digits.

Programming In C, Linker, Loader and Debugger

Image
 Topic:  Programming In C Question: Describe the purpose of Linker, Loader and Debugger. Linker:  a linker is a computer program that takes one  or more object files generated by a compiler and  combines them into one or more executable programs. Object Code Loader:   A loader is the part of an operating system  that is responsible for loading programs and libraries.  It is one of the essential stages in the process of  starting a program Debugger:   It is a software that executes a program line by  line, examines the values stored in variables and helps in  finding and removing errors in programs.  Programming Basics. C is a popular and widely  used programming language for creating computer  programs. A large variety of application programs and  many operating system are written in C. The C language character set includes Letters:  C language comprises the following set of letters to form a standard p...