Computer Programming & Utilization

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 Catherine Halcomb
C
Catherine Halcomb
Community Contributor
Quizzes Created: 1452 | Total Attempts: 5,818,250
Questions: 30 | Attempts: 638

SettingsSettingsSettings
Computer Programming & Utilization - Quiz

Computer Programming and Utilization is the fundamental course on the know-how of computers and its language. Are you taking this course and need some revision material? The quiz below is one in many that are designed from your entire course work, give it a shot, and see how good you will score. Don’t forget to share it with tour classmates!


Questions and Answers
  • 1. 

    Any C program 

    • A.

      Must contain at least one function

    • B.

      Need not contain any function

    • C.

      Needs input data

    • D.

      None of above

    Correct Answer
    A. Must contain at least one function
    Explanation
    In C programming, a program must contain at least one function. A function is a block of code that performs a specific task. It is the fundamental building block of a C program and is necessary for the program to execute any instructions. Without a function, there would be no way to define the tasks or operations that the program should perform. Therefore, it is a requirement for any C program to have at least one function.

    Rate this question:

  • 2. 

    Any C program 

    • A.

      Must contain at least one function

    • B.

      Need not contain any function

    • C.

      Needs input data

    • D.

      None of above

    Correct Answer
    A. Must contain at least one function
    Explanation
    In C programming, a program must contain at least one function. A function is a block of code that performs a specific task and can be called from other parts of the program. Without a function, there would be no executable code in the program, and it would not be able to perform any operations. Therefore, it is necessary for a C program to have at least one function.

    Rate this question:

  • 3. 

    Which of the following is used to perform computations on the entered data?

    • A.

      Memory

    • B.

      Processor

    • C.

      Input Device

    • D.

      Output Device

    Correct Answer
    B. Processor
    Explanation
    The processor is responsible for performing computations on the entered data. It is the central unit of a computer system that executes instructions and carries out calculations. The processor receives input from the input devices, processes the data, and then sends the output to the output devices. Memory stores the data, input devices are used to enter data into the computer, and output devices display or transmit the processed data. However, the processor is specifically designed to perform computations and execute instructions on the data.

    Rate this question:

  • 4. 

    In which of the following languages,the instructions are written in the form of 0s and 1s?

    • A.

      Assembly Language

    • B.

      Programming Language

    • C.

      High-Level Language

    • D.

      Machine Language

    Correct Answer
    D. Machine Language
    Explanation
    Machine Language is the correct answer because it is a low-level programming language that uses binary code, represented by 0s and 1s, to provide instructions to a computer's processor. It is the most basic form of programming language and is directly understood by the computer's hardware. Assembly Language is also a low-level language, but it uses mnemonics instead of binary code. Programming Language and High-Level Language are higher-level languages that use human-readable syntax and require a compiler or interpreter to convert the code into machine language.

    Rate this question:

  • 5. 

    The underscore can be used anywhere in the identifier

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The underscore cannot be used anywhere in the identifier. In most programming languages, the underscore is allowed to be used in identifiers, but there are certain rules and restrictions. Generally, it can be used as a separator between words in a multi-word identifier, but it cannot be used at the beginning or end of the identifier. Additionally, some programming languages may have specific rules regarding the use of underscores in identifiers. Therefore, the statement that the underscore can be used anywhere in the identifier is false.

    Rate this question:

  • 6. 

    The keyword void is a datatype in C

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    In C programming, the keyword "void" is indeed a datatype. It is used to indicate that a function does not return a value. When a function is declared with the "void" datatype, it means that the function does not have a return type and does not return any value. This is commonly used when defining functions that perform certain actions or operations without needing to return a result. Therefore, the statement "The keyword void is a datatype in C" is true.

    Rate this question:

  • 7. 

    Declaration can appear anywhere in a program

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The declaration in a program must appear before the first use of the variable. If a variable is used before it is declared, the program will produce an error. Therefore, the statement "Declaration can appear anywhere in a program" is false.

    Rate this question:

  • 8. 

    How many keywords are recognized by standard ANSI C?

    • A.

      30

    • B.

      24

    • C.

      32

    • D.

      36

    Correct Answer
    C. 32
    Explanation
    The standard ANSI C recognizes 32 keywords. These keywords are reserved words that have predefined meanings in the C programming language. They cannot be used as identifiers or variable names in the program.

    Rate this question:

  • 9. 

    Who amongst the following developed the C programming language?

    • A.

      James Gosling

    • B.

      Bjarne Stroustrup

    • C.

      Dennis Ritchie

    • D.

      Ray Boyce

    Correct Answer
    C. Dennis Ritchie
    Explanation
    Dennis Ritchie developed the C programming language.

    Rate this question:

  • 10. 

    Which special function is ued by the C system to tell the computer where the program starts?

    • A.

      Printf

    • B.

      Begin

    • C.

      Main

    • D.

      Scanf

    Correct Answer
    C. Main
    Explanation
    The special function used by the C system to tell the computer where the program starts is "main". This function is the entry point of a C program and is executed first when the program is run. It contains the code that defines the program's logic and controls the flow of execution.

    Rate this question:

  • 11. 

    What is a name having a few letters,numbers and special character_(underscore) called?

    • A.

      Keywords

    • B.

      Tokens

    • C.

      Reserved Keywords

    • D.

      Identifiers

    Correct Answer
    D. Identifiers
    Explanation
    The given correct answer for this question is "Identifiers". In programming, an identifier is a name that is used to identify a variable, function, class, or any other user-defined item. Identifiers can consist of a combination of letters, numbers, and special characters like an underscore (_). They are used to give unique names to different elements in a program and help in distinguishing them from each other.

    Rate this question:

  • 12. 

    What should be used to end every program statement in C language?

    • A.

      Semicolon

    • B.

      Comma

    • C.

      Full Stop

    • D.

      Colon

    Correct Answer
    A. Semicolon
    Explanation
    In the C language, the semicolon (;) is used to end every program statement. It serves as a delimiter that indicates the end of a line of code. By using a semicolon, the compiler knows that the current statement is complete and can move on to the next line of code. Omitting the semicolon or using any other punctuation mark to end a statement would result in a syntax error, causing the program to fail during compilation. Therefore, the correct answer is semicolon.

    Rate this question:

  • 13. 

    Which of the following depicts the correct sequence of steps to run a program?

    • A.

      Compile,create,link,execute

    • B.

      Create,compile,link,execute

    • C.

      Link,compile,create,execute

    • D.

      Link,create,compile,execute

    Correct Answer
    B. Create,compile,link,execute
    Explanation
    The correct sequence of steps to run a program is to first create the program, then compile it to convert the source code into machine code, then link the compiled code with any necessary libraries or modules, and finally execute the program to run it.

    Rate this question:

  • 14. 

    Which of the following is a valid define statement?

    • A.

      #define MAX 200

    • B.

      #define MAX=200

    • C.

      # define MAX 200

    • D.

      #define MAX 200;

    Correct Answer
    A. #define MAX 200
    Explanation
    The correct answer is "#define MAX 200" because it follows the correct syntax for a define statement. In C programming, the define statement is used to define constants. It starts with the "#define" keyword, followed by the name of the constant (in this case "MAX"), and then the value of the constant (in this case 200). The statement should not have an equal sign or a semicolon after the value.

    Rate this question:

  • 15. 

    Identify the correct sequence of statements that swaps value of two statements.

    • A.

      A=a+b;a=a-b;b=a-b;

    • B.

      A=a+b;b=a-b;a=a-b;

    • C.

      A=a-b;a=a+b;b=a-b;

    • D.

      A=a-b;a=a+b;b=b-a;

    Correct Answer
    B. A=a+b;b=a-b;a=a-b;
    Explanation
    The correct sequence of statements that swaps the value of two variables is a=a+b; b=a-b; a=a-b;. In the first statement, the value of a is updated to a+b. In the second statement, the value of b is updated to the difference between the new value of a and the original value of b. Finally, in the third statement, the value of a is updated to the difference between the original value of a and the original value of b, effectively swapping their values.

    Rate this question:

  • 16. 

    What will the output of the following code?#include<stdio.h>main(){int x=1,y=1,z;z = x++  +y;printf("%d%d",x,y);} 

    • A.

      X=1,y=1

    • B.

      X=1,y=2

    • C.

      X=2,y=1

    • D.

      X=2,y=2

    Correct Answer
    C. X=2,y=1
    Explanation
    The code snippet initializes variables x and y to 1. Then, it assigns the value of the expression x++ + y to variable z. The post-increment operator (x++) increments the value of x after it is used in the expression. Therefore, z will be assigned the value of 1 + 1, which is 2. Finally, the printf statement prints the values of x and y, which are 2 and 1 respectively.

    Rate this question:

  • 17. 

    Which of the following does not depict an arithmetic operation?

    • A.

      A*=10

    • B.

      A!=10

    • C.

      A/=10

    • D.

      A%=10

    Correct Answer
    B. A!=10
    Explanation
    The expression "a!=10" does not depict an arithmetic operation because it is a comparison operation, specifically checking if the value of "a" is not equal to 10. Arithmetic operations involve mathematical calculations such as addition, subtraction, multiplication, and division, which are represented by the other expressions given in the options.

    Rate this question:

  • 18. 

    What does the unary operator "&" yield when applied to a variable?

    • A.

      The variable's correct value

    • B.

      The variable's binary form

    • C.

      The variable's address

    • D.

      The variable as it is

    Correct Answer
    C. The variable's address
    Explanation
    The unary operator "&" when applied to a variable yields the variable's address. This means that it returns the memory location where the variable is stored.

    Rate this question:

  • 19. 

    If x is an integer variable,which value will x=5/2 yield?

    • A.

      2.5

    • B.

      2.00000

    • C.

      2

    • D.

      0

    Correct Answer
    C. 2
    Explanation
    When x is an integer variable, the value x=5/2 will yield 2. This is because when dividing 5 by 2, the result is 2.5. However, since x is an integer variable, it can only hold whole numbers and not decimal values. Therefore, the decimal part of 2.5 is truncated, resulting in the value 2.

    Rate this question:

  • 20. 

    Which of these statements does not hold true for the operator ++ and --?

    • A.

      They are unary operators.

    • B.

      The operand can come before or after the operator.

    • C.

      They do not require variables as their operands.

    • D.

      It can not be applied to an expression.

    Correct Answer
    C. They do not require variables as their operands.
    Explanation
    The statement "They do not require variables as their operands" is incorrect. The increment (++) and decrement (--) operators are unary operators that require a variable as their operand. They are used to increase or decrease the value of a variable by 1. It is not possible to apply these operators to expressions or constants.

    Rate this question:

  • 21. 

    #include int main() { int k, num=30; k = (num>5 ? (num <=10 ? 100 : 200): 500); printf("%d\n", num); return 0; }

    • A.

      200

    • B.

      30

    • C.

      100

    • D.

      500

    Correct Answer
    B. 30
    Explanation
    The code snippet declares an integer variable `k` and assigns it a value based on the value of `num`. If `num` is greater than 5 and less than or equal to 10, `k` is assigned a value of 100. If `num` is greater than 10, `k` is assigned a value of 200. If `num` is not greater than 5, `k` is assigned a value of 500. In this case, the value of `num` is 30, which is greater than 5 but not less than or equal to 10. Therefore, `k` is assigned a value of 200. The value of `num` is then printed, which is 30.

    Rate this question:

  • 22. 

    What will be the output of the program?#include<stdio.h> int main() { int i=-3, j=2, k=0, m; m = ++i && ++j && ++k; printf("%d, %d, %d, %d\n", i, j, k, m); return 0; }

    • A.

      -2, 3, 1, 1

    • B.

      2, 3, 1, 2

    • C.

      1, 2, 3, 1

    • D.

      3, 3, 1, 2

    Correct Answer
    A. -2, 3, 1, 1
    Explanation
    The output of the program will be -2, 3, 1, 1.

    In the given code, the variable i is pre-incremented by 1, making it -2. Then, the variable j is also pre-incremented by 1, making it 3. Finally, the variable k is not incremented as the logical AND operator (&&) short-circuits when the left operand is false. Since the left operand is false (0), the right operand is not evaluated, and k remains 0.

    The value of m is determined by the logical AND operation between the three variables. Since all three variables are non-zero, the result of the logical AND operation is 1.

    Therefore, the final output is -2, 3, 1, 1.

    Rate this question:

  • 23. 

    It is necessary that a header files should have a .h extension?

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Header files in C or C++ typically have a .h extension for convention and ease of identification. However, it is not necessary for a header file to have a .h extension. The extension is merely a naming convention followed by programmers to indicate that a file contains declarations or definitions of functions, variables, or other elements that are intended to be shared across multiple source files. The compiler does not enforce the requirement for a header file to have a .h extension, so it is possible to have header files with different extensions or even no extension at all.

    Rate this question:

  • 24. 

    Which of the following special symbol allowed in a variable name?

    • A.

      * (asterisk)

    • B.

      | (pipeline)

    • C.

      - (hyphen)

    • D.

      _ (underscore)

    Correct Answer
    D. _ (underscore)
    Explanation
    The underscore symbol (_) is allowed in a variable name. In programming, it is commonly used to separate words in a variable name, making it more readable. For example, a variable named "my_variable" uses an underscore to separate the words "my" and "variable". The asterisk (*) is not allowed in a variable name as it is a special character used for multiplication or pointer operations. The pipeline (|) and hyphen (-) symbols are also not allowed in variable names.

    Rate this question:

  • 25. 

    Which of the following is the correct order of evaluation for the below expression?z = x + y * z / 4 % 2 - 1

    • A.

      * / % + - =

    • B.

      = * / % + -

    • C.

      / * % - + =

    • D.

      * % / - + =

    Correct Answer
    A. * / % + - =
    Explanation
    The correct order of evaluation for the expression is as follows: first, perform the multiplication ( * ) operation between y and z. Then, divide ( / ) the result by 4. Next, calculate the modulo ( % ) of the division result with 2. After that, add ( + ) the value of x to the previous result. Finally, subtract ( - ) 1 from the sum.

    Rate this question:

  • 26. 

    Will the printf() statement print the same values for any values of a?#include<stdio.h> int main() { float a; scanf("%f", &a); printf("%f\n", a+a+a); printf("%f\n", 3*a); return 0; }

    • A.

      YES

    • B.

      NO

    Correct Answer
    A. YES
    Explanation
    The printf() statement will print the same values for any values of 'a' because both statements are performing the same calculation, which is multiplying 'a' by 3. Therefore, the output will always be the same regardless of the value of 'a'.

    Rate this question:

  • 27. 

    Which of the following correctly shows the hierarchy of Arithmetic Operator in C?

    • A.

      / + * -

    • B.

      * - / +

    • C.

      + - / *

    • D.

      / * + -

    Correct Answer
    D. / * + -
    Explanation
    The correct hierarchy of Arithmetic Operators in C is shown as follows: Division (/) has the highest precedence, followed by Multiplication (*), Addition (+), and Subtraction (-). This means that when multiple operators are present in an expression, division will be evaluated first, followed by multiplication, addition, and finally subtraction.

    Rate this question:

  • 28. 

    In which order do the following evaluated?  1. Relational2. Arithmetic3.Logical4.Assignment

    • A.

      2134

    • B.

      1234

    • C.

      4321

    • D.

      3214

    Correct Answer
    A. 2134
    Explanation
    The given answer, 2134, represents the order in which the operations are evaluated. According to the answer, the relational operations (1) are evaluated first, followed by arithmetic operations (2), then logical operations (3), and finally assignment operations (4). This order suggests that the relational operations have the highest precedence, followed by arithmetic, logical, and assignment operations.

    Rate this question:

  • 29. 

    Associativity has no role to play unless the precedence of operator is same.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Associativity refers to the order in which operators of the same precedence are evaluated. If the precedence of operators is the same, associativity determines whether the operators are evaluated from left to right or right to left. However, if the precedence of operators is different, associativity does not come into play. This means that associativity has no role to play unless the precedence of the operator is the same. Therefore, the given statement is true.

    Rate this question:

  • 30. 

    Sizeof() is a operator.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The statement is true because sizeof() is indeed an operator in programming. It is used to determine the size in bytes of a data type or variable. This operator is commonly used in C and C++ programming languages to allocate memory and calculate the size of arrays, structures, and data types.

    Rate this question:

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.