Fundamental C Test1

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sudha_test
S
Sudha_test
Community Contributor
Quizzes Created: 12 | Total Attempts: 38,127
| Attempts: 1,697 | Questions: 40
Please wait...
Question 1 / 40
0 %
0/100
Score 0/100
1. Representing various steps in a flow diagram is called as

Explanation

The correct answer is flow chart. A flow chart is a visual representation of a process or system, where each step is represented by a symbol or shape and connected by arrows to show the flow and sequence of the steps. It is commonly used to illustrate complex processes, algorithms, or decision-making processes in a clear and organized manner.

Submit
Please wait...
About This Quiz
Fundamental C Test1 - Quiz

The 'Fundamental C Test1' assesses foundational knowledge in C programming. It covers syntax errors, function purposes, identifiers, data ranges, and logic in C programs, essential for beginners to understand and apply basic C programming concepts effectively.

Personalize your quiz and earn a certificate with your name on it!
2. Which of the following is an empty data type.

Explanation

The correct answer is void. Void is a data type in programming that represents the absence of a value. It is often used as a return type for functions that do not return a value. Unlike other data types like integer, float, and character, void does not hold any data or have any memory allocation. It is essentially an empty data type.

Submit
3. The operator ++ is called as operator

Explanation

The operator ++ is referred to as the increment operator. This operator is used to increase the value of a variable by 1. It is commonly used in loops and other programming constructs where the value of a variable needs to be incremented. Therefore, the correct answer is "increment".

Submit
4. When && operator is used with two conditions, conditions need to be satisfied for the expression to be true.

Explanation

The correct answer is "both" because when the && operator is used with two conditions, both conditions need to be satisfied for the expression to be true.

Submit
5. Variables are initialized in C, using

Explanation

In C, variables are initialized using the = operator. The = operator is used for assignment, where the value on the right side of the operator is assigned to the variable on the left side. This allows the variable to hold a specific value that can be used later in the program.

Submit
6. The purpose of main function is

Explanation

The main function in a program is the entry point where the program execution begins. It is the first function that is called when the program starts running. Therefore, the purpose of the main function is to start the execution of the program.

Submit
7. A block is enclosed with pair of

Explanation

The correct answer is "{ }" because the given options represent different types of brackets used in programming languages. The curly brackets "{ }" are commonly used to enclose a block of code or to define a set or dictionary in programming. The other options, parentheses "( )", and square brackets "[ ]", have different uses in programming, such as for function calls or indexing arrays.

Submit
8. The process of repeating a group of statements in an algorithm is known as

Explanation

The process of repeating a group of statements in an algorithm is known as iteration. This involves executing a set of instructions multiple times until a certain condition is met. It allows for the efficient execution of repetitive tasks and helps in achieving desired outcomes.

Submit
9. In the following, which is bitwise operator?

Explanation

The correct answer is |. The vertical bar symbol (|) is the bitwise OR operator in programming. It performs a bitwise OR operation on each corresponding bit of two operands, resulting in a new value where each bit is set if either of the corresponding bits in the original operands is set.

Submit
10. What is output of the following program?
main() {int a; float b; a=1/2; b=1.0/2.0; printf(“ a=%d b=%f”,a,b); }

Explanation

The program first assigns the value of 1/2 to the integer variable 'a', which results in integer division and truncates the decimal part, so 'a' becomes 0. Then, it assigns the value of 1.0/2.0 to the float variable 'b', which performs floating-point division and gives the correct decimal value of 0.5. Finally, the program prints the values of 'a' and 'b' using the printf function. Therefore, the output of the program is "a=0 b=0.5".

Submit
11. Every executable C program must contain a

Explanation

Every executable C program must contain a main function. The main function is the entry point of the program, where the program starts its execution. It is mandatory for a C program to have a main function, as it is responsible for executing the statements and functions defined in the program. Without a main function, the program will not be able to run or execute any code.

Submit
12. What is output of the following program? main( ) {int x=15,y; y=(x >5)? 3 : 4; printf(“%d”,y); }

Explanation

The program initializes the variable x with a value of 15. It then assigns the value of 3 to the variable y based on the condition (x > 5). Since 15 is indeed greater than 5, the condition evaluates to true and y is assigned the value of 3. Therefore, the output of the program is 3.

Submit
13. Int C; C=25/2; What is the value of C

Explanation

The value of C is 12 because when dividing an integer by another integer in programming, the result is also an integer. In this case, 25 divided by 2 equals 12 with a remainder of 1. Since the result is an integer, the remainder is ignored and the value of C is 12.

Submit
14. Size of (double) returns

Explanation

The size of (double) returns 8. In most programming languages, the double data type is used to represent floating-point numbers with double precision. This means that it can store values with a larger range and more decimal places compared to the float data type. The size of a double is typically 8 bytes, which allows it to store 64 bits of information. Therefore, the correct answer is 8.

Submit
15. How many variables of the same type can be initialized at a time with the same value

Explanation

There is no limit to the number of variables of the same type that can be initialized at a time with the same value. In programming, you can assign a value to as many variables as you need, regardless of the type, as long as they are compatible with the value being assigned. Therefore, any number of variables can be initialized at a time with the same value.

Submit
16. What type of errors are checked during compilation

Explanation

During compilation, the compiler checks for syntax errors in the code. Syntax errors refer to mistakes in the code's structure or grammar, such as missing semicolons, incorrect variable declarations, or using incorrect syntax for loops or conditionals. These errors prevent the code from being compiled and executed successfully. Therefore, syntax errors are checked and identified during the compilation process.

Submit
17. What is the valid identifier in the following

Explanation

The valid identifier in the given options is "q1234". This is because a valid identifier in programming should start with a letter or an underscore, and can be followed by any combination of letters, digits, or underscores. "q1234" follows this rule as it starts with a letter and is followed by a combination of letters and digits. The other options "1fdasgf", "@hgd12", and "fahs%*" do not follow the rule for valid identifiers as they either start with a digit, contain special characters, or have invalid characters.

Submit
18. What are the smallest individual units in a program

Explanation

Tokens are the smallest individual units in a program. They are the building blocks of a program and represent the smallest meaningful units of code. Tokens can include keywords, identifiers, operators, constants, and symbols. Each token serves a specific purpose in the program and contributes to its overall functionality. By breaking down the program into tokens, it becomes easier for the compiler or interpreter to understand and execute the code.

Submit
19. Which of the following is not a relational operator

Explanation

The given answer, "&&", is not a relational operator. Relational operators are used to compare two values and return a boolean result. The operator "&&" is actually a logical operator, specifically the logical AND operator, which is used to combine two boolean expressions and return true only if both expressions are true. Relational operators include "!=" (not equal to) and ">" (greater than), which compare the values of two operands and return a boolean result based on the comparison.

Submit
20. Which of the following is an incorrect variable name.

Explanation

The variable name "else" is incorrect because it is a reserved keyword in many programming languages, including Python. Reserved keywords have predefined meanings and cannot be used as variable names.

Submit
21. What symbol is used to represent the connector

Explanation

The symbol used to represent the connector is a circle. This symbol is commonly used in flowcharts and diagrams to indicate a connection or relationship between different elements or processes. The circle represents a point of interaction or communication between components, and it is often used to illustrate the flow of information or the transfer of data.

Submit
22. Pseudo code is

Explanation

Pseudo code is a language independent code that is used to represent algorithms in a simplified manner. It is not tied to any specific programming language and is used to outline the logic of a program without getting into the details of syntax and implementation. Pseudo code helps in understanding and communicating the algorithmic steps of a program, making it easier to translate into any programming language. Therefore, the correct answer is "language independent code".

Submit
23.  Which of the following cannot be used as an identifier.

Explanation

Keywords cannot be used as identifiers because they are reserved words in a programming language that have a specific meaning and functionality. They are used to define the syntax and structure of the language, and therefore cannot be used as variable names or identifiers in a program.

Submit
24. The ANSI C standard recognizes maximum length of a variable up to

Explanation

The ANSI C standard recognizes a maximum length of a variable up to 31 characters. This means that the name of a variable in C can be up to 31 characters long. This limit is set by the standard to ensure compatibility and consistency across different C compilers and platforms. It is important to adhere to this limit when naming variables in C programs to avoid any potential issues or errors.

Submit
25. Consider scanf(“%2d”, &n); and the input data is 3142 then n will be assigned

Explanation

The correct answer is 31 because the format specifier "%2d" in scanf will only read the first two digits from the input data. In this case, the first two digits are 31, so n will be assigned the value 31.

Submit
26. Int a=13,b=7,c; c=a&b what is the value of c

Explanation

The value of c is 0000 0000 0000 0101. This is because the bitwise AND operation (&) is being performed between the binary representations of a and b. In this case, a is 0000 0000 0000 1101 and b is 0000 0000 0000 0111. When the bitwise AND operation is performed, each corresponding bit is compared. If both bits are 1, the result is 1. Otherwise, the result is 0. In this case, the result is 0000 0000 0000 0101, as only the third and first bits are 1 in both numbers.

Submit
27. What is output of following program ? main( ) {int x; x= 4 + 2 % 8; printf(“%d”,x); }

Explanation

The program calculates the value of x using the expression 4 + 2 % 8. The % operator is the modulus operator, which returns the remainder of a division operation. In this case, 2 divided by 8 has a remainder of 2. So, the expression becomes 4 + 2, which equals 6. The program then prints the value of x, which is 6.

Submit
28. What is range of char data value?

Explanation

The range of char data value is -128 to 127. This is because char is a 8-bit data type in Java, which means it can store values ranging from -128 to 127.

Submit
29. Which of the following statements is wrong

Explanation

The statement "3+a=b;" is wrong because in programming, the equal sign (=) is used for assignment, not for comparison. Therefore, the correct syntax should be "b = 3 + a;".

Submit
30. If y is of integer type variable then the two expressions. 3*(y-8)/9 and (y-8)/9*3 yield the same value if

Explanation

If y is an integer multiple of 9, then (y-8) will also be an integer multiple of 9. Therefore, both expressions 3*(y-8)/9 and (y-8)/9*3 will yield the same value.

Submit
31. C is a

Explanation

The correct answer is "High level language with some low level features." This means that language C is primarily a high-level language, which allows for abstraction and easier programming, but it also includes some low-level features that allow for direct manipulation of hardware and memory. This combination of high-level and low-level features makes C a versatile language that can be used for a wide range of applications, from system programming to application development.

Submit
32.  main ( ) { int m,y; m = 5; y = ++m; printf(”%d %d”,m,y); } consider the above code and find the output

Explanation

The code starts by initializing the variable m to 5. Then, the variable y is assigned the value of m after it is incremented by 1 using the pre-increment operator (++m). Finally, the values of m and y are printed using the printf function. Since m is incremented before it is assigned to y, both m and y will have the value of 6. Therefore, the output will be 6,6.

Submit
33. Bitwise operators cannot be performed on

Explanation

Bitwise operators are used to perform operations on individual bits of a binary representation of a number. However, float data type is a floating-point number which uses a different representation (IEEE 754 standard) and does not have a binary representation that can be manipulated using bitwise operators. Therefore, bitwise operators cannot be performed on float data type.

Submit
34. The minimum number of temporary variable needed to swap the contents of two variable is

Explanation

To swap the contents of two variables, no temporary variable is needed. This can be achieved by using the XOR operation. By XORing the two variables, their values will be swapped without the need for any additional temporary variable. Therefore, the correct answer is 0.

Submit
35. What is the output of printf(“%d”,printf(“tim”));

Explanation

The output of the inner printf statement "tim" is 3 because it consists of three characters. This value is then passed as an argument to the outer printf statement, which uses the "%d" format specifier to print the value as an integer. Therefore, the output of the entire statement is "tim3".

Submit
36. What is the size of long double variable

Explanation

The size of a long double variable is 10 bytes.

Submit
37. Int x=1,y=5; x=++x + –y; what is the value of x                          

Explanation

The expression "++x" increments the value of x by 1 before it is used in the expression. The expression "-y" negates the value of y. Therefore, "++x + -y" is equivalent to "2 + (-5)", which equals -3. Thus, the value of x is -3.

Submit
38. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first?

Explanation

The operation that will be performed first in the given expression is 6.6/a. This is because division is performed before addition and multiplication. Therefore, the expression will be evaluated by dividing 6.6 by a before any other operations are performed.

Submit
39. If a is float variable, a=5/2 will return a value

Explanation

When performing division with integers in most programming languages, the result will be an integer value. In this case, 5 divided by 2 is equal to 2. However, since the variable "a" is declared as a float, the result of the division will be automatically converted to a float value. Therefore, the correct answer is 2.0.

Submit
40. Main( ) { int a=5; float b=10,c; c=b%a; printf(“%f”,c);    }output is

Explanation

The code gives an error because the modulus operator (%) cannot be used with float and integer operands. In this case, the variable 'b' is a float and 'a' is an integer, so trying to calculate the modulus of 'b' and 'a' will result in an error.

Submit
View My Results

Quiz Review Timeline (Updated): Aug 19, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 04, 2010
    Quiz Created by
    Sudha_test
Cancel
  • All
    All (40)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Representing various steps in a flow diagram is called as
Which of the following is an empty data type.
The operator ++ is called as operator
When && operator is used with two conditions, conditions need...
Variables are initialized in C, using
The purpose of main function is
A block is enclosed with pair of
The process of repeating a group of statements in an algorithm is...
In the following, which is bitwise operator?
What is output of the following program? ...
Every executable C program must contain a
What is output of the following program? ...
Int C; C=25/2; What is the value of C
Size of (double) returns
How many variables of the same type can be initialized at a time with...
What type of errors are checked during compilation
What is the valid identifier in the following
What are the smallest individual units in a program
Which of the following is not a relational operator
Which of the following is an incorrect variable name.
What symbol is used to represent the connector
Pseudo code is
 Which of the following cannot be used as an identifier.
The ANSI C standard recognizes maximum length of a variable up to
Consider scanf(“%2d”, &n); and the input data is 3142 then n...
Int a=13,b=7,c; c=a&b what is the value of c
What is output of following program ? ...
What is range of char data value?
Which of the following statements is wrong
If y is of integer type variable then the two expressions. ...
C is a
 main ( ) { int m,y; ...
Bitwise operators cannot be performed on
The minimum number of temporary variable needed to swap the contents...
What is the output of printf(“%d”,printf(“tim”));
What is the size of long double variable
Int x=1,y=5; ...
In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will...
If a is float variable, a=5/2 will return a value
Main( ) ...
Alert!

Advertisement