These are not just questions these are very much important questions which are sure to come in microsoft certification exam, These are questions are taken from the faculties, students and many more talented persons from microsoft and niit and other places…
so just learn these questions to get your certificate in your favour …
Q11: You are developing a method to decrypt data that was encrypted
with the Triple DES Algorithm. The method accepts the following
parameters:
– The byte array to be decrypted, which is named cipherMessage
– The key, which is named key
– An initialization vector, which is named iv
You need to decrypt the message by using the TripleDES class and place
the result in a string. Which code segment should you use?
A. TripleDES des = new TripleDESCryptoServiceProvider();
des.BlockSize = cipherMessage.Length;
ICryptoTransform crypto = des.CreateDecryptor(key, iv);
MemoryStream cipherStream = new MemoryStream(cipherMessage);
CryptoStream cryptoStream = new CryptoStream( cipherStream, crypto, CryptoStreamMode.Read);
string message;
message = new StreamReader(cryptoStream).ReadToEnd();
B. TripleDES des = new TripleDESCryptoServiceProvider();
des.FeedbackSize = cipherMessage.Length;
ICryptoTransform crypto = des.CreateDecryptor(key, iv);
MemoryStream cipherStream = new MemoryStream(cipherMessage);
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Read);
string message;
message = new StreamReader(cryptoStream).ReadToEnd();
C. TripleDES des = new TripleDESCryptoServiceProvider();
ICryptoTransform crypto = des.CreateDecryptor();
MemoryStream cipherStream = new MemoryStream(cipherMessage);
CryptoStream cryptoStream = new CryptoStream( cipherStream, crypto, CryptoStreamMode.Read);
string message;
message = new StreamReader(cryptoStream).ReadToEnd();
D. TripleDES des = new TripleDESCryptoServiceProvider();
ICryptoTransform crypto = des.CreateDecryptor(key, iv);
MemoryStream cipherStream = new MemoryStream(cipherMessage);
CryptoStream cryptoStream = new CryptoStream( cipherStream, crypto, CryptoStreamMode.Read);
string message;
message = new StreamReader(cryptoStream).ReadToEnd();
Answer: D
Q12: You are writing a method that returns an ArrayList named al. You
need to ensure that changes to the ArrayList are performed in a thread-
safe manner. Which code segment should you use?
A. ArrayList al = new ArrayList();
lock (al.SyncRoot){
return al;}
B. ArrayList al = new ArrayList();
lock (al.SyncRoot.GetType()){
return al;}
C. ArrayList al = new ArrayList();
Monitor.Enter(al);
Monitor.Exit(al);
return al;
D. ArrayList al = new ArrayList();
ArrayList sync_al = ArrayList.Synchronized(al);
return sync_al;
Answer: D
Q13: You create a method that runs by using the credentials of the end
user. You need to use Microsoft Windows groups to authorize the user. You
must add a code segment that identifies whether a user is in the local
group named Clerk. Which code segment should you use?
A. WindowsIdentity currentUser = WindowsIdentity.GetCurrent();
foreach(IdentityReference grp in currentUser.Groups) {
NTAccount grpAccount = ((NTAccount)grp.Translate(typeof(NTAccount)));
isAuthorized = grpAccount.Value.Equals(Environment.MachineName + @”\Clerk”);
if(isAuthorized)
break;}
B. WindowsPrincipal currentUser = (WindowsPrincipal)Thread.CurrentPrincipal;
isAuthorized = currentUser.IsInRole(”Clerk”);
C. GenericPrincipal currentUser = (GenericPrincipal)Thread.CurrentPrincipal;
isAuthorized = currentUser.IsInRole(”Clerk”);
D. WindowsPrincipal currentUser = (WindowsPrincipal)Thread.CurrentPrincipal;
isAuthorized = currentUser.IsInRole(Environment.MachineName);
Answer: B
Q14: You are writing code for user authentication and authorization. The
username, password, and roles are stored in your application data store.
You need to establish a user security context that will be used for
authorization checks such as IsInRole. You write the following code
segment to authorize the user.
if (!TestPassword(userName, password))
throw new Exception(”could not authenticate user”);
String[] userRolesArray = LookupUserRoles(userName);
You need to complete this code so that it establishes the user security
context. Which code segment should you use?
A. GenericIdentity ident = new GenericIdentity(userName);
GenericPrincipal currentUser = new GenericPrincipal(ident, userRolesArray);
Thread.CurrentPrincipal = currentUser;
B. WindowsIdentity ident = new WindowsIdentity(userName);
WindowsPrincipal currentUser = new WindowsPrincipal(ident);
Thread.CurrentPrincipal = currentUser;
C. NTAccount userNTName = new NTAccount(userName);
GenericIdentity ident = new GenericIdentity(userNTName.Value);
GenericPrincipal currentUser = new GenericPrincipal(ident, userRolesArray);
Thread.CurrentPrincipal = currentUser;
D. IntPtr token = IntPtr.Zero;
token = LogonUserUsingInterop(username, encryptedPassword);
WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(token);
Answer: A
–Nikhil Kumar
For all dumps just visit my blog and try to leave your precious comments...
www.dotnetask.blog.co.in