Copy Of C Quiz

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 Utsav Upadhyay
U
Utsav Upadhyay
Community Contributor
Quizzes Created: 1 | Total Attempts: 131
Questions: 10 | Attempts: 132

SettingsSettingsSettings
Copy Of C Quiz - Quiz


Questions and Answers
  • 1. 

    C programming language was developed in 1972 by ________________ at bell laboratories of AT&T (American Telephone & Telegraph).

    • A.

      Ken Thompson

    • B.

      Peter Norton

    • C.

      Dennis Ritchie

    • D.

      Martin Richards

    Correct Answer
    C. Dennis Ritchie
    Explanation
    Dennis Ritchie is the correct answer because he was one of the key developers of the C programming language. Along with Ken Thompson, he created C at Bell Laboratories in 1972. Ritchie's contributions to C were instrumental in its development and popularization, making it one of the most widely used programming languages today.

    Rate this question:

  • 2. 

    Which of the following special symbol can be used in a variable name?

    • A.

      * (asterisk)

    • B.

      - (hyphen)

    • C.

      | (pipeline)

    • D.

      _ (underscore)

    Correct Answer
    D. _ (underscore)
    Explanation
    The underscore symbol can be used in a variable name. In many programming languages, including Python and JavaScript, the underscore is allowed as a character in variable names. It is commonly used to separate words in a multi-word variable name, creating a more readable and understandable code. For example, a variable could be named "my_variable" or "user_name".

    Rate this question:

  • 3. 

    #include<stdio.h> int main() { int a; printf("%d\n", sizeof(a)); return 0; } What is the output of the program?

    • A.

      2

    • B.

      4

    • C.

      Compiler Dependent

    • D.

      Garbage Value

    Correct Answer
    C. Compiler Dependent
    Explanation
    The output of the program is "Compiler Dependent". The sizeof() function in C returns the size in bytes of its operand. However, the size of an int data type is not fixed and can vary depending on the compiler and the system being used. Therefore, the output of sizeof(a) can be different on different compilers or systems.

    Rate this question:

  • 4. 

    #include<stdio.h> int main() {    int n;    for(n = 1; n!=8; n++)      {        printf("n = %d", n--);      }       return 0; } How many times will the loop run?

    • A.

      Zero times

    • B.

      Seven Times

    • C.

      Eight Times

    • D.

      Infinite Times

    Correct Answer
    D. Infinite Times
    Explanation
    The loop will run infinitely because the statement `n--` in the `printf` function will decrement the value of `n` after it is printed. As a result, the condition `n!=8` will always be true, causing the loop to continue indefinitely.

    Rate this question:

  • 5. 

    C can be used on ?

    • A.

      Only DOS

    • B.

      Only Linux

    • C.

      Only Windows

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    C is a programming language that is highly versatile and can be used on multiple operating systems. It is compatible with DOS, Linux, and Windows, making it a widely used language across different platforms. Therefore, the correct answer is "All of these" as C can be used on all of these operating systems.

    Rate this question:

  • 6. 

    Which of the following are incorrect statements? If int a=10. 1)  if( a==10 )   printf("Hello"); 2)  if( 10==a )   printf("Hello"); 3)  if( a=10  )   printf("Hello"); 4)  if( 10=a  )   printf("Hello");

    • A.

      Only 4

    • B.

      3 and 4

    • C.

      2 and 4

    • D.

      2, 3 and 4

    Correct Answer
    A. Only 4
    Explanation
    The correct answer is "Only 4". This is because the statement "if( 10=a )" is incorrect syntax in C programming. In C, the assignment operator is "=", not "==". Therefore, the correct syntax should be "if( a=10 )". The other statements are correct and will print "Hello" if the condition is true.

    Rate this question:

  • 7. 

    Is ["For Boolean Variable, Zero is used to represent false, and One is used to represent true."] true or false?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    This statement is true. In Boolean logic, which is used in computer programming and digital electronics, the value of zero is used to represent false, while the value of one is used to represent true. This convention allows for logical operations and comparisons to be performed on Boolean variables.

    Rate this question:

  • 8. 

    What will be the output of following program ? #include <stdio.h> void main() { if(!printf("")) printf("Okkk"); else printf("Hiii"); }

    • A.

      Okkk

    • B.

      Hiii

    • C.

      Error

    • D.

      None of these

    Correct Answer
    A. Okkk
    Explanation
    The program first checks the condition inside the if statement, which is the output of the printf function. The printf function prints an empty string and returns the number of characters printed. In this case, since the string is empty, it returns 0. The condition in the if statement is "!0", which evaluates to true. Therefore, the code inside the if statement is executed and "Okkk" is printed.

    Rate this question:

  • 9. 

    #include <stdio.h> void main() {     int x=22;     if(x=10)         printf("TRUE");     else         printf("FALSE"); }

    • A.

      Error

    • B.

      True

    • C.

      False

    • D.

      None of these

    Correct Answer
    B. True
    Explanation
    The correct answer is "True" because the condition in the if statement is "x=10", which is an assignment statement. In C programming, the value of an assignment statement is the value assigned to the variable, which in this case is 10. Since 10 is considered as a true value, the code inside the if statement will be executed, resulting in the output "True".

    Rate this question:

  • 10. 

    #include int main() {  int a=5;     if(a)         printf("1");         printf("2");     else         printf("3");         printf("4");     return 0; }

    • A.

      1

    • B.

      12

    • C.

      2

    • D.

      ERROR (misplaced if/illegal else without matching if.)

    Correct Answer
    D. ERROR (misplaced if/illegal else without matching if.)
    Explanation
    The given code will result in an error because the if statement is not properly structured. The if statement is missing curly braces {}, so only the first printf statement is considered as part of the if statement. The second printf statement is outside of the if statement, which causes a syntax error. Additionally, the else statement does not have a corresponding if statement, which is also a syntax error. Therefore, the code will not compile and will result in an error.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Mar 18, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 30, 2020
    Quiz Created by
    Utsav Upadhyay
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.