0

programming languages Online Quiz - 111

Description: programming languages Online Quiz - 111
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

main() { char s1[]=“Cisco”; char s2[]= “systems”; printf(“%s”,s1); }

  1. systems

  2. Cisco

  3. Null

  4. error


Correct Option: B

#define TRUE 0 // some code while(TRUE) { // some code }

  1. infinite loop

  2. Error

  3. This will not go into the loop as TRUE is defined as 0.

  4. 0


Correct Option: C

main() { int x=10, y=15; x = x++; y = ++y; printf(“%d %dn”,x,y); }

  1. 10,16

  2. 11,15

  3. 10,15

  4. 11,16


Correct Option: D

AI Explanation

To understand the output of this program, let's go through each line of code:

  1. int x=10, y=15; - This line declares two integer variables x and y and initializes them with the values 10 and 15, respectively.

  2. x = x++; - This line is using the post-increment operator on x. The post-increment operator increments the value of x by 1 and returns the original value before the increment. However, since the assignment statement x = x++ is assigning the value of x++ back to x, the result is undefined behavior. Therefore, it is not recommended to use the post-increment operator in an assignment statement like this. The behavior of this statement is unpredictable.

  3. y = ++y; - This line is using the pre-increment operator on y. The pre-increment operator increments the value of y by 1 and returns the incremented value. So, ++y will increment the value of y to 16, and then assign that value back to y.

  4. printf("%d %dn",x,y); - This line prints the values of x and y.

Given the above code, the output of the program will be "11 16". Therefore, the correct answer is D) 11, 16.

main() { int a=0; if(a==0) printf(“Cisco Systemsn”); printf(“Cisco Systemsn”); }

  1. Two lines with “Cisco Systems” will be printed.

  2. Compile error

  3. run time error

  4. Cisco Systemsn


Correct Option: A

Which of the following languages is a subset of C++ language?

  1. C language

  2. Java Language

  3. C# language

  4. B language


Correct Option: A
Explanation:

To solve this question, the user needs to know the concept of subsets, i.e., a subset is a part of a larger set. The user must identify which language(s) are a subset of C++.

Now, let's go through each option and explain why it is right or wrong:

A. C language: This option is correct. C++ is an extension of the C language, which means that all C programs are also C++ programs. Therefore, C is a subset of C++.

B. Java Language: This option is incorrect. Java is not a subset of C++. Although both languages share some similarities, they are distinct programming languages with different syntax and features.

C. C# language: This option is incorrect. C# is not a subset of C++. C# is a programming language developed by Microsoft and is not related to C++.

D. B language: This option is incorrect. B language is not a subset of C++. B language was developed in the early 1970s and is not widely used today.

The Answer is: A. C language

Which of the following correctly describes C++ language?

  1. Statically typed language

  2. Dynamically typed language

  3. Both Statically and dynamically typed language

  4. Type-less language


Correct Option: A

Which of the following keyword supports dynamic method resolution?

  1. Abstract

  2. Virtual

  3. Dynamic

  4. Typeid


Correct Option: B

Which of the following language is not supported by C++?

  1. Exception Handling

  2. Reflection

  3. Operator Overloading

  4. Namespaces


Correct Option: B

Which of the following language feature is not an access specifier in C++?

  1. Public

  2. Private

  3. Protected

  4. Internal


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of access specifiers in C++.

Access specifiers in C++ are used to define the visibility and accessibility of class members (variables and functions) within a class or from outside the class. There are three access specifiers in C++: public, private, and protected.

Here is an explanation for each option:

Option A) Public - This option is a valid access specifier in C++. Public members are accessible from within the class, as well as from outside the class.

Option B) Private - This option is a valid access specifier in C++. Private members are only accessible from within the class.

Option C) Protected - This option is a valid access specifier in C++. Protected members are accessible from within the class and its derived classes.

Option D) Internal - This option is not a valid access specifier in C++. "Internal" is not an access specifier in C++. It is not used to define the visibility or accessibility of class members in C++.

The correct answer is option D) Internal. This option is not an access specifier in C++.

If X is the name of the class, what is the correct way to declare copy constructor of X?

  1. X(X arg)

  2. X(X* arg)

  3. X(const X* arg)

  4. X(const X& arg)


Correct Option: D

What does STL stand for?

  1. Simple Template Library

  2. Standard Template Library

  3. Static Type Library

  4. Single Type-based Library


Correct Option: B

AI Explanation

To answer this question, you need to understand what STL stands for. Let's go through each option to understand why it is correct or incorrect:

Option A) Simple Template Library - This option is incorrect because the correct expansion of STL is not "Simple Template Library."

Option B) Standard Template Library - This option is correct. STL stands for Standard Template Library. The Standard Template Library is a library in C++ that provides a collection of generic algorithms, data structures, and containers.

Option C) Static Type Library - This option is incorrect because the correct expansion of STL is not "Static Type Library."

Option D) Single Type-based Library - This option is incorrect because the correct expansion of STL is not "Single Type-based Library."

The correct answer is B) Standard Template Library.

Which of the following is the most common way of implementing C++?

  1. C++ programs are directly compiled into native code by a compiler

  2. C++ programs are first compiled to intermediate code by a compiler and then executed by a virtual machine

  3. C++ programs are interpreted by an interpreter

  4. A C++ editor directly compiles and executes the program


Correct Option: A

What is the implicit pointer that is passed as the first argument for nonstatic member functions?

  1. ‘self’ pointer

  2. std::auto_ptr pointer

  3. ‘Myself’ pointer

  4. ‘this’ pointer


Correct Option: D
Explanation:

To solve this question, the user needs to have knowledge of C++ programming language and the concept of member functions.

The implicit pointer that is passed as the first argument for nonstatic member functions in C++ is known as the 'this' pointer.

Option A: 'self' pointer is not a valid keyword in C++. Hence, this option is incorrect.

Option B: std::auto_ptr is a smart pointer that is used for automatic memory management in C++. However, it is not passed as the first argument for nonstatic member functions. Hence, this option is incorrect.

Option C: 'Myself' pointer is not a valid keyword in C++. Hence, this option is incorrect.

Option D: 'this' pointer is a pointer that points to the object for which the member function is called. It is passed as a hidden argument to non-static member functions. Hence, this option is correct.

Therefore, the answer is: D. 'this' pointer.

  1. = (assignment operator)

  2. == (equality operator)

  3. –> (row operator)

  4. :: (scope resolution operator)


Correct Option: D

Choose correct syntax used for external CSS

  1. .

  2. .

  3. Both

  4. None


Correct Option: B

Choose correct syntax for making a submit button:

  1. input type="submit" name="s1" value="press"/>

  2. none


Correct Option: C

We have following break line tag is used in all browser


  1. tag works in all browsers


  2. is recommended now.


  3. tag not supported for IE, Mazola etc. works in all browsers


  4. is more will outdated


Correct Option: A,B

Choose correct syntax as per w3c standard:

  1. .

    Welcome to r4r

  2. .

    Welcome to r4r

  3. .

    Welcome to r4r

  4. .

    Welcome to r4r


Correct Option: B,D

Choose true option :

  1. HTML allow images and objects to be embedded on web page to create interactive forms by using some script

  2. .HTML allow images and objects to be embedded on web page to create interactive forms by using tags.

  3. Both of the above

  4. None


Correct Option: B

The file attribute is used when we have to include the within same directory. When we have in different directory then we use attribute in server side include tag?

  1. True

  2. False


Correct Option: A
- Hide questions