Programming Languages and Software Engineering
Test your knowledge of programming language concepts, software engineering principles, and coding practices
Questions
main() { signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit = (bit >> (i - (i -1)))); } }
- Compile error
- 256256256256256
- 55555
- runtime error
void main(){ print(“%d”,scanf(“%s”)) };
- Compile error
- 11
- Hello world
- 5
void main(){ print(“%d”,printf(“What this prints”)) };
- Compile error
- What this prints
- 11
- 15
What is the maximum length of command line arguments including space between adjacent arguments
- 100
- 50
- 200
- 150
main() { signed int bit=512, i=5; for(;i;i--) { printf("%dn", bit = (bit >> (i - (i -1)))); } }
- Compile error
- 256256256256256
- 55555
- runtime error
void main(){ print(“%d”,scanf(“%s”)) };
- Compile error
- 11
- Hello world
- 5
void main() { int x=20,y=35; x= y++ + x++; y= ++y + ++x; printf(" %d %d" , x,y); }
- x=57 & y=94
- x=57,y=55
- X = 57 Y= 93
- X = 37 Y= 65
Which group has had the most impact on modern object-oriented programming practices?
- The Gang of Four
- The Party of Five
- The soft-drink industry
- AC/DC
What is the best way to preserve type safety in assembly language?
- Don't link your modules to modules written in any other language
- Make sure you declare all your variables' data types ahead of time
- Don't add variables of one type to variables of another
- Devout prayer
Just-in-time (JIT) compilation improves the performance of languages that compile into bytecode. Which language featured the first JIT compiler?
- Java
- C#
- Smalltalk
- Cobol
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?
- Pascal
- Java
- Forth
- Python
Which of the following is NOT a central tenet of extreme programming?
- Refactor your code often
- Throw away obsolete code
- Debugging is for wimps
- Communicate often with the customer
What is the relationship between Java and JavaScript?
- Netscape invented JavaScript as a stripped-down "lite" version of Java
- Java borrowed ideas from JavaScript and made it a full-fledged programming language
- They both originate from the same research at Sun Microsystems
- There is none; it's all just marketing
Why do some consider Ruby to be more "purely" object-oriented than other more popular OOP languages such as Java and C++?
- Because Ruby forces object orientation and does not permit procedural or functional style code
- Because Ruby makes no distinction between objects and primitive types
- Because Ruby's syntax is similar to that of Perl
- Because Ruby programmers are full of themselves
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?
- When the application is running behind a firewall
- Never; any program that accepts input can be exploited
- When the application is written in Perl using the language's "taint mode"
- When the user is your own mother
Which of the following is the best way to write reusable code that is easier to maintain?
- Use more global variables
- Keep variable and function names down to one or two letters
- Insert comments throughout your source code files
- Use pointer arithmetic wherever possible
Of the following who is NOT the inventor of a programming language in current use?
- Andrew S. Tanenbaum
- Guido van Rossum
- Niklaus Wirth
- Bjarne Stroustrup
To what concept does "the mythical man-month" refer?
- The code that would have been written last month if your project was on deadline
- The amount of code that you can produce in a month on your salary
- The fallacy that assigning more staff to a programming job will complete it faster
- The fact that like Sysiphus pushing the boulder you can never finish debugging
Hungarian Notation is a variable-naming convention used by some programmers. How did it get its name?
- It was called that because of its similarity to Reverse Polish Notation
- Its inventor was Hungarian
- When you read it out loud it sounds like you're speaking Hungarian
- It was invented at the Polytechnic University of Bucharest in Hungary