1.
What is the proper syntax for do-while?
Correct Answer
D. Do { statement} while (condition) {statement};
Explanation
The correct answer is "do { statement} while (condition) {statement};" because it follows the proper syntax for a do-while loop. In a do-while loop, the statements inside the curly braces are executed at least once, and then the condition inside the parentheses is checked. If the condition is true, the statements are executed again, and this process continues until the condition becomes false. The semicolon at the end of the loop is also necessary to indicate the end of the loop statement.
2.
Which of these comes on secondary constants.
Correct Answer
B. Pointer
Explanation
Secondary constants refer to constants that are derived from primary constants. In this case, a pointer is considered a secondary constant because it is derived from a primary constant, which is the address of a variable. Pointers are used to store memory addresses, allowing for indirect access to data. Therefore, a pointer is the correct answer as it falls under the category of secondary constants.
3.
When you declare a variable of char type what's its range?
example:
char i = 'a'
Correct Answer
B. -128 to 127
Explanation
When you declare a variable of char type, its range is from -128 to 127. This is because char is a signed data type in C++, which means it can hold both positive and negative values. The range of -128 to 127 allows char to represent a total of 256 different values, including both positive and negative numbers.
4.
C is a _________ sensitive.
Correct Answer
case
Explanation
The word "sensitive" is used to describe the type of sensitivity that C possesses. The word "case" is used to complete the sentence and indicate that C is case-sensitive. This means that C distinguishes between uppercase and lowercase letters and treats them as different characters.
5.
Is c a middle-level language?
Correct Answer
A. True
Explanation
Yes, "c" is considered a middle-level language. Middle-level languages, like C, have features from both low-level languages (such as assembly language) and high-level languages (such as Python or Java). C provides low-level access to memory and hardware, allowing for efficient programming, while also offering higher-level features like functions and data structures. This makes C a versatile language that can be used for system-level programming, as well as application development.
6.
What do we call *?
Correct Answer
B. Value at
Explanation
The given answer "value at" refers to the term used to describe the content or data stored at a specific memory location or address. It is commonly used in programming to access and manipulate the value stored in a particular memory address.
7.
Why programmers find goto keyword seductive?
Correct Answer
D. All of those
Explanation
Programmers find the goto keyword seductive because it allows them to have more control over the flow of their code. However, it is considered unreliable because it can lead to spaghetti code and make the program difficult to read and understand. Additionally, using goto can make debugging more challenging as it can create unexpected jumps in the code execution. Therefore, all of these reasons contribute to why programmers find the goto keyword seductive.
8.
Which thing do we write under two brace () in case-control structure?
Correct Answer
B. Expression
Explanation
In a case-control structure, we write an expression within the two braces (). An expression is a combination of variables, constants, and operators that produces a value. It can be a mathematical calculation, a comparison, or any other operation that evaluates to a value. Within the case-control structure, the expression is used to determine which block of code should be executed based on the condition specified.
9.
One function which is __________ important to declare in C programming.?
Correct Answer
main
Explanation
The "main" function is the most important function to declare in C programming because it is the entry point of a C program. It is the starting point of execution and contains the code that will be executed when the program is run. Without the "main" function, the program will not be able to run and produce any output.
10.
Int a = 1;
printf ("%d%d",a,++a,a++);
What is the output of the following program?
Correct Answer
C. 331
Explanation
The output of the program is 331. In the printf statement, the first occurrence of %d prints the value of a, which is 1. The second occurrence of %d is evaluated as ++a, which increments the value of a to 2 and returns the incremented value. So, the second occurrence of %d also prints 2. Finally, the third occurrence of %d is evaluated as a++, which returns the current value of a (2) and then increments it to 3. Therefore, the third occurrence of %d prints 3. Hence, the output is 331.
11.
A break is usually associated with an __________?
Correct Answer
if
Explanation
A break is usually associated with an "if" statement in programming. The "if" statement is used to conditionally execute a block of code based on a certain condition. When the condition specified in the "if" statement is true, the code inside the block is executed, otherwise, it is skipped. Therefore, a break statement is commonly used within an "if" statement to terminate the execution of the block of code and exit the loop or switch statement that contains it.
12.
Break keyword _________out of a loop instantly?
Correct Answer
jump
Explanation
The "jump" keyword is used to break out of a loop instantly. It allows the program to skip the remaining iterations of the loop and continue executing the code after the loop. This is useful when a specific condition is met and the program needs to exit the loop immediately.
13.
When continue is encountered inside any loop, control automatically passes to the __________of the loop?
Correct Answer
beginning
Explanation
When continue is encountered inside any loop, control automatically passes to the beginning of the loop. This means that the remaining statements within the loop are skipped and the loop starts again from the beginning, evaluating the loop condition and executing the loop body again if the condition is true. This allows the loop to continue iterating without executing the remaining statements in the current iteration.
14.
What is the default or initial value of the static storage class?
Correct Answer
B. Zero
Explanation
The default or initial value of the static storage class is zero.
15.
How many types of storage classes in C are_______?
Correct Answer
four
4
Explanation
There are four types of storage classes in C: auto, register, static, and extern. These storage classes determine the scope, lifetime, and visibility of variables in a C program. The options "four" and "4" both represent the correct answer.
16.
How many bytes long double store in memory?
Correct Answer
C. 10
17.
Which one of the format modifier for unsigned int?
Correct Answer
B. %u
Explanation
The correct format modifier for an unsigned int is %u. This format specifier is used to print unsigned integer values. It is important to use the correct format modifier to ensure that the value is displayed correctly and to avoid any potential errors or unexpected behavior in the program.
18.
Both the inverted comma's should point to the left
eg: 'b' is a true statement.
Correct Answer
A. True
Explanation
The given answer is true because the statement states that both the inverted commas should point to the left. Since the inverted commas in the example are indeed pointing to the left, the answer is true.
19.
There are __________ keywords in c language?
Correct Answer
32
thirty two
Explanation
The correct answer is 32. In the C language, there are 32 keywords. These keywords are reserved and have specific meanings in the language. They cannot be used as variable names or identifiers in the program. Some examples of C keywords include "if," "for," "while," and "int."
20.
How many types of comments in C language ________ ?
Correct Answer
2
two
Explanation
There are two types of comments in the C language: single-line comments and multi-line comments. Single-line comments are denoted by // and can be used to comment out a single line of code. Multi-line comments are denoted by /* and */ and can be used to comment out multiple lines of code.