logo

Technical Programming Answer 2022

Explain the differences between char, string, array and matrix? Why are these important? What is a structured program and how does it relate to this class? Explain when you would use a) “IF”, b) “IF…ELSE”, or c) SWITCH Give examples of each with code What are the critical rules for keywords? Explain increment and decrement operators and give examples in code Explain modulus and give an example how it would distinguish “even” numbers from “odd” numbers in a sort Write a program to print the last three letters of your name (first name or last name you choose which). Write a program that uses nested loops. You are to create a code that generates a unique shape of your personal design.

8 Pages1011 Words31 Views
   

Added on  2022-10-01

Technical Programming Answer 2022

Explain the differences between char, string, array and matrix? Why are these important? What is a structured program and how does it relate to this class? Explain when you would use a) “IF”, b) “IF…ELSE”, or c) SWITCH Give examples of each with code What are the critical rules for keywords? Explain increment and decrement operators and give examples in code Explain modulus and give an example how it would distinguish “even” numbers from “odd” numbers in a sort Write a program to print the last three letters of your name (first name or last name you choose which). Write a program that uses nested loops. You are to create a code that generates a unique shape of your personal design.

   Added on 2022-10-01

ShareRelated Documents
Running head: TECHNICAL PROGRAMMING
Technical Programming
Name of the Student
Name of the University
Author Note
Technical Programming Answer 2022_1
TECHNICAL PROGRAMMING1
Explain the differences between char, string, array and matrix. Why are these important?
Ans. Char- is a primitive data type in C that is pre-defined in the library function. It holds a
single character. It can be a letter, number, symbol or anything. For example, ‘A’, ‘8’ or ‘*’ are
treated as characters in C. To declare a character variable in C we have to write char ‘Z’ in single
codes.
String- In C language, string represents a combination of characters. it can hold multiple
characters at a time. It is declared within double codes, unlike char. For example, to declare a
string in C we have to write char *place = “Paris”.
Array- is a one dimensional data structure in C. It can store multiple values but of the same
data type. To declare an array in C we have to mention the type of data in the array, name the
array and finally write the storage capacity in closed brackets. For example, int arr[25]; where int
is the integer data type, arr is the name of the array and 25 is the memory allocation.
Matrix- Unlike array, matrices are two dimensional data structures comprising of rows and
columns. It can hold values in tabular form and can transform data. To declare matrices in C we
have to write the type of the values, the name of the array and the storage capacity of the rows
and columns. For example, int arr[5][10] is a two dimensional matrix.
What is a structured program and how does it relate to this class?
Ans. Structured programs are those that comprises of loops, sequences and decisions. Popularly
known as modular programming, it enables the user to understand and modify the program more
efficiently (Hsu and Hwang, 2017). A logical program structure is implemented through
Technical Programming Answer 2022_2
TECHNICAL PROGRAMMING2
structured programming. It is also considered as a subset of procedural programming. Different
modules are integrated together to form a structured program. Similarly, class is also a collection
of objects that are integrated together to perform a set of operations. Hence, the structured
programs gave birth to the concept of class in object oriented programming languages.
Explain when you would use a) “IF”, b) “IF...ELSE”, or c) SWITCH
Give examples of each with code
Ans. We can use the ‘If’ statement in C when there is a condition of either true or false. When
it’s a decision making situation, we use the if-else block. One of the conditions are written in the
if block while the other condition is written in the else block. For example,
If(a>b)
{
Max=a;
}
Else
{
Max=b;
}
We use the if-else-if statement when there are more than two conditions.
Technical Programming Answer 2022_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Questions on Stack Program
|11
|1305
|31

C PROGRAMMING Assignment 2022
|7
|922
|16