Copy Of C Quiz

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 Utsav Upadhyay
U
Utsav Upadhyay
Community Contributor
Quizzes Created: 1 | Total Attempts: 170
| Attempts: 170 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. C can be used on ?

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.

Submit
Please wait...
About This Quiz
Copy Of C Quiz - Quiz

This 'Copy of C Quiz' assesses knowledge in C programming, covering fundamentals like language history, syntax, and loop behaviors. It tests understanding of variable usage, output operations, and... see moreconditional statements, essential for learners and professionals in programming. see less

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

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.

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

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.

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

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".

Submit
5. #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?

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.

Submit
6.
#include<stdio.h>
int main()
{
    int a;
    printf("%d\n", sizeof(a));
    return 0;
}

What is the output of the program?

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.

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

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.

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

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.

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

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".

Submit
10. 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");

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.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 18, 2023 +

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
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
C can be used on ?
Is ["For Boolean Variable, Zero is used to represent false,...
C programming language was developed in 1972 by ________________ at...
Which of the following special symbol can be used in a variable name?
#include<stdio.h> ...
#include<stdio.h> ...
#include ...
What will be the output of following program ? ...
#include <stdio.h> ...
Which of the following are incorrect statements? If int a=10. ...
Alert!

Advertisement