August 26, 2019

Computer Programming - MCQS

Note: We have tried to upload as much as we can, all the question and answers might be shuffled - Please find the answer below each question, some answers might be wrong please review on the last date(some answers might be changed) if you find any wrong answer please comment down below.


Question 1
Which among the following is not an usage of structure?
Select one:
A. Changing the size of the cursor
B. Receiving a key from the keyboard
C. Placing the cursor at an appropriate position on screen
D. Drawing any graphics shape on the screen
E. None of the options
Correct Answer: E

Question 2
#include <stdio.h>
struct sample
{
                int a=0;
                char b='A';
                float c=10.5;
};
int main()
{
                struct sample s;
                printf("%d,%c,%f",s.a,s.b,s.c);
                return 0;
}
Select one:
A. No Error, No Output
B. 0, A, 10.5
C. Error
D. 0, A, 10.500000
Correct Answer: C

Question 3
What will be the output of the program ?
#include<stdio.h>
#include<string.h>
int main()
{
    char str1[20] = "Hello", str2[20] = " Program";
    printf("%s\n", strcpy(str2, strcat(str1, str2)));
    return 0;
}
Select one:
A. ProgramHello
B. Program
C. Hello Program
D. Hello
Correct Answer: C

Question 4
What will be the output of the program?
#include<stdio.h>
int main()
{
    static char s[25] = "C-Programming-skills";
    int i=0;
    char ch;
    ch = s[++i];
    printf("%c", ch);
    ch = s[i++];
    printf("%c", ch);
    ch = i++[s];
    printf("%c", ch);
    ch = ++i[s];
    printf("%c", ch);
    return 0;
}
Select one:
A. --Ps
B. C--s
C. C-Pr
D. -Pro
Correct Answer: A

Question 5
Which among the following is true about srtcmpi()?
Select one:
A. Compares two strings
B. Compares two strings with regard to case
C. Compares first n characters of two strings
D. Compares two strings without regard to case
Correct Answer: D

Question 6
Can you combine the following two statements into one?
char *p;
p = (char*) malloc(100);
Select one:
A. char p = *malloc(100);
B. char *p = (char *)(malloc*)(100);
C. char *p = (char) malloc(100);
D. char *p = (char*)malloc(100)
Correct Answer: D

Question 7
# include <stdio.h>
void print(int arr[])
{
   int n = sizeof(arr)/sizeof(arr[0]);
   int i;
   for (i = 0; i < n; i++)
   printf("%d ", arr[i]);
}
int main()
{
   int arr[] = {4,5,7,1,2,6,7,8};
   print(arr);
   return 0;
}
Select one:
A. 4,5,7,1,2,6,7,8
B. Compile error
C. Run time error
D. 4 5
Correct Answer: D

Question 8
#include<stdio.h>
int i;
int fun();
int main()
{
    while(i)
    {
        fun();
        main();
    }
    printf("Hello");
    return 0;
}
int fun()
{
    printf("Hi");
}
Select one:
A. Infinite loop
B. Hello
C. No output
D. Hi Hello
Correct Answer: B

Question 9
#include&lt;stdio.h&gt;
void fun(int*, int*);
int main()
{
int i=5, j=2;
fun(&amp;i, &amp;j);
printf(&quot;%d, %d&quot;, i, j);
return 0;
}
void fun(int *i, int *j)
{
*i = *i**i;
*j = *j**j;
}
Select one:
A. 2, 5
B. 25, 4
C. 5, 2
D. 10, 4
Correct Answer: B

Question 10
Find the odd man out in the following:
Select one:
A. N[i]
B. *N+i
C. *(i+N)
D. *(N+i)
Correct Answer: B

Question 11
What will be the output of the program?
#include<stdio.h>
    struct course
    {
        int courseno;
        char coursename[25];
    };
int main()
{
    struct course c[] = { {102, "Ruby"},
                          {103, "Scala"},
                          {104, "Python"}     };
    printf("%d ", c[1].courseno);
    return 0;
}
Select one:
A. 104
B. 102
C. 103
D. Error
Correct Answer: C

Question 12
int main()
{
    int i;
    int arr[5] = {1};
    for (i = 0; i < 5; i++)
    printf("%d ", arr[i]);
    return 0;
}
Select one:
A. 11111
B. error
C. 10000
D. 00000
Correct Answer: C

Question 13
How will you free the allocated memory ?
Select one:
A. delete(var-name);
B. free(var-name);
C. remove(var-name);
D. dalloc(var-name);
Correct Answer: B

Question 14
___________is a macro which returns a 0 if end of file is not reached.
Select one:
A. Feof()
B. Ferror()
C. Fscanf()
D. Fprintf()
Correct Answer: A

Question 15
Can we receive input from keyboard for the array of pointers to strings?
Select one:
A. Yes
B. Rarely
C. No
D. May be
Correct Answer: C

Question 16
Accessing array elements by pointers is _____________ faster than accessing them
by subscripts.
Select one:
A. Not
B. Always
C. Sometimes
D. Probably
Correct Answer: B

Question 17
Which among the following is the drawback of putch, putchar, fputchar()?
Select one:
A. Outputs only one character at a time
B. None of the above
C. Comes out of the screen
D. Outputs more than one character at a time
Correct Answer: A

Question 18
What will be the output of the program?
#include<stdio.h>
#include<string.h>
int main()
{
    char sentence[80];
    int i;
    printf("Enter a line of text\n");
    gets(sentence);
    for(i=strlen(sentence)-1; i >=0; i--)
    putchar(sentence[i]);
    return 0;
}
Select one:
A. The sentence will get printed in same order as it entered
B. The sentence will get printed in reverse order
C. Half of the sentence will get printed
D. None of above
Correct Answer: B

Question 19
#include <stdio.h>
int main()
{
    int arr[10];
    // Assume that base address of arr is 4000 and size of integer
    // is 32 bit
    arr++;
    printf("%u", arr);
    return 0;
}
Select one:
A. 4020
B. 4002
C. lvalue required
D. 4004
Correct Answer: C
.
Question 20
What is the output of the following program?
int main()
{
    int i;
    int arr[4] = {0};
    for (i = 0; i <= 4; i++)
    printf("%d ", arr[i]);
    return 0;
}
Select one:
A. crash
B. prints 0 four times 1
C. Error
D. The program may print 0 four times followed by garbage value, or may crash if address (arr+5) is invalid.
Correct Answer: D


July 11, 2019

Software Architectures - Comprehensive Reference Solution

Question 
Choose the most appropriate architectural pattern (one) for the 5 descriptions below. Motivate for your choices (give reasons for choosing the pattern):
1. Wants to split a system into a number of computationally independent execution structures (groups of software and hardware) such as database, business logic, web interface and client, connected by some communication media. The structure is chosen to provide a specific server environment optimized for operational requirements and resource usage.

2. Wants to set up a set of equal distributed computational entities that are connected via a common protocol to share their services and provide high availability and scalability.

3. Wants a system that can be divided into reusable, loosely coupled components that can be flexibly combined and arranged to transform between various data formats.

4. Wants a distributed system with a structure that enables that service users do not need to know the nature or location of service providers.

5. Wants a system that quickly can analyze enormous volumes of data by sorting the data and then analyzing the grouped data.

Answer:
1 .Multi-tier
2. Peer-to-peer
3.Pipe-and-filter
4. Broker
5. Map-Reduce

Question
Present a general and a specific scalability requirement in the form of a Quality Attribute Scenario

Answer
A concrete scalability quality attribute scenario:

  • Source system owner 
  • Stimulus request to accommodate five times more concurrent users 
  • Artifact the main server cluster 
  • Environment normal operation 
  • Response increase the number of servers no more than sixfold, without recompiling the software 
  • Response measure performance as measured by average number of typical requests processed per minute may not drop more than 10%


Question 
In the Service Oriented Architecture style there is a strong decoupling between functionality and implementation, throughout the application life-cycle. Applications are built by combining or connecting services. Explain why and how this architecture facilitates
a. (1) reuse of existing software components;
b. (1) independent development.

Answer:
 In SOA, application components depend on each other only through the service interface. No details of an implementation may be used or be visible.
(a) There are two elements of reuse. Once a service (interface) is defined, the only thing that needs to be done to use an existing piece of software is to map the service interface to this software, typically by building an adapter. Secondly, services can be reused in many different applications since they do not contain knowledge about their application context. One remark on the latter is in place: a service may use other services.
(b) This relies on the same separation between service definition and implementation. By defining and using only the service interface, the implementation of the service becomes irrelevant for the service user. For example, by defining the UPnP interface, the implementation behind is it entirely invisible and can be developed by independent parties. One might also replace one implementation by the other.

Question
Read the description of the Cricket-Ticket system below and do an architectural design using the attribute-driven design (ADD) method.
Your answer should include: • Architectural drivers • Architectural tactics and patterns • A logical view • Interfaces • Verification of the architecture
Note that you should only describe the logical view and only do one level of decomposition!
Motivate for your choices and state your assumptions.

The Cricket-Ticket System (CTS) is a system where the users can buy tickets using credit cards to cricket matches in India over the Internet using a Web-browser. The user can look at information about future matches from cricket teams from all over India, and see if there are any available seats. The information about the cricket matches is retrieved from various servers with different interfaces provided by the different teams. Note that the teams in India will change every year. It is critical that the TSS is available to the users all the time, and it cannot be unavailable for more than 2 minutes a week. Before important games, such as Champion League games, it is important that the system does not break down even if over 40000 users try to get tickets at the same time

Answer:
Step 1. Choose module to decompose: The CTS

Step 2a. Choose architectural drivers: AD1: The system cannot be down more than 2 minutes a week (availability) AD2: The system should provide secure electronic payment (security) AD3: The system should be able to communicate with various team servers (modifiability) AD4: The system must handle 40,000 simultaneous users (performance)

Step 2b. Choose architectural patterns: Tactics for security: Firewall for server, autorize users, authenticate users, Payment handled by third-party and usage of secure connection (e.g. https) Tactics for modifiability: Divide the functionality into coherent units and plan for changeable interfaces for external systems. Tactics for performance: Use replication of the server to ensure support for many users, and cache data from team servers. Tactics for availability: Use replication of the server to cope with downtime.
Architectural patterns: Use a kind of a model-view controller pattern where the view and the controller is represented in the user interface part and the model is the database. Replication is used on server and database for higher performance and availability. Separation of concern is used to provide modifiability (separate core functionality and external interfaces), and a separate part dealing with secure computation and interfaces.

Step 2c. Instantiate Modules and Allocate Functionality Applied architectural patterns and instantiated functionality for match browsing, seats browsing, and ticket booking. Also added a data manager that takes care of caching of data from external systems (stored in database).

Step 2d. Define Interfaces of the Child Modules Interfaces between the server and the external parts of the system: • Between User interface and user clients: HTML over HTTP • Between External system interface and External Team server: XML over HTTP • Between Data manager and Database server: SQL over HTTP • Between Ticket payment and External payment service: encrypted binary over HTTPS Interfaces within the server: • The User interface class provides display methods that uses other classes: • displayMatch() • displaySeats() • displayBooking() The Ticket payment class offer the method payTicket (used by the Ticket booking class) The Data manager class offers methods that are used by three other classes: • getMatchInformation() • getSeatsInformation() • getBookingInformation() The External system interface class, offers a more general method for accessing information from external team servers: • getInformation()

Step 2e. Verify Use Cases and Quality Scenarios Check that functional requirements are covered: • The user can get information about future matches: Match browsing class • The user can get information about available seats: Seats browsing class • The users can buy tickets: Ticket booking and Ticket payment classes Check architectural drivers: • AD1: The system cannot be down more than 2 minutes a week (availability): Replication of the server and the database, and caching of external servers. • AD2: The system should provide secure electronic payment (security): Use secure computation in Ticket payment class, use secure transfer (https) and secure external payment service. • AD3: The system should be able to communicate with various team servers (modifiability): Supported through the External system interface class. • AD4: The system must handle 40,000 simultaneous users (performance): Replication of the server and database, and caching of external servers.

Question
Read the description below and do the following:
1.Identify the most important quality attribute(s) and the architectural drivers for the system described below.
2.Choose and describe suitable architectural tactics for the problem described below, and describe how the tactics affect the quality attributes.
3.Create architecture views of the system described below. The architecture must be described in two views according to the 4+1 view model: Process and Logical view
Motivate for your choice of quality attributes, architectural drivers and the architectural tactics used in your architecture.
Software for House Alarm System: The software described here is software for controlling an alarm system sold to households. The software should be able to run different configurations consisting of sensors from various producers, variations in types of displays and keyboard/button configurations. The different configurations also represent different price segments from the very simple and cheap alarm systems to the expensive and advanced. The software system is supports both smoke (fire) and movement sensors (theft). In normal mode, the system is running on electrical power from a standard power socket in the wall. However, in case a power outage, the system can operate on battery power. All the sensors are powered by the system. In case of a detection of fire or theft, the system will start a siren (alarm sound) and the display information about what caused the alarm, in what area of the house. How the information is shown is dependent on the capabilities of the display used in the system from only simple text to graphical description of the situation. For the more expensive configurations, the system can call the fire department or a security company through a telephone connection. The system can also be set up to call the mobile phone of the owner of the house. The system will also warn the security company if the alarm system is running on battery. The software is running on custom made computer with a CPU, memory and various input/output interfaces.

Answer:
1.Most important quality attribute(s) and architectural drivers for the system: This system is a product line system with many variations of configurations. In addition, such a system must be reliable as it concerns safety of the users. The two most important quality attributes for this system are availability and modifiability. Architectural drivers for the system:
• The architecture must provide high availability because the system can possibly save lives or keep people out of danger.
• The architecture must provide interfaces that can handle various types of sensors.
• The architecture must be able to support various types of displays and keyboard/button configurations.
• The architecture must be flexible in such way that it provides different types of functionality based on the price segment of the product.
• The architecture must be able to automatically switch to battery-operated mode in case of a power outage.

Data Storage Technologies and Networks - Comprehensive Reference Solutions

Question 
Why is SCSI performance superior to that of IDE/ATA? Explain the reasons from an architectural perspective

Answer :
SCSI offers improved performance and expandability and compatibility  options, making it suitable for high-end computers.
- Number of devices supported is 16
- SCSI architecture derives its base from the client-server relationship
- SCSI initiator, or a client, sends a request to a SCSI target, or a server.
- The target performs the tasks requested and sends the output to the initiator
- When a device is initialized, SCSI allows for automatic assignment of device IDs on the bus, which prevents two or more devices using the same SCSI IDs

Question 
What is a difference between a Cluster and a geographically-dispersed Cluster from administrative perspective?

Answer :
Geographically dispersed clusters, also called stretched clusters or extended clusters, are clusters comprised of nodes that are placed in different physical sites. Geographically dispersed clusters are designed to provide failover in the event of a site loss due to power issues, natural disasters or other unforeseen events.
From administrative perspective the difference would come up due to the storage that will be used. It won't be a common storage available at the respective locations instead a replication between the two will have to be set up and managed accordingly. Managing failover will also be different than a normal
cluster.

Question
DAS provides an economically viable alternative to other storage networking Solutions. Justify this statement

Answer :
- Setup requires a relatively lower initial investment
- Setup is managed using host-based tools, such as the host OS, which makes storage management tasks easy for small and medium enterprises.
- Requires fewer management tasks, and less hardware and software elements to set up and operate.

Question

i.Write the type of networks in place of N1 and N2. Write the type of ports in place of P1 and P2.
ii. What is meant by FC network is lossless? How FC achieve this ? How can we achieve losslessness in FCoE?

Answer
(i)N1 – IP Network. N2 – FC SAN. P1- Native SCSI port. N2- FC port

(ii) An FC network is lossless, meaning that the protocol has a built-in mechanism that prevents frame drops caused by congestion. Fibre Channel manages congestion through link level, credit based flow control. With credit-based flow control, the receiver sends credits to the sender to indicate the availability of receive buffers; the sender waits for credits before transmitting messages to the receiver Busy receive port can send the control frame to the transmit port for pause in transmission. This is called PAUSE capability of ethernet. Using this FCoE supports losslessness which is required in FC transmission.

Question
i.Write Server Configuration for the following:
Export src and ports to client01 and client02, but only, client01 has root privileges on it.
The client machines have root and can mount anywhere  on /exports. Anyone in the world can mount /exports/obj read-only.

ii.How do you recover the data from backup in following scenarios :      
(a) Full backup taken on Monday, Incremental backup taken on Tuesday, Wednesday and Thursday. You have to restore system on Friday.
(b) Full backup taken on Monday, Cumulative backup taken on Tuesday, Wednesday and Thursday. You have to restore system on Friday.

Answer
i)
# Export src and ports to client01 and client02, but only
# client01 has root privileges on it
/usr/src /usr/ports -maproot=root    client01
/usr/src /usr/ports               client02
# The client machines have root and can mount anywhere
# on /exports. Anyone in the world can mount /exports/obj read-only
/exports -alldirs -maproot=root      client01 client02
/exports/obj –ro

ii)
First restore Mondays full backup. 
(a) Then restore backup of Tuesday, wednesday and Thursday. 
(b) After restoration of Monday’s, restore Thursday’s backup

Question 
A host generates 8,000 I/Os at peak utilization with an average I/O size of 32 KB.  The response time is currently measured at an average of 12 ms during peak utilizations. When synchronous replication is implemented with a Fiber Channel ink to a remote site, what is the response time experienced by the host if the network latency is 6 ms per I/O?

Answer
Actual response time = 12+ (6*4) + (32*1024/8000) = 40.096 
Where 12 ms = current response time 
6 ms per I/O = latency 
                   32*1024/8000 = data transfer time
Question 
We have 6 nodes running a cluster. If suddenly 5 nodes found that they can communicate with each other but they cannot communicate with one specific node.
i. What steps the cluster should take to prevent data corruption? What is this phenomena called?
ii. Now if it is found that cluster is split in two groups with 3 nodes in each group. Nodes in one group can communicate with each other but can not communicate with nodes of other group. What is this situation called? Explain in brief about the steps the cluster will take to resolve the problem. 
Answer :
(i) The node will be forced to shut down through some managed Switch. This is called fencing.
(ii)This is called as split brain. To prevent data corruption cluster should shut down the group with lesser number of nodes. Since here the number of nodes are equal, cluster will take the help of quorum disk to decide the group of nodes to be shut down

Question
A host generates 8,000 I/Os at peak utilization with an average I/O size of 32 KB.  The response time is currently measured at an average of 12 ms during peak utilizations. When synchronous replication is implemented with a Fiber Channel ink to a remote site, what is the response time experienced by the host if the network latency is 6 ms per I/O?

Answer :
Actual response time = 12+ (6*4) + (32*1024/8000) = 40.096
Where 12 ms = current response time
6 ms per I/O = latency
                   32*1024/8000 = data transfer time

Question 
It is required to connect one FOCE SAN and one FC SAN to a rack mounted servers having 10Gbe CNAs. Suggest a plan of connection with a diagram showing necessary components.

Answer :

Question 
Explain the action involved between the NDMP DMA control and NDMP Server during Recovery process in the given scenario.


Answer :

DMA creates a control connection to the secondary storage agent
 Connect using TCP port 10,000
 NDMP_CONNECT_OPEN  (to negotiate version)
 NDMP_CONNECT_CLIENT_AUTH (to authenticate DMA to Server)
DMA uses the tape library media changer to load the required tape
The SCSI service is invoked
 NDMP_SCSI_OPEN
 NDMP_SCSI_EXECUTE_CDB - to manipulate media changer
NDMP_SCSI_CLOSE
DMA prepares the tape service for a recovery operation
 The tape service is invoked
 NDMP_TAPE_OPEN
 NDMP_TAPE_READ - to validate volume label
 NDMP_TAPE_MTIO - to position tape to start of backup data
DMA prepares the mover for a recovery operation
 The mover is invoked
 NDMP_MOVER_SET_RECORD_SIZE
 NDMP_MOVER_SET_WINDOW
  DMA opens control connection to the primary storage agent
 Connect using TCP port 10,000
 NDMP_CONNECT_OPEN - to negotiate protocol version
 NDMP_CONNECT_CLIENT_AUTH - to authenticate DMA to Server
  DMA queries secondary storage agent for capabilities
 NDMP_CONFIG_GET_CONNECTION_TYPE
  DMA queries primary storage agent for capabilities
 NDMP_CONFIG_GET_BUTYPE_INFO
 NDMP_CONFIG_GET_CONNECTION_TYPE
  DMA obtains the data server’s data connection address information
 The Data service is invoked
 NDMP_DATA_LISTEN
  DMA creates a data connection connection between NDMP servers
 NDMP_MOVER_CONNECT
  DMA creates a data connection connection between NDMP servers
 The mover connects to the specified IP address & TCP port
  DMA instructs the data server to initiate the recovery operation
 NDMP_DATA_START_RECOVER
  DMA recovery request is processed
 Data service determines the offset & length of the DMA specified recovery data
 Data server requests the specified data stream be transferred
 NDMP_NOTIFY_DATA_READ
  DMA instructs the mover to transfer the specified recovery stream
 NDMP_MOVER_READ
the mover interacts with the tape service to access the recovery stream
  DMA instructs the mover to transfer the specified recovery stream
 The mover begins sending recovery stream over data connection
  NDMP Data & Tape services send periodic log messages to DMA
 NDMP_LOG_MESSAGE
  NDMP Tape service sends notification when DMA intervention is required
example: end of mover window or tape medium encountered
 NDMP_NOTIFY_MOVER_PAUSED
  DMA initiates tape swap possibly utilizing media changer support
 NDMP_TAPE_MTIO - to rewind/unload tape
 NDMP_SCSI_EXECUTE_CDB - to manipulate media changer
 NDMP_TAPE_MTIO - to position new tape
 NDMP_TAPE_READ - to validate new tape header
DMA prepares the mover to continue the recovery operation
 NDMP_MOVER_SET_WINDOW
 NDMP_MOVER_CONTINUE
Data server detects end of recovery operation

July 01, 2019

Network Security Assignment - SEM 7


Question
Identify the security principle: When data must arrive at receiver exactly as it was sent
Nonrepudiation
Integrity
Confidentiality
Authentication

Question
Identify the security principle: When a sender cannot deny sending a sent message
Nonrepudiation
Integrity
Confidentiality
Authentication

Question
When an attacker performs a capture of a data unit and its subsequent retransmission, which attack he is performing?
Denial of service
Disruption
Spoofing
Replay

Question
What is the block cipher structure in DES?
RSA
Feistel
Shannon
Diffie-Hellman

Question
What does it mean that a hash function H is “collision resistant”?
It is easy to compute h = H(M) for any message M
Given h, it is infeasible to find x such that H(x) = h
Given x, it is infeasible to find y such that H(x) = H(y)
It is infeasible to find any x, y such that H(y) = H(x)

Question
Company XYZ wants to elect their new president by electronic voting. Which security principle will be applicable if only employees are allowed to vote.
Authentication
Integrity
Non-repudiation
Confidentiality

Question
Company XYZ wants to elect their new president by electronic voting. Which security principle will be applicable if No one should be able to see who the other voted for.
Authentication
Integrity
Non-repudiation
Confidentiality

Question
Company XYZ wants to elect their new president by electronic voting. Which security principle will be applicable if An employee should be able to verify that his vote was not changed.
Authentication
Integrity
Non-repudiation
Confidentiality

Question
Company XYZ wants to elect their new president by electronic voting. Which security principle will be applicable if The employee cannot deny having voted
Authentication
Integrity
Non-repudiation
Confidentiality

Question
Alice and Bob share a common secret password, P. Using this, they want to authenticate each other. Which of the following is the correct way to do so?
Alice sends P to Bob. Bob verifies P to authenticate Alice.
Alice sends the message encrypted with P. If Bob is able to decrypt it successfully, Alice is authenticated.
Alice sends a random number encrypted with P. Bob decrypts the number and authenticates Alice.
Bob sends Alice a random challenge. Alice returns the challenge encrypted with P.
Bob sends Alice a random challenge encrypted with P. Alice returns the challenge+1 encrypted with P.

Question
In which algorithmic mode does the corresponding cipher text block repeat if a plain text block repeats in the original message? Select all correct options
ECB
CBC
CFB
OFB

Question
In which algorithmic mode can the ciphering operation be performed in parallel? Select all correct options
ECB
CBC
CFB
OFB

Question
Consider the following scenario.A and B both share a secret key with a Key Distribution Center (KDC). We call these keys Ka-kdc and Kb-kdc respectively. A wants to establish a shared symmetric key with B using the following steps:A sends a message to the KDC encrypted by Ka-kdc. Encrypt Ka-kdc(B)KDC responds by sending Encrypt Ka-kdc(Kb-kdc)A now corresponds with B using Kb-kdc. Is this solution correct or incorrect. Justify.
The solution is correct. The KDC first verifies A since Ka-kdc is known only to A. Only the KDC and B know Kb-kdc.
The solution is incorrect. The KDC first verifies A since Ka-kdc is known only to A. Only the KDC and B know Kb-kdc.

Question
Consider the following scenario.Alice wants to send assignment grades from her home computer to Bob at work. She wants to prevent anyone from modifying the grades. So Alice sends a message M to Bob along with H = Hash(M). Bob receives M and H, and calculates H’ = Hash(M). Only if H = H', Bob accepts the message. Is this solution foolproof?
Yes because if the message is changed, the hash will also change and Bob will be able to detect the modified
No because the intruder may replace M with M' and H with Hash(M').

Question
A class has n students. How many symmetric secret keys are needed if each students wants to send secret messages to another?
1
n
n*n
n(n-1)/2

Question
A class has n students. If they all trust the classteacher, how many symmetric secret keys are needed?
1
n
n*n
n(n-1)/2

Question
If the class teacher distributes a temporary one-time session key for a communicating pair, how many keys are needed? The temporary key is encrypted and sent to both members.
1
n
n*n
n(n-1)/2

Question
If public key cryptography is used, how many keys are needed in all?
1
2
n
2n

Question
An attack on a cipher text message where the attacker attempts to use all possible permutations and combinations is called:
Brute force attack
Man-in-the-middle
Chosen plaintext
Chosen ciphertext

Question
Which of the following is most efficient to achieve confidentiality and digital signature for message M
Use public key cryptography to hide message M by applying Encrypt-with-Kreceiverpublic(M) and sign message M applying Encrypt-with-Ksenderprivate(M)
Use public key cryptography to hide message M by applying Encrypt-with-Kreceiverpublic(M) and sign message by applying Encrypt-with-Ksenderprivate(Hash(M))
Use public key cryptography to share key by applying Encrypt-with-Kreceiverpublic(Kshared), hide message by applying Encrypt-with-Kshared(M) and sign message by applying Encrypt-with-Ksenderprivate(Hash(M))
Use private key cryptography to hide message M by applying Encrypt-with-Kshared(M) and sign message by applying Encrypt-with-Kshared(Hash(M))

Question
Key distribution often involves the use of _________ which are generated and distributed for temporary use between two parties.
Session keys
Public keys
private keys
Certificates

June 24, 2019

Network Security - Comprehensive Paper Solution


Note: This is a previous year comprehensive solutions for your reference, feel free to provide solutions by navigating Submit Question/Answer tab in case you have latest solutions.


1) Jira's password is made of up 6 alphanumeric characters only. One password attempt takes 1 millisecond, What is the time to crack it in days?
i)  If password is case-sensitive.
ii) If password is case- insensitive.

Answer:
i) Case sensitive
 total chars = 26 + 26 + 10 = 62
 possible combinations = 62 ^ 6 passwords
 total time taken = 62 ^ 6 . 1 ms
 approx. 62.62 =~ 3600 sec = 1 hour
 Total time taken = 62. 62. 62. 62 / 1000 hours
 =~ 360. 36 hours = 360.36/24 days
 =~ 360.3/2= 180.3 = 540 days
 Note: 62^4/1000/24 =~ 615 days
 So an approx. answer between 520 to 620 days is good enough.

ii) Case insensitive
 total chars = 26 + 10 = 36
 possible combinations = 36 ^ 6 passwords
 total time taken = 36 ^ 6 . 1 ms
 = 36.36.36./ 1000 . 36 ^3
 =~ 36. 36 ^ 3 seconds
 = 36. 36. 36. 36 / 3600 hours
  = 466 hours
 =~ 19 days
 So an approx. answer between 18 to 20 days is good enough.

2) What is a self-signed SSL certificate ?  Detail on the security perspective when a website is using a self-signed SSL certificate.

Answer:
A certificate not-signed by a Publicly trusted CA, but signed by a locally setup CA server is a self-signed certificate. Any entity/website/server using a self-signed SSL certificate cannot be trusted and very commonly used in phising attacks. I can setup a server to act as gmail.com fradulently by creating a self-signed certificate for www.gmail.com and deploying it in the server.

Most standard browsers – Firefox, Google Chrome, Safari, etc. throw errors when trying to browse to websites having self-signed certificates.

3) How to avoid man-in-the-middle attack in SSH sessions? Show passwordless SSH logins at work.

Answer:
Man-in-the-middle attack is at-work when a client C logs in to a server M thinking it is server S and the client C is unable to detect it. In this case, the server M has successfully duped the client C and has forged a man-in-the-middle attack. So it can be a passive two-way data forwarder between client C and the actual server S, or an active data-mangler.
Every host server in SSH have their public keys sent to the client in the Key Exchange., which gets stored in client’s .ssh/known_hosts file. So the next time, client connects to the host, the server sent public key is matched with the client’s .ssh/known_hosts file and if there is a mismatch, SSH does not connect. So this SSH behavior effectively thwarts a middle server M trying to pose as actual server S.
Password less SSH logins happen via public keys.
Consider Client C connecting to Server S. In server S side, in file .ssh/authorized_keys, there should be entry containing client C’s public key. Then the server S will use it to exchange - encrypting/signing initial key exchange material with the client C. Because of the property that any data encrypted with public key can only be decrypted using the matching private key, this mechanism automatically authenticates the client C as only client C holds the private key. Client’s private key file are usually stored in file .ssh/id_rsa or .ssh/id_dsa depending on the public key algorithm chosen.