Question

In which order the following ‘arguments’ of the foo() function will be put on the stack...

In which order the following ‘arguments’ of the foo() function will be put on the stack (the left-most variable has the highest memory address and the right-most variable has the lowest memory address)?

void foo(int d, int s, string x, int e)

d, s, x, e.

e, x, s, d.

x, d, s, e.

d, s, e, x.

To execute an external command from inside a program, either of the ‘system()’ or ‘execve()’ functions can be used. Select ALL of the following statements that are TRUE.

The ‘execve’ function is more secure as it uses different channels for data and code.

The ‘execve’ is less secure as it takes more arguments.

The ‘system’ function is less secure because it removes the boundary between data and code.

The ‘system’ function is more secure as it relies on the shell to execute the command.

What will the following command will instruct the system to do?

sudo sysctl -w kernel.randomize_va_space=1

Torn on randomisation of both the heap and the stack.

Turn off randomisation of address space.

Turn on the heap randomisation only.

Turn on stack randomisation only.

Calculate the address of the ‘Return Address’ assuming that the offset between the buffer and ebp is 77 bytes, and ebp is pointing to the address 0xbffea120.

0xbffea0d3 (= ebp – 77).

0xbffea171 (= ebp + 81).

0xbffea16d (= ebp + 77) .

0xbffea124 (= ebp + 4).

What will be the consequence of overwriting the return address with the address of a valid instruction in the kernel area of the system?

The program will execute the instruction.

The program will crash.

The system will crash.

The system will execute the next command.

A vulnerable program allows the user to provide input that will be used directly as an argument for a printf() function. Which of the following will allow the attacker to reveal the value of a variable stored on the ‘heap’ if he knows that the distance between the address of the variable (on the stack) and va_list is 16 bytes?

%s%s%s%s%s
%d%d%d%d%s 
%d%d%d%d
%d%d%d%d%n
%d%d%d%d%d
%d%d%d%s

A company purchases cyberinsurance to cover loss of revenue due to denial-of-service attacks. This illustrates which of the following options for addressing a risk.

Transfer.

Mitigate.

Eliminate.

Accept.

Chinese shipbuilders in the 12th century CE used watertight compartments to ensure that if one part of the ship was leaking, the ship itself would not sink. Which of the following security principles does this illustrate?

Secure the weakest link.

Economy of mechanism.

Minimize the attack surface.

Establish trust boundaries.

Which of the following format specifiers allows you to ‘write’ into memory?

%s
%n
%d
%x

A supermarket manager is concerned about a recent increased incidence of shoplifting. Which of the following mechanisms best illustrates the principle of psychological acceptability?

Customers must pass through an X-ray machine as they leave the store.

Customers are monitored using hidden cameras as they shop.

Customers are followed by security guards around the store as they shop.

Customers cannot enter the store, they must ask staff to fetch the items for them.

Which of the following threat modelling techniques is least likely to uncover a potential zero-day attack?

STRIDE.

Persona non grate (PnG).

Security cards.

Misuse case.

Homework Answers

Answer #1

Stack frame is constructed implicitly for memory allocation during the function call. Explicitly, memory allocation can be effieciently  handled by  heap area using malloc(),calloc(),realloc(),new, free() and delete respectively. Coming to question, the function parameters are pushed on the stack before the function is called and  the parameters are pushed from right to left. This means that the last parameter is pushed first and the first parameter is pushed last. As a result of this first parameter will naturally be closest to the top of the stack. So the order of the ‘arguments/parameters' for the function call void foo(int d, int s, string x, int e) will be:

e,x,s,d.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A program’s instructions are loaded into memory: From the stack pointer and loaded down in memory...
A program’s instructions are loaded into memory: From the stack pointer and loaded down in memory From the base pointer and loaded up in memory From a physical Page address and loaded up in memory On the IA32 stack and grows downward in memory Which of the following is a valid stack frame for a procedure call: a) Caller Function Stack Frame b) Caller Function Stack Frame c) Caller Function Stack Frame d) Caller Function Stack Frame argument1 argument2 argument2...
1.Select all C++ functions that must be defined for implementing deep copies in your class which...
1.Select all C++ functions that must be defined for implementing deep copies in your class which has instance variables pointing to dynamic memories. Group of answer choices a.Default Constructor b.Copy Constructor c.Overloading assignment operator d.Writing own friend functions to directly access dynamically allocated memories e.Writing own destructor to free the allocated memory f.Overloading new operator 2. Match the memory source (right side) of the variables (left side) of the following code snippet which is a part of 'myProg' program. Note...
C program. Given the following code: int add_and_double(int a, int b) { int result = (a...
C program. Given the following code: int add_and_double(int a, int b) { int result = (a + b) * 2; return result; } int main() {   int val; val = add_and_double(12, 40); return 0; } where the function main() (i.e. the caller) calls the function add_and_double() (i.e. the callee). Which of the following actions are taken when main() calls the function add_and_double()?  Select all that apply. a. Once the callee returns, the caller frees the stack memory for the callee's function...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n ==...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n == 0)    return 0; else    return n * f(n - 1); } A. 120 B. 60 C. 1 D. 0 10 points    QUESTION 2 Which of the following statements could describe the general (recursive) case of a recursive algorithm? In the following recursive function, which line(s) represent the general (recursive) case? void PrintIt(int n ) // line 1 { // line 2...
1.) Perform the following multiplication using Booth’s algorithm: (You will receive full credit only if you...
1.) Perform the following multiplication using Booth’s algorithm: (You will receive full credit only if you show all your work)      13 x -13 (a) 27/4 Using paper pencil approach and (b) simulate how a machine does this job 2.)Perform the following division as directed: (a) 27/4 using non-restoring division algorithm // we need 4 quotient bits. (b) Using Newton-Raphson algorithm find 1/d when d=0.84 // show the results of the first 3 iterations 3.) A real-time computer system has...
#Linked Lists and Classes #C++ Hi, please use singly linked list method to do this question....
#Linked Lists and Classes #C++ Hi, please use singly linked list method to do this question. Thank you! Here’s the contents of a file called example.cpp: // example.cpp #include "LinkedList.h" #include <iostream> #include <string> using namespace std; int main() { cout << "Please enter some words (ctrl-d to stop):\n"; LinkedList lst; int count = 0; string s; while (cin >> s) { count++; lst.add(remove_non_letters(s)); } // while cout << "\n" << count << " total words read in\n"; cout <<...
For each of the following situations, which of the following ADTs would be most appropriate, and...
For each of the following situations, which of the following ADTs would be most appropriate, and explain (1) Queue ADT; (2) Stack ADT; (3) Ranked or Positional Sequence ADT; (4) None of these. a. The customers at the deli counter who take numbers to mark their turn. b. An alphabetic list of names. c. Integers that need to be sorted. d. Execution environments of a recursive method. e. The items on a cash register tape. f. A word processor that...
Python Related Which of the following statements are true? A. A higher-order function takes as arguments...
Python Related Which of the following statements are true? A. A higher-order function takes as arguments other functions. B. Python is a multi-paradigm programming language. C. Lazy computation is when the CPU is to slow to complete a computation. D. In functional programming languages functions are first-class concepts. E. It's OK to have functions with side effects in pure functional languages.
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { flavor = s; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         System.out.println(pepper.getFlavor());     } } a. a class variable b. a constructor c. a local object variable d....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT