Ip Unit 1 Short
Ip Unit 1 Short
Output:
Hello, World!
2. What is a compiler?
A compiler is a software that translates code written in a high-level programming language into machine language
(binary code) that a computer's processor can understand and execute.
A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a
diagrammatic representation of an algorithm, a step-by-step approach to solving a task.
4. What are the different rules to create a variable?
Example:-
#include<stdio.h>
void main(){
int number;
scanf(“%d”,&number);
printf(“%d”,number);
} // number is variable.
1.Low-level programming languages: Here, communication with system is in binary format , i.e, in , 0's and 1's,
which can be directly executed. This means that these languages provide instructions which can be used to
perform low-level operations like memory management etc. For example: Assembly Languages.
2.High-level programming languages: Here,communication with system is in the form of text (usually in English)
which can easily be read/understood by humans. For example: Ada, JavaScript, Python, Ruby etc.
3.Middle-level programming languages: These are languages that support both the features of low-level and
high-level programming languages . These are also written in text which can easily be read by humans . They
typically use tools like compilers to convert the instructions that are readable by humans (high-level language
constructs) into low-level executable code (usually in binary format). Eg: C, C++, Java, etc,.
Time complexity refers to the amount of time an algorithm takes to run as a function of the size of the input data.
Performance:
Best Case: The scenario where the algorithm performs the fastest.
Worst Case: The scenario where the algorithm takes the longest to complete.
Space complexity refers to the amount of memory an algorithm uses as a function of the size of the input. It
measures the total space required by the algorithm, including both the space for input data and any auxiliary
space needed during the algorithm's execution.
Key Points:
Input Space: The space required to store the input data. This is typically proportional to the size of the input
(n).
Auxiliary Space: The extra space or temporary storage used by the algorithm apart from the input data, such
as variables, arrays, stacks, or recursion stacks
Total Space Complexity = Input Space + Auxiliary Space
9. List the data types and their sizes of C language.
#include <stdio.h>
int main() {
printf("Size of char: %lu byte\n", sizeof(char));
printf("Size of int: %lu bytes\n", sizeof(int));
printf("Size of short: %lu bytes\n", sizeof(short));
printf("Size of long: %lu bytes\n", sizeof(long));
printf("Size of long long: %lu bytes\n", sizeof(long long));
printf("Size of float: %lu bytes\n", sizeof(float));
printf("Size of double: %lu bytes\n", sizeof(double));
return 0;
}
OUTPUT:
Size of char: 1 byte
Size of int: 4 bytes
Size of short: 2 bytes
Size of long: 8 bytes
Size of long long: 8 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Precedence refers to the priority of operators in expressions. Order of evaluation is the sequence in which the
operations are performed in an expression according to operator precedence.