programming languages Online Quiz - 292

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

main() { signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit = (bit >> (i - (i -1)))); } }

  1. Compile error

  2. 256256256256256

  3. 55555

  4. runtime error

Correct Option: B

void main(){ print(“%d”,printf(“What this prints”)) };

  1. Compile error

  2. What this prints

  3. 11

  4. 15

Correct Option: D

What is the maximum length of command line arguments including space between adjacent arguments

  1. 100

  2. 50

  3. 200

  4. 150

Correct Option: C

void main(){ print(“%d”,scanf(“%s”)) };

  1. Compile error

  2. 11

  3. Hello world

  4. 5

Correct Option: B

void main() { int x=20,y=35; x= y++ + x++; y= ++y + ++x; printf(" %d %d" , x,y); }

  1. x=57 & y=94

  2. x=57,y=55

  3. X = 57 Y= 93

  4. X = 37 Y= 65

Correct Option: A

AI Explanation

To determine the values of x and y after executing the given code, let's go through each line of the code step by step:

  1. int x=20, y=35; - This line initializes the variables x and y with the values 20 and 35, respectively.
  2. x = y++ + x++; - This line assigns the value of y++ + x++ to x.
    • y++ is a post-increment operation, meaning that the value of y is used first and then incremented by 1. So, y++ evaluates to 35, and y becomes 36.
    • Similarly, x++ is a post-increment operation, so x++ evaluates to 20, and x becomes 21.
    • Therefore, x is assigned the value 35 + 20 = 55.
  3. y = ++y + ++x; - This line assigns the value of ++y + ++x to y.
    • ++y is a pre-increment operation, meaning that the value of y is incremented by 1 first and then used. So, ++y evaluates to 37, and y becomes 37.
    • Similarly, ++x is a pre-increment operation, so ++x evaluates to 22, and x becomes 22.
    • Therefore, y is assigned the value 37 + 22 = 59.
  4. printf(" %d %d", x, y); - This line prints the values of x and y.

Therefore, the output of the code will be 55 59.

The correct answer is not listed among the options provided.

  1. The Gang of Four

  2. The Party of Five

  3. The soft-drink industry

  4. AC/DC

Correct Option: A
  1. Don't link your modules to modules written in any other language

  2. Make sure you declare all your variables' data types ahead of time

  3. Don't add variables of one type to variables of another

  4. Devout prayer

Correct Option: D

If I told you a key characteristic of my programming language of choice was that it generated threaded code which language would I most likely be talking about?

  1. Pascal

  2. Java

  3. Forth

  4. Python

Correct Option: C

Your local supermarket is all sold out of energy drinks Jolt Cola and Mountain Dew. Which beverage will keep you going packing the most caffeine and sugar into a 12-ounce can?

  1. Sunkist Orange Soda

  2. Coca-Cola Classic

  3. Pepsi-Cola

  4. Dr. Pepper

Correct Option: A

Which of the following is NOT a central tenet of extreme programming?

  1. Refactor your code often

  2. Throw away obsolete code

  3. Debugging is for wimps

  4. Communicate often with the customer

Correct Option: C

What is the relationship between Java and JavaScript?

  1. Netscape invented JavaScript as a stripped-down "lite" version of Java

  2. Java borrowed ideas from JavaScript and made it a full-fledged programming language

  3. They both originate from the same research at Sun Microsystems

  4. There is none; it's all just marketing

Correct Option: D

Why do some consider Ruby to be more "purely" object-oriented than other more popular OOP languages such as Java and C++?

  1. Because Ruby forces object orientation and does not permit procedural or functional style code

  2. Because Ruby makes no distinction between objects and primitive types

  3. Because Ruby's syntax is similar to that of Perl

  4. Because Ruby programmers are full of themselves

Correct Option: B

Failure to validate user input is one of the most common sources of software security vulnerabilities. When is it safe to accept user input without validation?

  1. When the application is running behind a firewall

  2. Never; any program that accepts input can be exploited

  3. When the application is written in Perl using the language's "taint mode"

  4. When the user is your own mother

Correct Option: B
  1. Use more global variables

  2. Keep variable and function names down to one or two letters

  3. Insert comments throughout your source code files

  4. Use pointer arithmetic wherever possible

Correct Option: C

Of the following who is NOT the inventor of a programming language in current use?

  1. Andrew S. Tanenbaum

  2. Guido van Rossum

  3. Niklaus Wirth

  4. Bjarne Stroustrup

Correct Option: A
  1. The code that would have been written last month if your project was on deadline

  2. The amount of code that you can produce in a month on your salary

  3. The fallacy that assigning more staff to a programming job will complete it faster

  4. The fact that like Sysiphus pushing the boulder you can never finish debugging

Correct Option: C

Hungarian Notation is a variable-naming convention used by some programmers. How did it get its name?

  1. It was called that because of its similarity to Reverse Polish Notation

  2. Its inventor was Hungarian

  3. When you read it out loud it sounds like you're speaking Hungarian

  4. It was invented at the Polytechnic University of Bucharest in Hungary

Correct Option: B
- Hide questions