### C Language

 Description: C Language Number of Questions: 15 Created by: Aliensbrain Bot Tags: C Language
Attempted 0/14 Correct 0 Score 0

Which of the following statements is/are correct for classes and objects in C++ language?

1. Static keyword is used to preserve the value of a variable.

2. Member functions of a class can also be declared as constants.

3. The local class has no access to global variables as well as static variables.

4. Both 1 and 3

5. Both 1 and 2

Correct Option: E
Explanation:

Options 1 and 2 are true.

Which of the following statements is not true?

1. getchar() reads one character at a time till the user presses enter.

2. putchar() prints one character on the screen at a time, read by the standard input.

3. getch() reads alphanumeric character from the input device.

4. getch() does not display the character input by it on the screen.

5. All of the above

Correct Option: E
Explanation:

All the given options are correct.

Which of the following statements is/are true for the “structures” in C language?

1. We cannot create nesting of “structures” in a C program.

2. By default, all the member structures are private.

3. We can pass a structure element to a function.

4. Both 1 and 3

5. Both 2 and 3

Correct Option: C
Explanation:

It is possible to pass a structure element to a function.

Find out the output of the given program in binary language.

#include
#include
int main() {
int a = 7, b = 15, c;
c = a | b;
printf("The result comes out to be : %d", c);
getch();
}

1. The result comes out to be 0111.

2. The result comes out to be 1111.

3. The result comes out to be 0111.

4. The result comes out to be 0110.

5. Error in the program

Correct Option: B
Explanation:

This program will just OR the binary values of 7 and 15.

Which of the following options is true for functions in C language?

1. Functions operate on actual address argument and return the address back to the calling function.

2. The values of formal arguments passed by the calling function are received by the actual arguments of the called function.

3. The detail of inner working of a function is known to the whole program.

4. A class can always access the functions of another class with friend function.

5. None of these

Correct Option: E
Explanation:

All of the options are false. So, this is correct option.

Which of the following statements is/are true regarding the making of a program to store the data using “bit fields” in C language?

1. Array of bit fields are not permitted.

2. Pointer cannot be used for addressing the bit fields directly.

3. We can use only unsigned integer data type with bit fields.

4. A bit field is set up with a structure declaration.

5. All of the above

Correct Option: E
Explanation:

All  the options are true. So, this is the correct answer.

Which of the following symbols is used for the comparison of two values?

1. ==

2. &&

3. ++

4. --

5. +

Correct Option: A
Explanation:

This option is correct as this operator compares two values whether they are equal or not.

Which of the following is not an object-oriented programming language?

1. C

2. C++

3. C#

4. Java

5. F#

Correct Option: A
Explanation:

This option is correct.

Which of the following is a unary operator?

1. &&

2. ||

3. >=

4. ++

5. <=

Correct Option: D
Explanation:

This option is correct as this is a unary plus operator.

Which of the following standard functions accepts two arguments while calling?

1. Strspn();

2. Strnset();

3. Strnsetu();

4. Strdup();

5. Strncpyl();

Correct Option: A
Explanation:

This option is true because this function takes two arguments and it returns the position of the string from where the source array does not match with the target one.
Format of this function is:
Strspn( string 1, string 2);
For example, suppose we enter first string as “good morning” and second string as “good luck”.
So, the function will return 5 because after 5 characters, there is no match found in the strings.

Which of the following is a bitwise operator?

1. !=

2. &

3. ==

4. <

5. >

Correct Option: B
Explanation:

This option is correct as bitwise AND operator (&) compares each bit of the first operand to the corresponding bit of the second operand.

With which boolean operator is logical AND denoted?

1. &&

2. ||

3. >=

4. <=

5. !

Correct Option: A
Explanation:

This option is correct as this symbol is assigned to denote a logical AND operator.

Which of the following options is correct for file handling?

1. Random access file takes less time for reading than a sequential file.

2. getw() function reads all data types from a file.

3. Closall() function closes all the opened files in a program.

4. ofstream is a class to read the data from a file.

5. None of these

Correct Option: A
Explanation:

This is correct.

Find out the output of the given program.

#include
#include
main()
{
int s = 25, d;
d = s % 10;
if (d == 5) {
s = s / 10;
printf("\\nresult is=%d%d", s * s++, d * d);
}
else {
printf("\\n invalid number");
}
getch();
}

1. Invalid number

2. 425

3. 625

4. 525

5. Compiler error

Correct Option: C
Explanation:

The answer would be 425.

+ View questions