C Language Quiz @ Aptech Dha

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Aptechdha
A
Aptechdha
Community Contributor
Quizzes Created: 1 | Total Attempts: 318
Questions: 35 | Attempts: 318

SettingsSettingsSettings
Programming Language Quizzes & Trivia

Questions and Answers
  • 1. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    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.

    Rate this question:

  • 2. 

    The Symbol && is read as ____________________.

    • A.

      AND

    • B.

      OR

    Correct Answer
    B. OR
    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.

    Rate this question:

  • 3. 

    What type of errors are checked during compilation

    • A.

      Logical errors

    • B.

      Divide by zero error

    • C.

      Run - time errors

    • D.

      Syntax errors

    Correct Answer
    D. Syntax errors
    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.

    Rate this question:

  • 4. 

    The purpose of main function is

    • A.

      To stop program execution

    • B.

      To stop algorithm

    • C.

      To start algorithm

    • D.

      To start program execution

    Correct Answer
    D. To start program execution
    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.

    Rate this question:

  • 5. 

    What is the valid identifier in the following

    • A.

      1fdasgf

    • B.

      @hgd12

    • C.

      Fahs%*

    • D.

      Q1234

    Correct Answer
    D. Q1234
    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.

    Rate this question:

  • 6. 

    What is range of char data value?

    • A.

      -64 to 64

    • B.

      -128 to 127

    • C.

      0 to 255

    • D.

      -127 to 128

    Correct Answer
    B. -128 to 127
    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.

    Rate this question:

  • 7. 

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

    • A.

      3

    • B.

      1

    • C.

      0

    • D.

      2

    Correct Answer
    C. 0
    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.

    Rate this question:

  • 8. 

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

    • A.

      2*a

    • B.

      2/n

    • C.

      3*c

    • D.

      6.6/a

    Correct Answer
    D. 6.6/a
    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.

    Rate this question:

  • 9. 

    Which of the following is an incorrect variable name.

    • A.

      Else

    • B.

      Name

    • C.

      string

    • D.

      Age

    Correct Answer
    A. Else
    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.

    Rate this question:

  • 10. 

    Variables are initialized in C, using

    • A.

      : =

    • B.

      >

    • C.

      =

    • D.

      ==

    Correct Answer
    C. =
    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.

    Rate this question:

  • 11. 

    In the following, which is bitwise operator?

    • A.

      >

    • B.

      *

    • C.

      |

    • D.

    Correct Answer
    C. |
    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.

    Rate this question:

  • 12. 

    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); }

    • A.

      A=0.0 b=0. 5

    • B.

      A=0 b=0. 5

    • C.

      A=0.0 b= 5

    • D.

      A=0.5 b=0. 5

    Correct Answer
    B. A=0 b=0. 5
    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.

    Rate this question:

  • 13. 

    Representing various steps in a flow diagram is called as

    • A.

      Diagram

    • B.

      Flow chart

    • C.

      Program

    • D.

      Paint

    Correct Answer
    B. Flow chart
    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.

    Rate this question:

  • 14. 

    What are the smallest individual units in a program

    • A.

      Structures

    • B.

      Functions

    • C.

      record

    • D.

      Tokens

    Correct Answer
    D. Tokens
    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.

    Rate this question:

  • 15. 

    The operator ++ is called as operator

    • A.

      Special increment

    • B.

      Increment

    • C.

      Double addition

    • D.

      Decrement

    Correct Answer
    B. Increment
    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.

    Rate this question:

  • 16. 

    Which of the following is not a relational operator

    • A.

    • B.

      &&

    • C.

      !=

    • D.

      >

    Correct Answer
    B. &&
    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.

    Rate this question:

  • 17. 

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

    • A.

      5,5

    • B.

      5,6

    • C.

      6,6

    • D.

      6,5

    Correct Answer
    C. 6,6
    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".

    Rate this question:

  • 18. 

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

    • A.

      0.5

    • B.

      12.500000

    • C.

      12.000000

    • D.

      12

    Correct Answer
    D. 12
    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.

    Rate this question:

  • 19. 

     Which of the following cannot be used as an identifier.

    • A.

      Alphabet followed by digit

    • B.

      Alphabet

    • C.

      Keywords

    • D.

      Library function name

    Correct Answer
    C. Keywords
    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.

    Rate this question:

  • 20. 

    Size of (double) returns

    • A.

      4

    • B.

      8

    • C.

      10

    • D.

      2

    Correct Answer
    B. 8
    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.

    Rate this question:

  • 21. 

    The ___________________ loop executes at least once.

    • A.

      Do while

    • B.

      While

    Correct Answer
    A. Do while
    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.

    Rate this question:

  • 22. 

    An ___________________ is a collection of variables having same data type

    • A.

      Array

    • B.

      Operator

    • C.

      Function

    Correct Answer
    A. Array
    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.

    Rate this question:

  • 23. 

    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; }

    • A.

      The value of a is 2 The value of a is 2

    • B.

      The value of a is1 The value of a is 3

    • C.

      The value of a is 1 The value of a is 4

    • D.

      Compiler error

    Correct Answer
    C. The value of a is 1 The value of a is 4
    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.

    Rate this question:

  • 24. 

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

    • A.

      44

    • B.

      22

    • C.

      34

    • D.

      Compiler Error

    Correct Answer
    C. 34
    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.

    Rate this question:

  • 25. 

    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] ); }

    • A.

      3

    • B.

      Compiler Error

    • C.

      Runtime Error

    • D.

      4

    Correct Answer
    D. 4
    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".

    Rate this question:

  • 26. 

    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; }

    • A.

      1 2 3 4 5

    • B.

      It prints an infinite loop of numbers

    • C.

      1 2 3 4

    • D.

      1

    Correct Answer
    A. 1 2 3 4 5
    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.

    Rate this question:

  • 27. 

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

    • A.

      Infinite times

    • B.

      0 times

    • C.

      10 times

    • D.

      11 times

    Correct Answer
    D. 11 times
    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.

    Rate this question:

  • 28. 

    What is output of following program ? main( ) {int x; x= 14 % 8; printf(“%d”,x); }

    • A.

      6

    • B.

      4

    • C.

      1

    • D.

      1.75

    Correct Answer
    A. 6
    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.

    Rate this question:

  • 29. 

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

    • A.

      1, 2, 0, 1

    • B.

      -3, 2, 0, 1

    • C.

      2, 3, 1, 1

    • D.

      -3,2,0,-1

    Correct Answer
    D. -3,2,0,-1
    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.

    Rate this question:

  • 30. 

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

    • A.

      2

    • B.

      4

    • C.

      6

    • D.

      1

    Correct Answer
    C. 6
    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.

    Rate this question:

  • 31. 

    What is the size of long double variable

    • A.

      10 bytes

    • B.

      8 bytes

    • C.

      4 bytes

    • D.

      16 bytes

    Correct Answer
    B. 8 bytes
    Explanation
    The size of a long double variable is 8 bytes.

    Rate this question:

  • 32. 

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

    • A.

      2.5

    • B.

      2

    • C.

      2.0

    • D.

      3

    Correct Answer
    A. 2.5
    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.

    Rate this question:

  • 33. 

    main( ) { float a=5; float b=10,c; c=b%a; printf(“%f”,c);    }output is

    • A.

      Gives an error

    • B.

      2.0

    • C.

      0.00

    • D.

      0.000000

    Correct Answer(s)
    C. 0.00
    D. 0.000000
    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.

    Rate this question:

  • 34. 

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

    • A.

      8

    • B.

      -3

    • C.

      5

    • D.

      -7

    Correct Answer
    B. -3
    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.

    Rate this question:

  • 35. 

    Which one do you like?

    • A.

      Option 1

    • B.

      Option 2

    • C.

      Option 3

    • D.

      Option 4

    Correct Answer
    A. Option 1

Quiz Review Timeline +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.