Fundamental C Test1

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 Sudha_test
S
Sudha_test
Community Contributor
Quizzes Created: 12 | Total Attempts: 35,612
Questions: 40 | Attempts: 1,597

SettingsSettingsSettings
Fundamental C Test1 - Quiz

This is a fundamental C test


Questions and Answers
  • 1. 

    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 refer to mistakes in the code's structure or grammar, such as missing semicolons, incorrect variable declarations, or using incorrect syntax for loops or conditionals. These errors prevent the code from being compiled and executed successfully. Therefore, syntax errors are checked and identified during the compilation process.

    Rate this question:

  • 2. 

    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 in a program is the entry point where the program execution begins. It is the first function that is called when the program starts running. Therefore, the purpose of the main function is to start the execution of the program.

    Rate this question:

  • 3. 

    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". This is because a valid identifier in programming should start with a letter or an underscore, and can be followed by any combination of letters, digits, or underscores. "q1234" follows this rule as it starts with a letter and is followed by a combination of letters and digits. The other options "1fdasgf", "@hgd12", and "fahs%*" do not follow the rule for valid identifiers as they either start with a digit, contain special characters, or have invalid characters.

    Rate this question:

  • 4. 

    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 is because char is a 8-bit data type in Java, which means it can store values ranging from -128 to 127.

    Rate this question:

  • 5. 

    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, no temporary variable is needed. This can be achieved by using the XOR operation. By XORing the two variables, their values will be swapped without the need for any additional temporary variable. Therefore, the correct answer is 0.

    Rate this question:

  • 6. 

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

    • A.

      6

    • B.

      4.25

    • C.

      4

    • D.

      -6

    Correct Answer
    A. 6
    Explanation
    The program calculates the value of x using the expression 4 + 2 % 8. The % operator is the modulus operator, which returns the remainder of a division operation. In this case, 2 divided by 8 has a remainder of 2. So, the expression becomes 4 + 2, which equals 6. The program then prints the value of x, which is 6.

    Rate this question:

  • 7. 

    When && operator is used with two conditions, conditions need to be satisfied for the expression to be true.

    • A.

      Neither

    • B.

      Only first

    • C.

      Any one

    • D.

      Both

    Correct Answer
    D. Both
    Explanation
    The correct answer is "both" because when the && operator is used with two conditions, both conditions need to be satisfied for the expression to be true.

    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 is performed before addition and multiplication. Therefore, the expression will be evaluated by dividing 6.6 by a before any other operations are performed.

    Rate this question:

  • 9. 

    What is the output of printf(“%d”,printf(“tim”));

    • A.

      Garbage

    • B.

      Results in a syntax error

    • C.

      Printf tim and terminates abruptly

    • D.

      Tim3

    Correct Answer
    D. Tim3
    Explanation
    The output of the inner printf statement "tim" is 3 because it consists of three characters. This value is then passed as an argument to the outer printf statement, which uses the "%d" format specifier to print the value as an integer. Therefore, the output of the entire statement is "tim3".

    Rate this question:

  • 10. 

    What is output of the following program? main( ) {int x=15,y; y=(x >5)? 3 : 4; printf(“%d”,y); }

    • A.

      2

    • B.

      4

    • C.

      3

    • D.

      1

    Correct Answer
    C. 3
    Explanation
    The program initializes the variable x with a value of 15. It then assigns the value of 3 to the variable y based on the condition (x > 5). Since 15 is indeed greater than 5, the condition evaluates to true and y is assigned the value of 3. Therefore, the output of the program is 3.

    Rate this question:

  • 11. 

    What symbol is used to represent the connector

    • A.

      Parellogram

    • B.

      Rectangle with rounded end

    • C.

      Circle

    • D.

      Rectangle

    Correct Answer
    C. Circle
    Explanation
    The symbol used to represent the connector is a circle. This symbol is commonly used in flowcharts and diagrams to indicate a connection or relationship between different elements or processes. The circle represents a point of interaction or communication between components, and it is often used to illustrate the flow of information or the transfer of data.

    Rate this question:

  • 12. 

    Bitwise operators cannot be performed on

    • A.

      Float

    • B.

      Long int

    • C.

      Int

    • D.

      Char

    Correct Answer
    A. Float
    Explanation
    Bitwise operators are used to perform operations on individual bits of a binary representation of a number. However, float data type is a floating-point number which uses a different representation (IEEE 754 standard) and does not have a binary representation that can be manipulated using bitwise operators. Therefore, bitwise operators cannot be performed on float data type.

    Rate this question:

  • 13. 

    The ANSI C standard recognizes maximum length of a variable up to

    • A.

      8 characters

    • B.

      Unlimited characters

    • C.

      31 characters

    • D.

      15 characters

    Correct Answer
    C. 31 characters
    Explanation
    The ANSI C standard recognizes a maximum length of a variable up to 31 characters. This means that the name of a variable in C can be up to 31 characters long. This limit is set by the standard to ensure compatibility and consistency across different C compilers and platforms. It is important to adhere to this limit when naming variables in C programs to avoid any potential issues or errors.

    Rate this question:

  • 14. 

    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 predefined meanings and cannot be used as variable names.

    Rate this question:

  • 15. 

    What is the size of long double variable

    • A.

      10 bytes

    • B.

      8 bytes

    • C.

      4 bytes

    • D.

      16 bytes

    Correct Answer
    A. 10 bytes
    Explanation
    The size of a long double variable is 10 bytes.

    Rate this question:

  • 16. 

    Variables are initialized in C, using

    • A.

      : =

    • B.

      >

    • C.

      =

    • D.

      ==

    Correct Answer
    C. =
    Explanation
    In C, variables are initialized using the = operator. The = operator is used for assignment, where the value on the right side of the operator is assigned to the variable on the left side. This allows the variable to hold a specific value that can be used later in the program.

    Rate this question:

  • 17. 

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

    • A.

      2.5

    • B.

      2

    • C.

      2.0

    • D.

      3

    Correct Answer
    C. 2.0
    Explanation
    When performing division with integers in most programming languages, the result will be an integer value. In this case, 5 divided by 2 is equal to 2. However, since the variable "a" is declared as a float, the result of the division will be automatically converted to a float value. Therefore, the correct answer is 2.0.

    Rate this question:

  • 18. 

    Int a=13,b=7,c; c=a&b what is the value of c

    • A.

      0000 0000 0000 0101

    • B.

      0000 0000 0000 0100

    • C.

      0000 0000 0000 0110

    • D.

      0000 0000 0001 0101

    Correct Answer
    A. 0000 0000 0000 0101
    Explanation
    The value of c is 0000 0000 0000 0101. This is because the bitwise AND operation (&) is being performed between the binary representations of a and b. In this case, a is 0000 0000 0000 1101 and b is 0000 0000 0000 0111. When the bitwise AND operation is performed, each corresponding bit is compared. If both bits are 1, the result is 1. Otherwise, the result is 0. In this case, the result is 0000 0000 0000 0101, as only the third and first bits are 1 in both numbers.

    Rate this question:

  • 19. 

    In the following, which is bitwise operator?

    • A.

      >

    • B.

      *

    • C.

      |

    • D.

    Correct Answer
    C. |
    Explanation
    The correct answer is |. The vertical bar symbol (|) is the bitwise OR operator in programming. It performs a bitwise OR operation on each corresponding bit of two operands, resulting in a new value where each bit is set if either of the corresponding bits in the original operands is set.

    Rate this question:

  • 20. 

    If y is of integer type variable then the two expressions. 3*(y-8)/9 and (y-8)/9*3 yield the same value if

    • A.

      Y-8 is an integer multiple of 3

    • B.

      Y is an odd number

    • C.

      Y is an even number

    • D.

      Y-8 is an integer multiple of 9

    Correct Answer
    D. Y-8 is an integer multiple of 9
    Explanation
    If y is an integer multiple of 9, then (y-8) will also be an integer multiple of 9. Therefore, both expressions 3*(y-8)/9 and (y-8)/9*3 will yield the same value.

    Rate this question:

  • 21. 

    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 program first assigns the value of 1/2 to the integer variable 'a', which results in integer division and truncates the decimal part, so 'a' becomes 0. Then, it assigns the value of 1.0/2.0 to the float variable 'b', which performs floating-point division and gives the correct decimal value of 0.5. Finally, the program prints the values of 'a' and 'b' using the printf function. Therefore, the output of the program is "a=0 b=0.5".

    Rate this question:

  • 22. 

    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. A flow chart is a visual representation of a process or system, where each step is represented by a symbol or shape and connected by arrows to show the flow and sequence of the steps. It is commonly used to illustrate complex processes, algorithms, or decision-making processes in a clear and organized manner.

    Rate this question:

  • 23. 

    C is a

    • A.

      Machine language

    • B.

      High level language

    • C.

      High level language with some low level features

    • D.

      Low level language

    Correct Answer
    C. High level language with some low level features
    Explanation
    The correct answer is "High level language with some low level features." This means that language C is primarily a high-level language, which allows for abstraction and easier programming, but it also includes some low-level features that allow for direct manipulation of hardware and memory. This combination of high-level and low-level features makes C a versatile language that can be used for a wide range of applications, from system programming to application development.

    Rate this question:

  • 24. 

    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 are the building blocks of a program and represent the smallest meaningful units of code. Tokens can include keywords, identifiers, operators, constants, and symbols. Each token serves a specific purpose in the program and contributes to its overall functionality. By breaking down the program into tokens, it becomes easier for the compiler or interpreter to understand and execute the code.

    Rate this question:

  • 25. 

    Which of the following is an empty data type.

    • A.

      Integer

    • B.

      Float

    • C.

      Character

    • D.

      Void

    Correct Answer
    D. Void
    Explanation
    The correct answer is void. Void is a data type in programming that represents the absence of a value. It is often used as a return type for functions that do not return a value. Unlike other data types like integer, float, and character, void does not hold any data or have any memory allocation. It is essentially an empty data type.

    Rate this question:

  • 26. 

    The operator ++ is called as operator

    • A.

      Special increment

    • B.

      Increment

    • C.

      Double addition

    • D.

      Decrement

    Correct Answer
    B. Increment
    Explanation
    The operator ++ is referred to as the increment operator. This operator is used to increase the value of a variable by 1. It is commonly used in loops and other programming constructs where the value of a variable needs to be incremented. Therefore, the correct answer is "increment".

    Rate this question:

  • 27. 

    Which of the following is not a relational operator

    • A.

    • B.

      &&

    • C.

      !=

    • D.

      >

    Correct Answer
    B. &&
    Explanation
    The given answer, "&&", is not a relational operator. Relational operators are used to compare two values and return a boolean result. The operator "&&" is actually a logical operator, specifically the logical AND operator, which is used to combine two boolean expressions and return true only if both expressions are true. Relational operators include "!=" (not equal to) and ">" (greater than), which compare the values of two operands and return a boolean result based on the comparison.

    Rate this question:

  • 28. 

     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
    The code starts by initializing the variable m to 5. Then, the variable y is assigned the value of m after it is incremented by 1 using the pre-increment operator (++m). Finally, the values of m and y are printed using the printf function. Since m is incremented before it is assigned to y, both m and y will have the value of 6. Therefore, the output will be 6,6.

    Rate this question:

  • 29. 

    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 an integer by another integer in programming, the result is also an integer. In this case, 25 divided by 2 equals 12 with a remainder of 1. Since the result is an integer, the remainder is ignored and the value of C is 12.

    Rate this question:

  • 30. 

    Consider scanf(“%2d”, &n); and the input data is 3142 then n will be assigned

    • A.

      Error

    • B.

      31

    • C.

      42

    • D.

      31.42

    Correct Answer
    B. 31
    Explanation
    The correct answer is 31 because the format specifier "%2d" in scanf will only read the first two digits from the input data. In this case, the first two digits are 31, so n will be assigned the value 31.

    Rate this question:

  • 31. 

    Pseudo code is

    • A.

      Language independent code

    • B.

      Refined version of program

    • C.

      Code developed using the syntax of a specific language

    • D.

      Outcome of compilation process

    Correct Answer
    A. Language independent code
    Explanation
    Pseudo code is a language independent code that is used to represent algorithms in a simplified manner. It is not tied to any specific programming language and is used to outline the logic of a program without getting into the details of syntax and implementation. Pseudo code helps in understanding and communicating the algorithmic steps of a program, making it easier to translate into any programming language. Therefore, the correct answer is "language independent code".

    Rate this question:

  • 32. 

    A block is enclosed with pair of

    • A.

      ( )

    • B.

      { }

    • C.

    • D.

      [ ]

    Correct Answer
    B. { }
    Explanation
    The correct answer is "{ }" because the given options represent different types of brackets used in programming languages. The curly brackets "{ }" are commonly used to enclose a block of code or to define a set or dictionary in programming. The other options, parentheses "( )", and square brackets "[ ]", have different uses in programming, such as for function calls or indexing arrays.

    Rate this question:

  • 33. 

     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 a specific meaning and functionality. They are used to define the syntax and structure of the language, and therefore cannot be used as variable names or identifiers in a program.

    Rate this question:

  • 34. 

    Size of (double) returns

    • A.

      4

    • B.

      8

    • C.

      10

    • D.

      2

    Correct Answer
    B. 8
    Explanation
    The size of (double) returns 8. In most programming languages, the double data type is used to represent floating-point numbers with double precision. This means that it can store values with a larger range and more decimal places compared to the float data type. The size of a double is typically 8 bytes, which allows it to store 64 bits of information. Therefore, the correct answer is 8.

    Rate this question:

  • 35. 

    Which of the following statements is wrong

    • A.

      Con = ‘T’ * ‘A’ ;

    • B.

      This = ‘T’ * 20 ;

    • C.

      3+a=b;

    • D.

      Mes = 123.56

    Correct Answer
    C. 3+a=b;
    Explanation
    The statement "3+a=b;" is wrong because in programming, the equal sign (=) is used for assignment, not for comparison. Therefore, the correct syntax should be "b = 3 + a;".

    Rate this question:

  • 36. 

    Main( ) { int 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
    A. Gives an error
    Explanation
    The code gives an error because the modulus operator (%) cannot be used with float and integer operands. In this case, the variable 'b' is a float and 'a' is an integer, so trying to calculate the modulus of 'b' and 'a' will result in an error.

    Rate this question:

  • 37. 

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

    • A.

      8

    • B.

      6

    • C.

      5

    • D.

      7

    Correct Answer
    D. 7
    Explanation
    The expression "++x" increments the value of x by 1 before it is used in the expression. The expression "-y" negates the value of y. Therefore, "++x + -y" is equivalent to "2 + (-5)", which equals -3. Thus, the value of x is -3.

    Rate this question:

  • 38. 

    The process of repeating a group of statements in an algorithm is known as

    • A.

      Sequence

    • B.

      Iteration

    • C.

      Flow

    • D.

      Selection

    Correct Answer
    B. Iteration
    Explanation
    The process of repeating a group of statements in an algorithm is known as iteration. This involves executing a set of instructions multiple times until a certain condition is met. It allows for the efficient execution of repetitive tasks and helps in achieving desired outcomes.

    Rate this question:

  • 39. 

    Every executable C program must contain a

    • A.

      Printf function

    • B.

      Scanf, printf and main functions

    • C.

      Main function

    • D.

      Scanf function

    Correct Answer
    C. Main function
    Explanation
    Every executable C program must contain a main function. The main function is the entry point of the program, where the program starts its execution. It is mandatory for a C program to have a main function, as it is responsible for executing the statements and functions defined in the program. Without a main function, the program will not be able to run or execute any code.

    Rate this question:

  • 40. 

    How many variables of the same type can be initialized at a time with the same value

    • A.

      Three

    • B.

      One

    • C.

      Two

    • D.

      Any number of variables

    Correct Answer
    D. Any number of variables
    Explanation
    There is no limit to the number of variables of the same type that can be initialized at a time with the same value. In programming, you can assign a value to as many variables as you need, regardless of the type, as long as they are compatible with the value being assigned. Therefore, any number of variables can be initialized at a time with the same value.

    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
  • Aug 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 04, 2010
    Quiz Created by
    Sudha_test
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.