0

programming languages Online Quiz - 36

Description: programming languages Online Quiz - 36
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. identifiers

  2. constant variables

  3. floating point variables

  4. mnemonic variables


Correct Option: D

What is the value of x when the below code segment is executed? int main() { int x , *z ; x = 10 ; z = &x ; x = 20 ; *z = 10 ; }

  1. 10

  2. 20

  3. Compilation Error

  4. RuntimeError


Correct Option: A

We need to have a structure day of type date which has the following values. date day = {17,2,2011}; Will the following Structure declaration Correct? struct date { int mm ; int dd ; date year ; }day;

  1. True

  2. False


Correct Option: B

What will be output if you will Execute following code? #include #include void main() {     char c=-'a';     printf("%d",c); }

  1. 65

  2. -65

  3. 97

  4. -97

  5. CompilationError


Correct Option: D

Which of the following can be used to initialize a newly declared Variable from an existing variable?

  1. Virtual Function

  2. Namespaces

  3. copy constructor

  4. None of the Above


Correct Option: C

The inserting of the code of a called function at the point where The function gets called is achieved by using

  1. Inline functions

  2. virtual functions

  3. Both A and B

  4. None of the Above


Correct Option: A

What the following program is executed? void main() { void ptr = (void) malloc(sizeof(void)); ptr++ ; }

  1. CompilationFails

  2. Will Throw RunTime Error But Code will get Compiled

  3. Throws Linker Error

  4. All the above statements are invalid


Correct Option: A

What happens when the following code segment is Validated? int x = 20; Int main() { int x ; x = 10 ; return x ; }

  1. Complies Successfully

  2. Error Due to Duplicate Variables.

  3. RunTime Error

  4. Executes Successfully


Correct Option: A

The output of operation 20%3 is

  1. 6

  2. 2

  3. 1

  4. 4


Correct Option: B

What will be the output of the following code? #include

  1. 6

  2. 7

  3. 8

  4. 9

  5. CompilationError


Correct Option: D

What will be the output of the following code? #include<stdio.h> int main() {     int num,a=5;     num=-a--;     printf("%d  %d",num,a); }

  1. 5,4

  2. -4,4

  3. -5,4

  4. -4,5

  5. Compilation Error


Correct Option: C

setprecision requires the header file

  1. stdlib.h

  2. iomanip.h

  3. console.h

  4. conio.h


Correct Option: A

If char catname[15]; , which of the following is valid?

  1. catname[15] = "Millie";

  2. catname = "Millie";

  3. catname[ ] = "Millie";

  4. None are Valid


Correct Option: D

Variables with names that describe the data stored at that particular memory location are called as

  1. identifiers

  2. constant variables

  3. floating point variables

  4. mnemonic variables


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of variables and identifiers.

Option A) Identifiers - This option is incorrect because identifiers are names used to identify variables, functions, or other entities in a program. While identifiers can describe the data stored at a memory location, not all identifiers necessarily do so.

Option B) Constant variables - This option is incorrect because constant variables are variables whose values cannot be changed once they are assigned. The naming of constant variables does not necessarily describe the data stored at a memory location.

Option C) Floating point variables - This option is incorrect because floating point variables are variables that can store decimal numbers. The naming of floating point variables does not necessarily describe the data stored at a memory location.

Option D) Mnemonic variables - This option is correct because mnemonic variables are variables with names that describe the data stored at a particular memory location. Mnemonic variables are often used to make the code more readable and understandable.

The correct answer is D) mnemonic variables. This option is correct because mnemonic variables have names that describe the data stored at that particular memory location.

What happens when the following code segment is Validated? int x = 20; Int main() { int x ; x = 10 ; return x ; }

  1. Complies Successfully

  2. Error Due to Duplicate Variables.

  3. RunTime Error

  4. Executes Successfully


Correct Option: A

What is the value of x when the below code segment is executed? int main() { int x , *z ; x = 10 ; z = &x ; x = 20 ; *z = 10 ; }

  1. 10

  2. 20

  3. Compilation Error

  4. RuntimeError


Correct Option: A

Which of the following statements are correct?

  1. Relational and equality operators evaluate their operands to produce a true or false result.

  2. The equality operators have the same level of precedence And associate right to left.

  3. Relational operators all have the same level of precedence And associate right to left.

  4. The precedence of relational operators is at a lower level Than the precedence of the equality operators.


Correct Option: A

Which of the following statements are correct about Function prototypes?

  1. It resembles the header Of the function definition

  2. It tells the compiler the Names of the parameters

  3. It must be declared before its corresponding functions can be utilized

  4. All the above are incorrect


Correct Option: C

Which of the following will occur when trying to validate the below code Segment? #define #define // GetSquareOfx function-prototype has the following defn // int GetSquareOfx(int) ; Int main() { int x =5 ; Cout << GetSquareOfx() ; return x ; }

  1. Syntax Error

  2. Linker Error

  3. Runtme Error

  4. No Error, It will be run successfully


Correct Option: B

Which of the following can be used to initialize a newly declared Variable from an existing variable?

  1. Virtual Function

  2. Namespaces

  3. copy constructor

  4. None of the Above


Correct Option: C
- Hide questions