C Language Quiz @ Aptech Dha

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 Aptechdha
A
Aptechdha
Community Contributor
Quizzes Created: 1 | Total Attempts: 334
| Attempts: 334 | Questions: 35
Please wait...
Question 1 / 35
0 %
0/100
Score 0/100
1. The operator ++ is called as operator

Explanation

The operator ++ is called the increment operator. It is used to increment the value of a variable by 1. This operator is commonly used in loops and in situations where we need to increase the value of a variable by a specific amount. It is a shorthand notation for adding 1 to a variable.

Submit
Please wait...
About This Quiz
C Programming Quizzes & Trivia

This C Language Quiz at Aptech Dha challenges learners with questions on fundamental programming constructs like loops, arrays, and operators. It assesses understanding of basic syntax and output prediction in C, enhancing practical coding skills relevant for beginners.

Personalize your quiz and earn a certificate with your name on it!
2. An ___________________ is a collection of variables having same data type

Explanation

An array is a collection of variables having the same data type. This means that all the elements in an array are of the same type, such as integers, characters, or floating-point numbers. Arrays allow for efficient storage and access of multiple values of the same data type, as they provide a way to store and retrieve elements using an index. By using arrays, we can group related data together and perform operations on the entire collection of elements simultaneously.

Submit
3. Representing various steps in a flow diagram is called as

Explanation

The correct answer is "flow chart" because a flow chart is a graphical representation of a process or workflow. It uses different symbols and shapes to represent various steps or actions in a sequence. It helps in visualizing the flow of information or tasks and is commonly used in programming, business processes, and problem-solving.

Submit
4. The purpose of main function is

Explanation

The main function is the entry point of a program. It is where the program starts its execution. Therefore, the purpose of the main function is to start program execution.

Submit
5. Variables are initialized in C, using

Explanation

In C, variables are initialized using the "=" operator. This operator is used to assign a value to a variable. For example, if we want to initialize a variable named "x" with the value 10, we would write "x = 10". The "=" operator is used for assignment, while the "==" operator is used for comparison. So, the correct answer is "=" as it is used for initialization of variables in C.

Submit
6. What is output of the following program? main( ) {int x=15,y=6; if(x <15) printf("%d",y); }

Explanation

The program starts by declaring two variables, x and y, with values 15 and 6 respectively. The if statement checks if x is less than 15, which is not true in this case. Therefore, the code inside the if statement is not executed. Since there are no other statements after the if statement, the program does not produce any output. Therefore, the correct answer is 6.

Submit
7. The ___________________ loop executes at least once.

Explanation

The do while loop executes at least once because it first executes the code block and then checks the condition. This means that even if the condition is initially false, the code block will still be executed once before the condition is checked.

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

Explanation

When dividing two integers, the result is always an integer. In this case, 5 divided by 2 equals 2. However, since the variable "a" is declared as a float, the result will be automatically converted to a float value. Therefore, the correct answer is 2.5.

Submit
9. What is the valid identifier in the following

Explanation

The valid identifier in the given options is "q1234". In programming, an identifier is a name given to a variable, function, or any other user-defined item. It must follow certain rules, such as starting with a letter or underscore, and can contain letters, numbers, or underscores. "q1234" satisfies these rules and can be considered a valid identifier.

Submit
10.  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 predefined meanings. Using a keyword as an identifier would result in a syntax error or unexpected behavior in the program.

Submit
11. Size of (double) returns

Explanation

The size of a variable of type double in most programming languages is typically 8 bytes. This means that when a double variable is declared and initialized, it will occupy 8 bytes of memory. The size of a double is usually larger than other data types like int or float because it can store larger and more precise decimal numbers. Therefore, the correct answer for the given question is 8.

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

Explanation

The correct answer is |. The vertical bar or pipe symbol (|) is a bitwise OR operator. It performs a binary OR operation on each pair of corresponding bits in two operands. The result is 1 if either of the bits is 1, otherwise, it is 0.

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

Explanation



In the given code:

x is initially set to 1.

y is initially set to 5.

Now, let's break down the expression step by step:

++x is a pre-increment operation, which means x is incremented by 1 before its value is used. So, ++x becomes 2.

-y is a negation of y, so -y becomes -5.

Now, we add 2 (from ++x) to -5 (from -y):

x = 2 + (-5)

x = 2 - 5

x = -3

So, the value of x is -3.
Submit
14. Int C; C=25/2; What is the value of C

Explanation

The value of C is 12 because when dividing two integers, the result is an integer. In this case, 25 divided by 2 equals 12 with a remainder of 1. Since the result must be an integer, the remainder is ignored and the value of C is 12.

Submit
15. Which one do you like?

Explanation

not-available-via-ai

Submit
16. What will be the output of the following program? #include int main() { int a = 1, b = 2, c = 3; printf("The value of a is %d", a); a+=3; printf(" The value of a is %d", a); return 0; }

Explanation

The output of the program will be "The value of a is 1 The value of a is 4". This is because initially the value of 'a' is 1, which is printed. Then, 'a' is incremented by 3 using the compound assignment operator '+='. Therefore, the new value of 'a' is 4, which is printed in the second printf statement.

Submit
17. What  is the output of the below program? What is value of C. {a=10; b=12; c=a+b*2;}

Explanation

The given program calculates the value of the variable "c" using the following formula: c = a + b * 2.

a is assigned the value 10, and b is assigned the value 12.

Now, let's calculate the value of c: c = 10 + 12 * 2 c = 10 + 24 c = 34

So, the value of C is 34.

Submit
18. 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 special meanings and cannot be used as variable names. Therefore, using "else" as a variable name would result in a syntax error.

Submit
19. 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 output of the program will be "a=0 b=0.5". This is because in the line "a=1/2", the division is performed using integer division, which truncates the decimal part and assigns the result to the integer variable a. As a result, a is assigned the value 0. On the other hand, in the line "b=1.0/2.0", the division is performed using floating-point division, which retains the decimal part. Therefore, b is assigned the value 0.5.

Submit
20. What type of errors are checked during compilation

Explanation

During compilation, the compiler checks for syntax errors in the code. Syntax errors occur when the code does not follow the rules and structure of the programming language. These errors can include missing semicolons, incorrect variable declarations, or using incorrect syntax for loops or conditionals. The compiler identifies these errors and provides error messages to the programmer, indicating the specific line or section of code that needs to be corrected.

Submit
21. Do while loop tests the condition at the End of the Loop.

Explanation

The explanation for the given correct answer is that a do-while loop tests the condition at the end of the loop. This means that the loop will always execute at least once, regardless of the condition. After the loop body is executed, the condition is checked, and if it evaluates to true, the loop will continue. If the condition is false, the loop will terminate. Therefore, the statement "Do while loop tests the condition at the End of the Loop" is false.

Submit
22. What will be the output of the following program?
#include<stdio.h>

int main()
{
    int arr[3]= {1, 2, 3, 4};
    printf("%d\n",arr[3] );
    
}

Explanation

The program declares an integer array `arr` with a size of 3. However, when initializing the array, it provides four elements instead of three. This will result in a compilation error because the size of the array is exceeded. Therefore, the correct answer is "Compiler Error".

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

Explanation

Tokens are the smallest individual units in a program. They represent the basic building blocks of a program and include keywords, operators, identifiers, constants, and punctuation symbols. Each token has a specific meaning and is used to construct statements and expressions in a program. Tokens are important for the compiler or interpreter to understand the program's structure and syntax.

Submit
24. What will be the output of the following program? int main() { int i=1; do{ printf("%d\t",i); i++; if(i > 5) break; } while(TRUE); return 0; }

Explanation

The program starts by initializing the variable i to 1. It then enters a do-while loop, which means that the code inside the loop will always execute at least once. Inside the loop, the value of i is printed using the printf function. Then, i is incremented by 1. If the value of i is greater than 5, the loop is terminated using the break statement. Since i is incremented after each iteration, the loop will eventually terminate when i becomes 6. Therefore, the output of the program will be 1 2 3 4 5.

Submit
25. What is output of following program ? main( ) {int x; x= 14 % 8; printf("%d",x); }

Explanation

The program calculates the remainder of 14 divided by 8 using the modulus operator (%). The remainder is 6. The program then uses the printf function to print the value of x, which is 6. Therefore, the output of the program is 6.

Submit
26. 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 has a higher precedence than addition and multiplication. Therefore, the expression will be evaluated from left to right, and the division 6.6/a will be performed before any other operations.

Submit
27.  
int main()
{
    int i=-3, j=2, k=0, m;
m=i++;
    printf("%d, %d, %d, %d\n", i, j, k, m);
    return 0;
}

Explanation

The correct answer is -3, 2, 0, -1. In the given code, the value of i is initially -3. The statement "m=i++;" assigns the current value of i to m and then increments the value of i by 1. Therefore, m is assigned the value -3 and i becomes -2. The printf statement then prints the values of i, j, k, and m, which are -2, 2, 0, and -3 respectively.

Submit
28.
int main()
{
    int x;
    for(x=-1; x<=10; x++)
    {
        if(x < 5)
            continue;
        else
            break;
        printf("IndiaBIX");
    }
    return 0;
}

Explanation

In this code, the variable x is initially set to -1. The for loop runs as long as x is less than or equal to 10. Inside the loop, the if condition checks if x is less than 5. If it is, the continue statement is executed, which skips the rest of the code inside the loop and goes to the next iteration. If x is not less than 5, the else statement is executed, which includes the break statement. The break statement terminates the loop and exits it completely. Therefore, the code inside the loop that prints "IndiaBIX" is never executed. Since the loop runs 11 times (from -1 to 10), the answer is 11 times.

Submit
29. What is the size of long double variable

Explanation

The size of a long double variable is 8 bytes.

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

Explanation

The correct answer is &&. In programming, relational operators are used to compare values and determine the relationship between them. The && operator is a logical operator, not a relational operator. It is used to perform logical AND operation on two boolean values. Relational operators include != (not equal to) and > (greater than), which are used to compare values for equality and determine if one value is greater than another, respectively.

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

Explanation

To swap the contents of two variables, we can use a temporary variable to hold the value of one variable while we assign the value of the other variable to it. However, in this case, the answer is 0 because we can perform the swap operation without using any temporary variable. This can be achieved by using arithmetic operations like addition and subtraction. By adding the value of one variable to the other and then subtracting the original value of the second variable from the sum, we can effectively swap their contents.

Submit
32. The Symbol && is read as ____________________.

Explanation

The symbol && is commonly read as "AND" in computer programming languages, but in this case, the correct answer is "OR." This may be due to a typographical error or a misunderstanding of the question. The symbol || is typically used to represent "OR" in programming, while && represents the logical "AND" operation.

Submit
33. What is range of char data value?

Explanation

The range of char data value is -128 to 127. This means that a char variable can hold any integer value between -128 and 127, inclusive. The char data type in most programming languages is typically used to store single characters, but it can also be used to store small integers within this range.

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

Explanation

In the given code, the variable "m" is initialized with the value 5. Then, the value of "m" is incremented by 1 using the pre-increment operator (++m). This means that the value of "m" becomes 6. The value of "m" is then assigned to the variable "y". So, the value of "y" also becomes 6. Finally, the printf statement prints the values of "m" and "y", which are both 6. Hence, the output of the code is "6,6".

Submit
35. Main( ) { float a=5; float b=10,c; c=b%a; printf("%f",c);    }output is

Explanation

The output of the code is 0.00 and 0.000000 because the modulus operator (%) is used to calculate the remainder when dividing two numbers. In this case, b (10) is divided by a (5), which gives a remainder of 0. Since both a and b are floating-point numbers, the result is also a floating-point number. The output is displayed as "0.00" and "0.000000" because the printf statement is used to format and display the result.

Submit
View My Results

Quiz Review Timeline (Updated): Sep 12, 2023 +

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

  • Current Version
  • Sep 12, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 21, 2014
    Quiz Created by
    Aptechdha
Cancel
  • All
    All (35)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
The operator ++ is called as operator
An ___________________ is a collection of variables having same data...
Representing various steps in a flow diagram is called as
The purpose of main function is
Variables are initialized in C, using
What is output of the following program? ...
The ___________________ loop executes at least once.
If a is float variable, a=5/2 will return a value
What is the valid identifier in the following
 Which of the following cannot be used as an identifier.
Size of (double) returns
In the following, which is bitwise operator?
Int x=1,y=5; ...
Int C; C=25/2; What is the value of C
Which one do you like?
What will be the output of the following program? ...
What  is the output of the below program? ...
Which of the following is an incorrect variable name.
What is output of the following program? ...
What type of errors are checked during compilation
Do while loop tests the condition at the End of the Loop.
What will be the output of the following program? ...
What are the smallest individual units in a program
What will be the output of the following program? ...
What is output of following program ? ...
In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will...
  ...
Int main() ...
What is the size of long double variable
Which of the following is not a relational operator
The minimum number of temporary variable needed to swap the contents...
The Symbol && is read as ____________________.
What is range of char data value?
 main ( ) { int m,y; ...
Main( ) ...
Alert!

Advertisement