XII-computer notes Chapter 3
XII-computer notes Chapter 3
Q2. What is IDE? Write few shortcut keys and their function in IDE.
Ans. IDE (Integrated Development Environment):-An integrated development environment
(IDE) is software for building applications or programs that combines common developer tools
into a single graphical user interface (GUI). IDE serves as a single environment for most of a
Programmers don't need to switch between different tools to design a layout, write the code,
compilation, linking, build, loading, and debugging tools. IDE combines all tools that need for
development. Code completion capabilities improve programming workflow. Many IDEs
incorporate basic spelling checkers, so automatically check for errors to improve code.
The following are some programming languages use IDE such as Eclipse ( C, C++, Python,
Perl, PHP, Java, Ruby etc).
IDE shortcut keys:-
1. New (Ctrl+N) new opens a new Edit window with the default name NONAME.CPP
2. Open (F3) open and load an existing file into an edit window.
3. Save (F2) the save command saves the file that is in the active edit window to disk.
4. Undo (Alt+Bksp) the undo command takes back the last editing command we performed
on a line.
5. Redo (shift+Alt+BkSP) the redo command reverses the effect of the most recent undo
command.
6. Cut (shift+Del) the cut command removes the selected text block from our document and
places it on the clipboard.
7. Copy (Ctrl+ins) The copy command copies a selected text block and puts a copy on the
clipboard.
8. Paste (shift+ins) the paste command puts text from the clipboard into the current window.
Function Of IDE:-
1. Serves as a single environment for most of a developer’s need such as compilation,
linking, loading, and debugging tools.
2. Programmers don't need to switch between different tools to design a layout, write the
code, debug, build, etc
3. IDE combines all tools that need for development.
4. Automatically checks for errors to ensure top quality code.
5. Code completion capabilities improve programming workflow.
6. Refactoring capabilities allow developers to make comprehensive and mistake free
renaming changes.
7. Many IDEs incorporate basic spelling checkers, so automatically check for errors to
improve code.
Pass by Value:-Pass by value is a method in which a copy of the value of the variables is passed
to the function for the specific operation.
In this method, the arguments in the function call are not modified by the change in parameters
of the called function. So the original variables remain unchanged.
Example of passing arguments by value to function in C
// arguments pass by value
# include <stdio.h>
int add (int a, int b)
{
return( a + b );
}
int main()
{
int x, y, z;
x = 5;
y = 5;
z = add(x,y); // call by value
return 0;
}
//end of program
In this program, function add() is called by passing the arguments x and y.
The copy of the values of x and y are passed to a and b respectively and then are used in the
function.
So by changing the values of a and b, there will be no change in the actual arguments x and y in
the function call.
Pass by reference:-Pass by reference is a method in which rather than passing direct value the
address of the variable is passed as an argument to the called function.
When we pass arguments by reference, the formal arguments in the called function becomes the
assumed name or aliases of the actual arguments in the calling function. So the function works
on the actual data.
Example of passing arguments by reference to function in C
// arguments pass by reference
#include <stdio.h>
void swap (int *a, int *b) // a and b are reference variables
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int main()
{
int x = 2, y = 4;
printf("before swapping x = %d and y = %d\n", x, y);
swap(&x, &y); // call by reference
return 0;
} //end of program
In the above program, the formal arguments a and b becomes the alias of actual
arguments x and y when the function was called.
So when the variables a and b are interchanged x and y are also interchanged. So the output
becomes like this.
Output
before swapping x = 2 and y = 4
after swapping x = 4 and y = 2
Now, if the function was defined as:
void swap(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
This is the pass by value method so here even if the values are swapped in the function the actual
value won’t interchange and output would become like this:
before swapping x = 2 and y = 4
after swapping x = 4 and y = 2
Q6. Define difference b/w argument and parameter?
Difference between Argument and Parameter
Argument Parameter
When a function is called, the values The values which are defined at the time of the
that are passed during the call are function prototype or definition of the function are
called as arguments. called as parameters.
Example:
Example:
intCall(intrnum)
intnum = 20; {
Call(num) printf("the num is %d", rnum);
}
// num is argument
// rnum is parameter
\a Alarm or Beep
\b Backspace
\f Form Feed
\n New Line
\r Carriage Return
\t Tab (Horizontal)
\v Vertical Tab
\\ Backslash
\0 Null
int main() {
printf("Hello\vWorld!");
return 0;
}
Backslash (\):
A backslash character is inserted using the backslash escape sequence (\).
#include <stdio.h>
int main() {
printf("This is a backslash: \\Hello");
return 0;
}
Single Quote ('):
The single quote escape sequence (') is used to insert a single quote character.
#include <stdio.h>
int main() {
printf("This is a single quote: \'Hello\'");
return 0;
}
Double Quote ("):
A double quotation character is inserted using the double quote escape sequence (").
#include <stdio.h>
int main() {
printf("This is a double quote: \"Hello\"");
return 0;
}
Question Mark (?):
The question mark escape sequence (?) is used to insert a question mark character.
#include <stdio.h>
int main() {
printf("This is a question mark: \?");
return 0;
}
Octal Number (\nnn):
The character's octal value can be inserted using the octal number escape sequence (nnn).
#include <stdio.h>
int main() {
printf("This is an octal value: \101");
return 0;
}
Hexadecimal Number (\xhh):
A character's hexadecimal value can be inserted using the hexadecimal number escape
sequence (xhh).
#include <stdio.h>
int main() {
printf("This is a hexadecimal value: \x41");
return 0;
}
Null (\0):
The null character, denoted by "0", is inserted using the null escape sequence (0).
#include <stdio.h>
int main() {
char myString[] = "Hello\0World!";
printf("String: %s", myString);
return 0;
}
Q8. What is main difference between source code and object code?
S.NO. SOURCE PROGRAM OBJECT PROGRAM
A collection of computer instructions written A sequence of statements in binary digits that is
1.
using a human readable programming language. generated after compiling the object program.
Contains English words according to syntax of
2. Contains binaries.
programming language.
3. Source code is another name for source program. Object code is another name for object program.
4. Programmers create the source program. Compilers create the object program.
5. It is the input to the computer. It is the output to the computer.
6. Programmers can read the source program Machines can read the object program.