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
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...
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...
#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 <<...
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...
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...
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....
1. A mechanism by which other modules, such as I/O and memory, may interrupt the normal...
1. A mechanism by which other modules, such as I/O and memory, may interrupt the normal sequencing of the processor is called (A) Communication (B) Trap (C) Interrupt (D) I/O (E) None of the above 2. A mode of operation that provides for the interleaved execution of two or more computer programs by a single processor is called (A) Interrupt (B) Multi-programming (C) Multi-tasking (D) Multi-threading (E) None of the above 3. Which of the following is a memory location...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*;...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*; import javax.swing.*; public class Clicker extends JFrame implements ActionListener {     int count;     JButton button;     Clicker() {         super("Click Me");         button = new JButton(String.valueOf(count));         add(button);         button.addActionListener(this);         setSize(200,100);         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         setVisible(true);     }     public void actionPerformed(ActionEvent e) {         count++;         button.setText(String.valueOf(count));     }     public static void main(String[] args) { new Clicker(); } } a. add(button);...
   vi. Assume that a linked list stores the data, 20, 11, 13, 19, 12, 14...
   vi. Assume that a linked list stores the data, 20, 11, 13, 19, 12, 14 in that order. Assume that Node head references the first item in the list. What is the result to the linked list of       the following instructions? Assume that newNode          is a Node, already constructed. newNode.data = 1;                         newNode.next = head.next;                         head = newNode;       a. The value 1 is inserted into the linked list before 20       b. The...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT