0

programming languages Online Quiz - 127

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

Output of: vector (1 2 2 3 4 4)

  1. #6(1 2 2 3 4)

  2. #6(1 2 3 4)

  3. #6(1 2 2 3 4 4)

  4. #4(1 2 3 4)


Correct Option: A

(string-set! "DrScheme" 2 4) what will be the output?

  1. DrScheme

  2. Sh

  3. Error : string-set! accepts 1 argument, given 3

  4. Error: string-set!: expects type as 1st argument, given "DrScheme"


Correct Option: D

Which of the following is true with respect to comma?

  1. It has got last priority with Left to right grouping order.

  2. It has got last priority with right to left grouping order.

  3. It has got second last priority with right to left grouping order.

  4. None of the above.


Correct Option: A

Which of the following is true with respect to Relational Operators?

  1. Order of precedence is after Bitwise Operators

  2. Order of precedence is prior to Type casting operators

  3. The order of precedence is prior to Shift operators

  4. Order of precedence is next to Shift Operators


Correct Option: D

Which of the following has the highest priority? 1. Bitwise XOR 2. Bitwise OR 3. Logical OR 4. Logical AND

  1. Bitwise XOR

  2. Bitwise OR

  3. Logical OR

  4. Logical AND


Correct Option: A

Who is the inventor of COBOL

  1. John Backus

  2. Andres Hejlsberg

  3. Grace Hopper

  4. Brendan Eich


Correct Option: C

Who is the inventor of Delphi

  1. Anders Hejlsberg

  2. James Gosling

  3. Gurido Van Rossum

  4. Alan Cooper


Correct Option: A

Who is the inventor of Visual Basic

  1. Alan Cooper

  2. John Kemeny

  3. Bjarne Stroutsup

  4. Larry wall


Correct Option: A

Who is the inventor of BCPL?

  1. Brendan Eich

  2. Ken Thompson

  3. Richard Cooper

  4. Martin Richards


Correct Option: D

Who is the inventor of Java Script

  1. Grace Hooper

  2. Brendan Eich

  3. Ken Thompson

  4. Yukhiro Matsumoto


Correct Option: B

Who is the inventor of Perl

  1. Larry Wall

  2. Yukhiro Matsumoto

  3. Guido Van Rossom

  4. Dennis Ritchie


Correct Option: A

Who is the inventor of Ruby

  1. John Backus

  2. Larry wall

  3. Rasmus Leedorf

  4. Yukhiro Matsumoto


Correct Option: D

Who is the inventor of c#

  1. James Gosling

  2. Anders Hejlsberg

  3. Alan cooper

  4. John Backus


Correct Option: B

Who is the inventor of Java

  1. Bjarne Stroutsup

  2. Larry Wall

  3. James Gosling

  4. Dennis Ritchie


Correct Option: C

what is the output? main() { int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf(“%d \t %dn”,x,y); }

  1. 56 93

  2. 57 94

  3. 58 95

  4. 60 98


Correct Option: B

AI Explanation

To determine the output of the given code, let's go through each line of code step by step:

  1. int x=20, y=35;

    • This line initializes two integer variables, x with a value of 20 and y with a value of 35.
  2. x=y++ + x++;

    • In this line, the expression y++ + x++ is evaluated.
    • The postfix increment operator ++ increments the value of y after it has been used in the expression.
    • The value of y++ is 35, and the value of x++ is 20.
    • So, x = 35 + 20, resulting in x = 55.
    • After the evaluation, the value of x is incremented by 1 due to the postfix increment, making it 21.
    • The value of y is incremented by 1 due to the postfix increment as well, making it 36.
  3. y= ++y + ++x;

    • In this line, the expression ++y + ++x is evaluated.
    • The prefix increment operator ++ increments the value of y and x before they are used in the expression.
    • The value of ++y is 37, and the value of ++x is 22.
    • So, y = 37 + 22, resulting in y = 59.
    • After the evaluation, the value of x is incremented by 1 due to the prefix increment, making it 23.
    • The value of y is incremented by 1 due to the prefix increment as well, making it 60.
  4. printf("%d \t %dn", x, y);

    • This line prints the values of x and y using the printf function.
    • The format specifier %d is used to print integer values.
    • The format specifier %t is used to print a horizontal tab character.
    • The format specifier %n is not a valid specifier.

So, the correct output will be 57 94. Therefore, the correct answer is B.

2.What will print out? main() { char p1=“name”; char *p2; p2=(char)malloc(20); memset (p2, 0, 20); while(*p2++ = *p1++); printf(“%sn”,p2); }

  1. name

  2. 0

  3. empty string.

  4. none


Correct Option: C

AI Explanation

To answer this question, let's go through the code step by step:

main() {
    char *p1 = "name";
    char *p2;
    p2 = (char*)malloc(20);
    memset(p2, 0, 20);
    while (*p2++ = *p1++);
    printf("%sn", p2);
}

First, we declare two character pointers p1 and p2.

p1 is assigned the address of a string literal "name".

p2 is allocated memory using malloc(20) and the memory is initialized to 0 using memset(p2, 0, 20).

Next, there is a while loop: while (*p2++ = *p1++). This loop copies the characters from p1 to p2 until it encounters the null character ('\0') at the end of the string.

After the while loop, p2 is pointing to the null character at the end of the copied string.

Finally, printf("%sn", p2) is used to print the contents of p2.

Since p2 is pointing to the null character at the end of the copied string, it will print an empty string.

Therefore, the correct answer is C) empty string.

3.What is the output?main() { int x=5; printf(“%d,%d,%dn”,x,x< <2,x>>2); }

  1. 5,1,20

  2. 5,10,20

  3. 5,20,1

  4. 5,15,25


Correct Option: B

4.What will be printed as the result of the operation below: main() { char *ptr = ” Cisco Systems”; *ptr++; ptr++; printf(“%sn”,ptr); }

  1. Cisco System

  2. isco Systems

  3. Cisco Systems

  4. Cisco


Correct Option: B
Explanation:

To solve this question, the user needs to understand how pointers work in C and the order of operations in the given code.

Initially, ptr points to the first character of the string "Cisco Systems".

The expression *ptr++ increments the pointer ptr to point to the next character, but dereferences the original pointer to get the value of the first character. Therefore, this operation has no effect on the value of ptr.

The expression ptr++ increments the pointer again, so that it now points to the second character of the string.

Finally, the printf function is called, which outputs the string starting from the second character.

Therefore, the correct answer is:

The Answer is: B. isco Systems

5.What is the output? main() { char s1[]=“TCS”; char s2[]= “systems”; printf(“%s”,s1); }

  1. 0

  2. null

  3. systems

  4. TCS


Correct Option: D

What is a thin-client application?

  1. A browser that uses a plug-in to process user data.

  2. A distributed application where the client program does not process data, but instead passes data for processing to an enterprise bean running on an application server

  3. An application that cannot be stopped by firewall

  4. An application compiled with the thin option of the javac command


Correct Option: B
- Hide questions