C program
- What is wrong in this statement? scanf(“%d”,whatnumber); An ampersand & symbol must be placed before the variable name whatnumber. Placing & means whatever integer value is entered by the user is s... 1
- Write a loop statement that will show the following output: 1 12 123 1234 12345 Use two nested for loops: the outer loop picks the row number, and the inner loop prints 1 up to that row number, followed by a new line. #i... 1
- What is the advantage of an array over individual variables? When storing multiple related data, it is a good idea to use arrays. This is because arrays are named using only 1 word followed by an eleme... 1
- What is the significance of an algorithm to C programming? Before a program can be written, an algorithm has to be created first. An algorithm provides a step by step procedure on how a solution can... 1
- What are compound statements? Compound statements are made up of two or more program statements that are executed together. This usually occurs while handling conditions... 1
- when is the “void” keyword used in a function? When declaring functions, you will decide whether that function would be returning a value or not. If that function will not return a value,... 1
- Why is it that not all header files are declared in every C program? The choice of declaring a header file at the top of each C program would depend on what commands/functions you will be using in that program... 1
- Can two or more operators such as \n and \t be combined in a single line of program code? Yes, it’s perfectly valid to combine operators, especially if the need arises. For example: you can have a code like ” printf (“Hellonn\’Wor... 1
- Can I use “int” data type to store the value 32768? Why? No. “int” data type is capable of storing values from -32768 to 32767. To store 32768, you can use “long int” instead. You can also use “uns... 2
- How do you access the values within an array? Arrays contain a number of elements, depending on the size you gave it during variable declaration. Each element is assigned a number from 0... 1
- What are variables and it what way is it different from constants? Variables and constants may at first look similar in a sense that both are identifiers made up of one character or more characters (letters,... 1
- What is syntax error? Syntax errors are associated with mistakes in the use of a programming language. It maybe a command that was misspelled or a command that mu... 1
- What are header files and what are its uses in C programming? Header files are also known as library files. They contain two essential things: the definitions and prototypes of functions being used in a... 1
- Can the curly brackets { } be used to enclose a single line of code? While curly brackets are mainly used to group several lines of codes, it will still work without error if you used it for a single line. Som... 1
- How do you declare a variable that will hold string values? The char keyword can only hold 1 character value at a time. By creating an array of characters, you can store string values in it. Example:... 1
- Compare and contrast compilers from interpreters. Compilers and interpreters often deal with how program codes are executed. Interpreters execute program codes one line at a time, while comp... 1
- Which of the following operators is incorrect and why? ( >=, <=, <>, ==) <> is incorrect. While this operator is correctly interpreted as “not equal to” in writing conditional statements, it is not the proper oper... 1
- What is a nested loop? A nested loop is a loop that runs within another loop. Put it in another sense, you have an inner loop that is inside an outer loop. In this... 1
- What is the modulus operator? The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol. For example: 10 % 3 = 1, meaning when y... 1
- What is the difference between the = symbol and == symbol? The = symbol is often used in mathematical operations. It is used to assign a value to a given variable. On the other hand, the == symbol, a... 1
- What is the use of a ‘\0’ character? It is referred to as a terminating null character, and is used primarily to show the end of a string value. 1
- In C programming, how do you insert quote characters (‘ and “) into the output screen? This is a common problem for beginners because quotes are normally part of a printf statement. To insert the quote character as part of the... 1
- Differentiate Source Codes from Object Codes Source codes are codes that were written by the programmer. It is made up of the commands and other English-like keywords that are supposed... 1
- What is spaghetti programming? Spaghetti programming refers to codes that tend to get tangled and overlapped throughout the program. This unstructured approach to coding i... 1